From 216fc2edc3699096b8ed4c97a9256336deac0ff2 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 10 Sep 2020 16:31:18 +0800 Subject: [PATCH 1/3] init track2 sdk for appservice --- .../azure-mgmt-web/azure/mgmt/web/__init__.py | 19 +- .../azure/mgmt/web/_configuration.py | 68 +- .../azure/mgmt/web/_operations_mixin.py | 557 +- .../azure-mgmt-web/azure/mgmt/web/_version.py | 13 + .../mgmt/web/_web_site_management_client.py | 91 +- .../azure/mgmt/web/aio/__init__.py | 10 + .../mgmt/web/aio/_configuration_async.py | 66 + .../mgmt/web/aio/_operations_mixin_async.py | 582 + .../aio/_web_site_management_client_async.py | 422 + .../azure-mgmt-web/azure/mgmt/web/py.typed | 1 + .../azure/mgmt/web/v2015_04_01/__init__.py | 18 +- .../mgmt/web/v2015_04_01/_configuration.py | 83 +- .../azure/mgmt/web/v2015_04_01/_metadata.json | 60 + .../azure/mgmt/web/v2015_04_01/_version.py | 9 + .../_web_site_management_client.py | 77 +- .../mgmt/web/v2015_04_01/aio/__init__.py | 10 + .../v2015_04_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 73 + .../aio/operations_async/__init__.py | 17 + ..._registration_provider_operations_async.py | 104 + .../_domains_operations_async.py | 1058 + .../_top_level_domains_operations_async.py | 242 + .../mgmt/web/v2015_04_01/models/__init__.py | 261 +- .../mgmt/web/v2015_04_01/models/_models.py | 2891 +- .../web/v2015_04_01/models/_models_py3.py | 3010 +- .../_web_site_management_client_enums.py | 282 +- .../web/v2015_04_01/operations/__init__.py | 7 +- ...domain_registration_provider_operations.py | 127 +- .../operations/_domains_operations.py | 1276 +- .../_top_level_domains_operations.py | 294 +- .../azure/mgmt/web/v2015_04_01/py.typed | 1 + .../azure/mgmt/web/v2015_08_01/__init__.py | 18 +- .../mgmt/web/v2015_08_01/_configuration.py | 83 +- .../azure/mgmt/web/v2015_08_01/_metadata.json | 59 + .../azure/mgmt/web/v2015_08_01/_version.py | 9 + .../_web_site_management_client.py | 73 +- .../mgmt/web/v2015_08_01/aio/__init__.py | 10 + .../v2015_08_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 68 + .../aio/operations_async/__init__.py | 15 + ...ice_certificate_orders_operations_async.py | 1399 + ..._registration_provider_operations_async.py | 104 + .../mgmt/web/v2015_08_01/models/__init__.py | 238 +- .../mgmt/web/v2015_08_01/models/_models.py | 2807 +- .../web/v2015_08_01/models/_models_py3.py | 2917 +- .../_web_site_management_client_enums.py | 274 +- .../web/v2015_08_01/operations/__init__.py | 7 +- ...p_service_certificate_orders_operations.py | 1674 +- ...ficate_registration_provider_operations.py | 127 +- .../azure/mgmt/web/v2015_08_01/py.typed | 1 + .../azure/mgmt/web/v2016_03_01/__init__.py | 18 +- .../mgmt/web/v2016_03_01/_configuration.py | 83 +- .../azure/mgmt/web/v2016_03_01/_metadata.json | 244 + .../azure/mgmt/web/v2016_03_01/_version.py | 9 + .../_web_site_management_client.py | 95 +- .../mgmt/web/v2016_03_01/aio/__init__.py | 10 + .../v2016_03_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 94 + .../aio/operations_async/__init__.py | 27 + .../_billing_meters_operations_async.py | 112 + .../_certificates_operations_async.py | 418 + .../_deleted_web_apps_operations_async.py | 107 + .../_diagnostics_operations_async.py | 1718 + .../_provider_operations_async.py | 240 + .../_recommendations_operations_async.py | 615 + ...source_health_metadata_operations_async.py | 450 + ...site_management_client_operations_async.py | 915 + .../mgmt/web/v2016_03_01/models/__init__.py | 429 +- .../mgmt/web/v2016_03_01/models/_models.py | 2945 +- .../web/v2016_03_01/models/_models_py3.py | 3593 +- .../_web_site_management_client_enums.py | 625 +- .../web/v2016_03_01/operations/__init__.py | 11 +- .../operations/_billing_meters_operations.py | 121 +- .../operations/_certificates_operations.py | 496 +- .../_deleted_web_apps_operations.py | 118 +- .../operations/_diagnostics_operations.py | 1976 +- .../operations/_provider_operations.py | 303 +- .../operations/_recommendations_operations.py | 734 +- .../_resource_health_metadata_operations.py | 549 +- .../_web_site_management_client_operations.py | 1171 +- .../azure/mgmt/web/v2016_03_01/py.typed | 1 + .../azure/mgmt/web/v2016_08_01/__init__.py | 18 +- .../mgmt/web/v2016_08_01/_configuration.py | 83 +- .../azure/mgmt/web/v2016_08_01/_metadata.json | 58 + .../azure/mgmt/web/v2016_08_01/_version.py | 9 + .../_web_site_management_client.py | 69 +- .../mgmt/web/v2016_08_01/aio/__init__.py | 10 + .../v2016_08_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 63 + .../aio/operations_async/__init__.py | 13 + .../_web_apps_operations_async.py | 22210 +++++++++++ .../mgmt/web/v2016_08_01/models/__init__.py | 458 +- .../mgmt/web/v2016_08_01/models/_models.py | 3776 +- .../web/v2016_08_01/models/_models_py3.py | 4544 ++- .../_web_site_management_client_enums.py | 616 +- .../web/v2016_08_01/operations/__init__.py | 7 +- .../operations/_web_apps_operations.py | 26244 +++++++------ .../azure/mgmt/web/v2016_08_01/py.typed | 1 + .../azure/mgmt/web/v2016_09_01/__init__.py | 18 +- .../mgmt/web/v2016_09_01/_configuration.py | 83 +- .../azure/mgmt/web/v2016_09_01/_metadata.json | 59 + .../azure/mgmt/web/v2016_09_01/_version.py | 9 + .../_web_site_management_client.py | 73 +- .../mgmt/web/v2016_09_01/aio/__init__.py | 10 + .../v2016_09_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 68 + .../aio/operations_async/__init__.py | 15 + ...p_service_environments_operations_async.py | 3237 ++ .../_app_service_plans_operations_async.py | 2055 + .../mgmt/web/v2016_09_01/models/__init__.py | 261 +- .../mgmt/web/v2016_09_01/models/_models.py | 2098 +- .../web/v2016_09_01/models/_models_py3.py | 2507 +- .../_web_site_management_client_enums.py | 379 +- .../web/v2016_09_01/operations/__init__.py | 7 +- .../_app_service_environments_operations.py | 3876 +- .../_app_service_plans_operations.py | 2344 +- .../azure/mgmt/web/v2016_09_01/py.typed | 1 + .../azure/mgmt/web/v2018_02_01/__init__.py | 18 +- .../mgmt/web/v2018_02_01/_configuration.py | 83 +- .../azure/mgmt/web/v2018_02_01/_metadata.json | 275 + .../azure/mgmt/web/v2018_02_01/_version.py | 9 + .../_web_site_management_client.py | 123 +- .../mgmt/web/v2018_02_01/aio/__init__.py | 10 + .../v2018_02_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 129 + .../aio/operations_async/__init__.py | 41 + ...ice_certificate_orders_operations_async.py | 1411 + ...p_service_environments_operations_async.py | 3603 ++ .../_app_service_plans_operations_async.py | 2074 + ..._registration_provider_operations_async.py | 105 + .../_certificates_operations_async.py | 423 + .../_deleted_web_apps_operations_async.py | 236 + .../_diagnostics_operations_async.py | 1740 + ..._registration_provider_operations_async.py | 105 + .../_domains_operations_async.py | 1069 + .../_provider_operations_async.py | 243 + .../_recommendations_operations_async.py | 1047 + ...source_health_metadata_operations_async.py | 450 + .../_top_level_domains_operations_async.py | 245 + .../_web_apps_operations_async.py | 26348 +++++++++++++ ...site_management_client_operations_async.py | 1079 + .../mgmt/web/v2018_02_01/models/__init__.py | 1000 +- .../mgmt/web/v2018_02_01/models/_models.py | 7358 ++-- .../web/v2018_02_01/models/_models_py3.py | 8859 +++-- .../_web_site_management_client_enums.py | 1237 +- .../web/v2018_02_01/operations/__init__.py | 11 +- ...p_service_certificate_orders_operations.py | 1674 +- .../_app_service_environments_operations.py | 4286 ++- .../_app_service_plans_operations.py | 2344 +- ...ficate_registration_provider_operations.py | 126 +- .../operations/_certificates_operations.py | 496 +- .../_deleted_web_apps_operations.py | 267 +- .../operations/_diagnostics_operations.py | 1975 +- ...domain_registration_provider_operations.py | 126 +- .../operations/_domains_operations.py | 1278 +- .../operations/_provider_operations.py | 304 +- .../operations/_recommendations_operations.py | 1226 +- .../_resource_health_metadata_operations.py | 549 +- .../_top_level_domains_operations.py | 293 +- .../operations/_web_apps_operations.py | 30783 ++++++++------- .../_web_site_management_client_operations.py | 1351 +- .../azure/mgmt/web/v2018_02_01/py.typed | 1 + .../azure/mgmt/web/v2018_11_01/__init__.py | 18 +- .../mgmt/web/v2018_11_01/_configuration.py | 83 +- .../azure/mgmt/web/v2018_11_01/_metadata.json | 58 + .../azure/mgmt/web/v2018_11_01/_version.py | 9 + .../_web_site_management_client.py | 69 +- .../mgmt/web/v2018_11_01/aio/__init__.py | 10 + .../v2018_11_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 63 + .../aio/operations_async/__init__.py | 13 + .../_certificates_operations_async.py | 423 + .../mgmt/web/v2018_11_01/models/__init__.py | 203 +- .../mgmt/web/v2018_11_01/models/_models.py | 2436 +- .../web/v2018_11_01/models/_models_py3.py | 2464 +- .../_web_site_management_client_enums.py | 211 +- .../web/v2018_11_01/operations/__init__.py | 7 +- .../operations/_certificates_operations.py | 496 +- .../azure/mgmt/web/v2018_11_01/py.typed | 1 + .../azure/mgmt/web/v2019_08_01/__init__.py | 18 +- .../mgmt/web/v2019_08_01/_configuration.py | 83 +- .../azure/mgmt/web/v2019_08_01/_metadata.json | 264 + .../azure/mgmt/web/v2019_08_01/_version.py | 9 + .../_web_site_management_client.py | 127 +- .../mgmt/web/v2019_08_01/aio/__init__.py | 10 + .../v2019_08_01/aio/_configuration_async.py | 68 + .../aio/_web_site_management_client_async.py | 134 + .../aio/operations_async/__init__.py | 43 + ...ice_certificate_orders_operations_async.py | 1419 + ...p_service_environments_operations_async.py | 3093 ++ .../_app_service_plans_operations_async.py | 1920 + ..._registration_provider_operations_async.py | 105 + .../_certificates_operations_async.py | 424 + .../_deleted_web_apps_operations_async.py | 236 + .../_diagnostics_operations_async.py | 1708 + ..._registration_provider_operations_async.py | 105 + .../_domains_operations_async.py | 1072 + .../_provider_operations_async.py | 243 + .../_recommendations_operations_async.py | 1056 + ...source_health_metadata_operations_async.py | 453 + .../_static_sites_operations_async.py | 1769 + .../_top_level_domains_operations_async.py | 245 + .../_web_apps_operations_async.py | 27076 +++++++++++++ ...site_management_client_operations_async.py | 1018 + .../mgmt/web/v2019_08_01/models/__init__.py | 1090 +- .../mgmt/web/v2019_08_01/models/_models.py | 8006 ++-- .../web/v2019_08_01/models/_models_py3.py | 9673 +++-- .../_web_site_management_client_enums.py | 1324 +- .../web/v2019_08_01/operations/__init__.py | 11 +- ...p_service_certificate_orders_operations.py | 1688 +- .../_app_service_environments_operations.py | 3706 +- .../_app_service_plans_operations.py | 2162 +- ...ficate_registration_provider_operations.py | 126 +- .../operations/_certificates_operations.py | 495 +- .../_deleted_web_apps_operations.py | 267 +- .../operations/_diagnostics_operations.py | 1929 +- ...domain_registration_provider_operations.py | 126 +- .../operations/_domains_operations.py | 1280 +- .../operations/_provider_operations.py | 314 +- .../operations/_recommendations_operations.py | 1229 +- .../_resource_health_metadata_operations.py | 567 +- .../operations/_static_sites_operations.py | 2049 +- .../_top_level_domains_operations.py | 293 +- .../operations/_web_apps_operations.py | 31806 ++++++++-------- .../_web_site_management_client_operations.py | 1271 +- .../azure/mgmt/web/v2019_08_01/py.typed | 1 + sdk/appservice/azure-mgmt-web/setup.py | 4 +- ...gmt_app_service.test_app_service_plan.yaml | 202 + ...cli_mgmt_certificate.test_certificate.yaml | 54 + ...cli_mgmt_static_site.test_static_site.yaml | 111 + .../test_cli_mgmt_web_app.test_web_app.yaml | 112 + .../tests/test_cli_mgmt_app_service.py | 78 + .../tests/test_cli_mgmt_certificate.py | 78 + .../tests/test_cli_mgmt_static_site.py | 208 + .../azure-mgmt-web/tests/test_cli_mgmt_web.py | 745 +- .../tests/test_cli_mgmt_web_app.py | 276 + 236 files changed, 234809 insertions(+), 107738 deletions(-) create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/py.typed create mode 100644 sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_app_service.test_app_service_plan.yaml create mode 100644 sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_certificate.test_certificate.yaml create mode 100644 sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml create mode 100644 sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml create mode 100644 sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_app_service.py create mode 100644 sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_certificate.py create mode 100644 sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py create mode 100644 sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/__init__.py index 55c66f839cff..32779ae9e1b0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/__init__.py @@ -1,19 +1,16 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py index b96e0933169e..61d7be50b7bf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py @@ -8,42 +8,60 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration +from typing import Any -from .version import VERSION +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py index a748425a4ebd..5a1d28fb3c85 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py @@ -9,37 +9,43 @@ # regenerated. # -------------------------------------------------------------------------- from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING +import warnings +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -class WebSiteManagementClientOperationsMixin(object): +class WebSiteManagementClientOperationsMixin(object): - def check_name_availability(self, name, type, is_fqdn=None, custom_headers=None, raw=False, **operation_config): + def check_name_availability( + self, + name, # type: str + type, # type: Union[str, "models.CheckNameResourceTypes"] + is_fqdn=None, # type: Optional[bool] + **kwargs # type: Any + ): """Check if a resource name is available. Description for Check if a resource name is available. :param name: Resource name to verify. :type name: str - :param type: Resource type used for verification. Possible values - include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceNameAvailability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('check_name_availability') if api_version == '2016-03-01': @@ -52,28 +58,23 @@ def check_name_availability(self, name, type, is_fqdn=None, custom_headers=None, raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.check_name_availability(name, type, is_fqdn, custom_headers, raw, **operation_config) + return mixin_instance.check_name_availability(name, type, is_fqdn, **kwargs) - def get_publishing_user(self, custom_headers=None, raw=False, **operation_config): + def get_publishing_user( + self, + **kwargs # type: Any + ): """Gets publishing user. Description for Gets publishing user. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_publishing_user') if api_version == '2016-03-01': @@ -86,30 +87,26 @@ def get_publishing_user(self, custom_headers=None, raw=False, **operation_config raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.get_publishing_user(custom_headers, raw, **operation_config) + return mixin_instance.get_publishing_user(**kwargs) - def get_source_control(self, source_control_type, custom_headers=None, raw=False, **operation_config): + def get_source_control( + self, + source_control_type, # type: str + **kwargs # type: Any + ): """Gets source control token. Description for Gets source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_source_control') if api_version == '2016-03-01': @@ -122,28 +119,23 @@ def get_source_control(self, source_control_type, custom_headers=None, raw=False raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.get_source_control(source_control_type, custom_headers, raw, **operation_config) + return mixin_instance.get_source_control(source_control_type, **kwargs) - def get_subscription_deployment_locations(self, custom_headers=None, raw=False, **operation_config): + def get_subscription_deployment_locations( + self, + **kwargs # type: Any + ): """Gets list of available geo regions plus ministamps. Description for Gets list of available geo regions plus ministamps. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentLocations or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_subscription_deployment_locations') if api_version == '2016-03-01': @@ -156,32 +148,29 @@ def get_subscription_deployment_locations(self, custom_headers=None, raw=False, raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.get_subscription_deployment_locations(custom_headers, raw, **operation_config) - - def list_billing_meters(self, billing_location=None, os_type=None, custom_headers=None, raw=False, **operation_config): + return mixin_instance.get_subscription_deployment_locations(**kwargs) + + def list_billing_meters( + self, + billing_location=None, # type: Optional[str] + os_type=None, # type: Optional[str] + **kwargs # type: Any + ): """Gets a list of meters for a given location. Description for Gets a list of meters for a given location. - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param os_type: App Service OS type meters used for + :param os_type: App Service OS type meters used for. :type os_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BillingMeter - :rtype: - ~azure.mgmt.web.v2019_08_01.models.BillingMeterPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeter] - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('list_billing_meters') if api_version == '2018-02-01': @@ -192,41 +181,38 @@ def list_billing_meters(self, billing_location=None, os_type=None, custom_header raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.list_billing_meters(billing_location, os_type, custom_headers, raw, **operation_config) - - def list_geo_regions(self, sku=None, linux_workers_enabled=None, xenon_workers_enabled=None, linux_dynamic_workers_enabled=None, custom_headers=None, raw=False, **operation_config): + return mixin_instance.list_billing_meters(billing_location, os_type, **kwargs) + + def list_geo_regions( + self, + sku=None, # type: Optional[Union[str, "models.SkuName"]] + linux_workers_enabled=None, # type: Optional[bool] + xenon_workers_enabled=None, # type: Optional[bool] + linux_dynamic_workers_enabled=None, # type: Optional[bool] + **kwargs # type: Any + ): """Get a list of available geographical regions. Description for Get a list of available geographical regions. - :param sku: Name of SKU used to filter the regions. Possible values - include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', 'Dynamic', - 'Isolated', 'PremiumV2', 'ElasticPremium', 'ElasticIsolated' + :param sku: Name of SKU used to filter the regions. :type sku: str or ~azure.mgmt.web.v2019_08_01.models.SkuName - :param linux_workers_enabled: Specify true if you want to - filter to only regions that support Linux workers. + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. :type linux_workers_enabled: bool - :param xenon_workers_enabled: Specify true if you want to - filter to only regions that support Xenon workers. + :param xenon_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Xenon workers. :type xenon_workers_enabled: bool - :param linux_dynamic_workers_enabled: Specify true if you - want to filter to only regions that support Linux Consumption Workers. + :param linux_dynamic_workers_enabled: Specify :code:`true` if you want to filter + to only regions that support Linux Consumption Workers. :type linux_dynamic_workers_enabled: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of GeoRegion - :rtype: - ~azure.mgmt.web.v2019_08_01.models.GeoRegionPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegion] - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('list_geo_regions') if api_version == '2016-03-01': @@ -239,28 +225,23 @@ def list_geo_regions(self, sku=None, linux_workers_enabled=None, xenon_workers_e raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.list_geo_regions(sku, linux_workers_enabled, xenon_workers_enabled, linux_dynamic_workers_enabled, custom_headers, raw, **operation_config) + return mixin_instance.list_geo_regions(sku, linux_workers_enabled, xenon_workers_enabled, linux_dynamic_workers_enabled, **kwargs) - def list_premier_add_on_offers(self, custom_headers=None, raw=False, **operation_config): + def list_premier_add_on_offers( + self, + **kwargs # type: Any + ): """List all premier add-on offers. Description for List all premier add-on offers. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PremierAddOnOffer - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOffer] - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('list_premier_add_on_offers') if api_version == '2016-03-01': @@ -273,30 +254,26 @@ def list_premier_add_on_offers(self, custom_headers=None, raw=False, **operation raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.list_premier_add_on_offers(custom_headers, raw, **operation_config) + return mixin_instance.list_premier_add_on_offers(**kwargs) - def list_site_identifiers_assigned_to_host_name(self, name=None, custom_headers=None, raw=False, **operation_config): + def list_site_identifiers_assigned_to_host_name( + self, + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): """List all apps that are assigned to a hostname. Description for List all apps that are assigned to a hostname. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2019_08_01.models.IdentifierPaged[~azure.mgmt.web.v2019_08_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` - + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('list_site_identifiers_assigned_to_host_name') if api_version == '2016-03-01': @@ -309,28 +286,23 @@ def list_site_identifiers_assigned_to_host_name(self, name=None, custom_headers= raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.list_site_identifiers_assigned_to_host_name(name, custom_headers, raw, **operation_config) + return mixin_instance.list_site_identifiers_assigned_to_host_name(name_identifier, **kwargs) - def list_skus(self, custom_headers=None, raw=False, **operation_config): + def list_skus( + self, + **kwargs # type: Any + ): """List all SKUs. Description for List all SKUs. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SkuInfos or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('list_skus') if api_version == '2016-03-01': @@ -343,28 +315,23 @@ def list_skus(self, custom_headers=None, raw=False, **operation_config): raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.list_skus(custom_headers, raw, **operation_config) + return mixin_instance.list_skus(**kwargs) - def list_source_controls(self, custom_headers=None, raw=False, **operation_config): + def list_source_controls( + self, + **kwargs # type: Any + ): """Gets the source controls available for Azure websites. Description for Gets the source controls available for Azure websites. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SourceControl - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SourceControlPaged[~azure.mgmt.web.v2019_08_01.models.SourceControl] - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('list_source_controls') if api_version == '2016-03-01': @@ -377,34 +344,29 @@ def list_source_controls(self, custom_headers=None, raw=False, **operation_confi raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.list_source_controls(custom_headers, raw, **operation_config) - - def move(self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + return mixin_instance.list_source_controls(**kwargs) + + def move( + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): """Move resources between resource groups. Description for Move resources between resource groups. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 """ api_version = self._get_api_version('move') if api_version == '2016-03-01': @@ -417,30 +379,26 @@ def move(self, resource_group_name, target_resource_group=None, resources=None, raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.move(resource_group_name, target_resource_group, resources, custom_headers, raw, **operation_config) + return mixin_instance.move(resource_group_name, move_resource_envelope, **kwargs) - def update_publishing_user(self, user_details, custom_headers=None, raw=False, **operation_config): + def update_publishing_user( + self, + user_details, # type: "models.User" + **kwargs # type: Any + ): """Updates publishing user. Description for Updates publishing user. - :param user_details: Details of publishing user + :param user_details: Details of publishing user. :type user_details: ~azure.mgmt.web.v2019_08_01.models.User - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('update_publishing_user') if api_version == '2016-03-01': @@ -453,33 +411,29 @@ def update_publishing_user(self, user_details, custom_headers=None, raw=False, * raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.update_publishing_user(user_details, custom_headers, raw, **operation_config) - - def update_source_control(self, source_control_type, request_message, custom_headers=None, raw=False, **operation_config): + return mixin_instance.update_publishing_user(user_details, **kwargs) + + def update_source_control( + self, + source_control_type, # type: str + request_message, # type: "models.SourceControl" + **kwargs # type: Any + ): """Updates source control token. Description for Updates source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param request_message: Source control token information - :type request_message: - ~azure.mgmt.web.v2019_08_01.models.SourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('update_source_control') if api_version == '2016-03-01': @@ -492,34 +446,29 @@ def update_source_control(self, source_control_type, request_message, custom_hea raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.update_source_control(source_control_type, request_message, custom_headers, raw, **operation_config) - - def validate(self, resource_group_name, validate_request, custom_headers=None, raw=False, **operation_config): + return mixin_instance.update_source_control(source_control_type, request_message, **kwargs) + + def validate( + self, + resource_group_name, # type: str + validate_request, # type: "models.ValidateRequest" + **kwargs # type: Any + ): """Validate if a resource can be created. Description for Validate if a resource can be created. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param validate_request: Request with the resources to validate. - :type validate_request: - ~azure.mgmt.web.v2019_08_01.models.ValidateRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ValidateResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :type validate_request: ~azure.mgmt.web.v2019_08_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('validate') if api_version == '2016-03-01': @@ -532,33 +481,29 @@ def validate(self, resource_group_name, validate_request, custom_headers=None, r raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.validate(resource_group_name, validate_request, custom_headers, raw, **operation_config) - - def validate_container_settings(self, validate_container_settings_request, resource_group_name, custom_headers=None, raw=False, **operation_config): + return mixin_instance.validate(resource_group_name, validate_request, **kwargs) + + def validate_container_settings( + self, + resource_group_name, # type: str + validate_container_settings_request, # type: "models.ValidateContainerSettingsRequest" + **kwargs # type: Any + ): """Validate if the container settings are correct. Validate if the container settings are correct. - :param validate_container_settings_request: - :type validate_container_settings_request: - ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :param validate_container_settings_request: + :type validate_container_settings_request: ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('validate_container_settings') if api_version == '2018-02-01': @@ -567,34 +512,29 @@ def validate_container_settings(self, validate_container_settings_request, resou raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.validate_container_settings(validate_container_settings_request, resource_group_name, custom_headers, raw, **operation_config) - - def validate_move(self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + return mixin_instance.validate_container_settings(resource_group_name, validate_container_settings_request, **kwargs) + + def validate_move( + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): """Validate whether a resource can be moved. Description for Validate whether a resource can be moved. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 """ api_version = self._get_api_version('validate_move') if api_version == '2016-03-01': @@ -607,33 +547,27 @@ def validate_move(self, resource_group_name, target_resource_group=None, resourc raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.validate_move(resource_group_name, target_resource_group, resources, custom_headers, raw, **operation_config) + return mixin_instance.validate_move(resource_group_name, move_resource_envelope, **kwargs) - def verify_hosting_environment_vnet(self, parameters, custom_headers=None, raw=False, **operation_config): - """Verifies if this VNET is compatible with an App Service Environment by - analyzing the Network Security Group rules. + def verify_hosting_environment_vnet( + self, + parameters, # type: "models.VnetParameters" + **kwargs # type: Any + ): + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. - Description for Verifies if this VNET is compatible with an App Service - Environment by analyzing the Network Security Group rules. + Description for Verifies if this VNET is compatible with an App Service Environment by + analyzing the Network Security Group rules. - :param parameters: VNET information + :param parameters: VNET information. :type parameters: ~azure.mgmt.web.v2019_08_01.models.VnetParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetValidationFailureDetails or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('verify_hosting_environment_vnet') if api_version == '2016-03-01': @@ -646,8 +580,7 @@ def verify_hosting_environment_vnet(self, parameters, custom_headers=None, raw=F raise NotImplementedError("APIVersion {} is not available".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client - mixin_instance.config = self.config + mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - mixin_instance.api_version = api_version - return mixin_instance.verify_hosting_environment_vnet(parameters, custom_headers, raw, **operation_config) + return mixin_instance.verify_hosting_environment_vnet(parameters, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py new file mode 100644 index 000000000000..29fe9b397723 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 = "0.46.0" + diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py index 2d5316eeb5a5..cc33df37af4d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py @@ -9,41 +9,41 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient +from azure.mgmt.core import ARMPipelineClient from msrest import Serializer, Deserializer from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import WebSiteManagementClientConfiguration from ._operations_mixin import WebSiteManagementClientOperationsMixin +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, MultiApiClientMixin, _SDKClient): + """WebSite Management Client. -class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, MultiApiClientMixin, SDKClient): - """WebSite Management Client - - This ready contains multiple API versions, to help you deal with all Azure clouds + This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). - By default, uses latest API version available on public Azure. - For production, you should stick a particular api-version and/or profile. - The profile sets a mapping between the operation group and an API version. + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str :param str api_version: API version to use if no profile is provided, or if missing in profile. :param str base_url: Service URL :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ DEFAULT_API_VERSION = '2019-08-01' @@ -57,11 +57,20 @@ class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, MultiApiCl _PROFILE_TAG + " latest" ) - def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ): + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(WebSiteManagementClient, self).__init__( - credentials, - self.config, api_version=api_version, profile=profile ) @@ -126,7 +135,7 @@ def app_service_certificate_orders(self): from .v2019_08_01.operations import AppServiceCertificateOrdersOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def app_service_environments(self): @@ -145,7 +154,7 @@ def app_service_environments(self): from .v2019_08_01.operations import AppServiceEnvironmentsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def app_service_plans(self): @@ -164,7 +173,7 @@ def app_service_plans(self): from .v2019_08_01.operations import AppServicePlansOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def billing_meters(self): @@ -177,7 +186,7 @@ def billing_meters(self): from .v2016_03_01.operations import BillingMetersOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def certificate_registration_provider(self): @@ -196,7 +205,7 @@ def certificate_registration_provider(self): from .v2019_08_01.operations import CertificateRegistrationProviderOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def certificates(self): @@ -218,7 +227,7 @@ def certificates(self): from .v2019_08_01.operations import CertificatesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def deleted_web_apps(self): @@ -237,7 +246,7 @@ def deleted_web_apps(self): from .v2019_08_01.operations import DeletedWebAppsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def diagnostics(self): @@ -256,7 +265,7 @@ def diagnostics(self): from .v2019_08_01.operations import DiagnosticsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def domain_registration_provider(self): @@ -275,7 +284,7 @@ def domain_registration_provider(self): from .v2019_08_01.operations import DomainRegistrationProviderOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def domains(self): @@ -294,7 +303,7 @@ def domains(self): from .v2019_08_01.operations import DomainsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def provider(self): @@ -313,7 +322,7 @@ def provider(self): from .v2019_08_01.operations import ProviderOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def recommendations(self): @@ -332,7 +341,7 @@ def recommendations(self): from .v2019_08_01.operations import RecommendationsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def resource_health_metadata(self): @@ -351,7 +360,7 @@ def resource_health_metadata(self): from .v2019_08_01.operations import ResourceHealthMetadataOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def static_sites(self): @@ -364,7 +373,7 @@ def static_sites(self): from .v2019_08_01.operations import StaticSitesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def top_level_domains(self): @@ -383,7 +392,7 @@ def top_level_domains(self): from .v2019_08_01.operations import TopLevelDomainsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def web_apps(self): @@ -402,4 +411,12 @@ def web_apps(self): from .v2019_08_01.operations import WebAppsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + def close(self): + self._client.close() + def __enter__(self): + self._client.__enter__() + return self + def __exit__(self, *exc_details): + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py new file mode 100644 index 000000000000..5d40887e742f --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "AsyncTokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ) -> None: + # 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py new file mode 100644 index 000000000000..5f23bcf087fd --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py @@ -0,0 +1,582 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrest import Serializer, Deserializer +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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + + +class WebSiteManagementClientOperationsMixin(object): + + async def check_name_availability( + self, + name: str, + type: Union[str, "models.CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ) -> "models.ResourceNameAvailability": + """Check if a resource name is available. + + Description for Check if a resource name is available. + + :param name: Resource name to verify. + :type name: str + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes + :param is_fqdn: Is fully qualified domain name. + :type is_fqdn: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('check_name_availability') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.check_name_availability(name, type, is_fqdn, **kwargs) + + async def get_publishing_user( + self, + **kwargs + ) -> "models.User": + """Gets publishing user. + + Description for Gets publishing user. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_publishing_user') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_publishing_user(**kwargs) + + async def get_source_control( + self, + source_control_type: str, + **kwargs + ) -> "models.SourceControl": + """Gets source control token. + + Description for Gets source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_source_control') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_source_control(source_control_type, **kwargs) + + async def get_subscription_deployment_locations( + self, + **kwargs + ) -> "models.DeploymentLocations": + """Gets list of available geo regions plus ministamps. + + Description for Gets list of available geo regions plus ministamps. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_subscription_deployment_locations') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_subscription_deployment_locations(**kwargs) + + def list_billing_meters( + self, + billing_location: Optional[str] = None, + os_type: Optional[str] = None, + **kwargs + ) -> AsyncItemPaged["models.BillingMeterCollection"]: + """Gets a list of meters for a given location. + + Description for Gets a list of meters for a given location. + + :param billing_location: Azure Location of billable resource. + :type billing_location: str + :param os_type: App Service OS type meters used for. + :type os_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_billing_meters') + if api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_billing_meters(billing_location, os_type, **kwargs) + + def list_geo_regions( + self, + sku: Optional[Union[str, "models.SkuName"]] = None, + linux_workers_enabled: Optional[bool] = None, + xenon_workers_enabled: Optional[bool] = None, + linux_dynamic_workers_enabled: Optional[bool] = None, + **kwargs + ) -> AsyncItemPaged["models.GeoRegionCollection"]: + """Get a list of available geographical regions. + + Description for Get a list of available geographical regions. + + :param sku: Name of SKU used to filter the regions. + :type sku: str or ~azure.mgmt.web.v2019_08_01.models.SkuName + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. + :type linux_workers_enabled: bool + :param xenon_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Xenon workers. + :type xenon_workers_enabled: bool + :param linux_dynamic_workers_enabled: Specify :code:`true` if you want to filter + to only regions that support Linux Consumption Workers. + :type linux_dynamic_workers_enabled: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_geo_regions') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_geo_regions(sku, linux_workers_enabled, xenon_workers_enabled, linux_dynamic_workers_enabled, **kwargs) + + def list_premier_add_on_offers( + self, + **kwargs + ) -> AsyncItemPaged["models.PremierAddOnOfferCollection"]: + """List all premier add-on offers. + + Description for List all premier add-on offers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_premier_add_on_offers') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_premier_add_on_offers(**kwargs) + + def list_site_identifiers_assigned_to_host_name( + self, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> AsyncItemPaged["models.IdentifierCollection"]: + """List all apps that are assigned to a hostname. + + Description for List all apps that are assigned to a hostname. + + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_site_identifiers_assigned_to_host_name') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_site_identifiers_assigned_to_host_name(name_identifier, **kwargs) + + async def list_skus( + self, + **kwargs + ) -> "models.SkuInfos": + """List all SKUs. + + Description for List all SKUs. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_skus') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.list_skus(**kwargs) + + def list_source_controls( + self, + **kwargs + ) -> AsyncItemPaged["models.SourceControlCollection"]: + """Gets the source controls available for Azure websites. + + Description for Gets the source controls available for Azure websites. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_source_controls') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_source_controls(**kwargs) + + async def move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Move resources between resource groups. + + Description for Move resources between resource groups. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 + """ + api_version = self._get_api_version('move') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.move(resource_group_name, move_resource_envelope, **kwargs) + + async def update_publishing_user( + self, + user_details: "models.User", + **kwargs + ) -> "models.User": + """Updates publishing user. + + Description for Updates publishing user. + + :param user_details: Details of publishing user. + :type user_details: ~azure.mgmt.web.v2019_08_01.models.User + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_publishing_user') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_publishing_user(user_details, **kwargs) + + async def update_source_control( + self, + source_control_type: str, + request_message: "models.SourceControl", + **kwargs + ) -> "models.SourceControl": + """Updates source control token. + + Description for Updates source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_source_control') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_source_control(source_control_type, request_message, **kwargs) + + async def validate( + self, + resource_group_name: str, + validate_request: "models.ValidateRequest", + **kwargs + ) -> "models.ValidateResponse": + """Validate if a resource can be created. + + Description for Validate if a resource can be created. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param validate_request: Request with the resources to validate. + :type validate_request: ~azure.mgmt.web.v2019_08_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('validate') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.validate(resource_group_name, validate_request, **kwargs) + + async def validate_container_settings( + self, + resource_group_name: str, + validate_container_settings_request: "models.ValidateContainerSettingsRequest", + **kwargs + ) -> object: + """Validate if the container settings are correct. + + Validate if the container settings are correct. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param validate_container_settings_request: + :type validate_container_settings_request: ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('validate_container_settings') + if api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.validate_container_settings(resource_group_name, validate_container_settings_request, **kwargs) + + async def validate_move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Validate whether a resource can be moved. + + Description for Validate whether a resource can be moved. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 + """ + api_version = self._get_api_version('validate_move') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.validate_move(resource_group_name, move_resource_envelope, **kwargs) + + async def verify_hosting_environment_vnet( + self, + parameters: "models.VnetParameters", + **kwargs + ) -> "models.VnetValidationFailureDetails": + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + + Description for Verifies if this VNET is compatible with an App Service Environment by + analyzing the Network Security Group rules. + + :param parameters: VNET information. + :type parameters: ~azure.mgmt.web.v2019_08_01.models.VnetParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('verify_hosting_environment_vnet') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.verify_hosting_environment_vnet(parameters, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..d30508ea9041 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py @@ -0,0 +1,422 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration_async import WebSiteManagementClientConfiguration +from ._operations_mixin_async import WebSiteManagementClientOperationsMixin +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, MultiApiClientMixin, _SDKClient): + """WebSite Management Client. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str api_version: API version to use if no profile is provided, or if + missing in profile. + :param str base_url: Service URL + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + DEFAULT_API_VERSION = '2019-08-01' + _PROFILE_TAG = "azure.mgmt.web.WebSiteManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + 'billing_meters': '2016-03-01', + 'validate_container_settings': '2018-02-01', + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential, # type: "AsyncTokenCredential" + subscription_id, # type: str + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(WebSiteManagementClient, self).__init__( + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-04-01: :mod:`v2015_04_01.models` + * 2015-08-01: :mod:`v2015_08_01.models` + * 2016-03-01: :mod:`v2016_03_01.models` + * 2016-08-01: :mod:`v2016_08_01.models` + * 2016-09-01: :mod:`v2016_09_01.models` + * 2018-02-01: :mod:`v2018_02_01.models` + * 2018-11-01: :mod:`v2018_11_01.models` + * 2019-08-01: :mod:`v2019_08_01.models` + """ + if api_version == '2015-04-01': + from ..v2015_04_01 import models + return models + elif api_version == '2015-08-01': + from ..v2015_08_01 import models + return models + elif api_version == '2016-03-01': + from ..v2016_03_01 import models + return models + elif api_version == '2016-08-01': + from ..v2016_08_01 import models + return models + elif api_version == '2016-09-01': + from ..v2016_09_01 import models + return models + elif api_version == '2018-02-01': + from ..v2018_02_01 import models + return models + elif api_version == '2018-11-01': + from ..v2018_11_01 import models + return models + elif api_version == '2019-08-01': + from ..v2019_08_01 import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def app_service_certificate_orders(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`AppServiceCertificateOrdersOperations` + * 2018-02-01: :class:`AppServiceCertificateOrdersOperations` + * 2019-08-01: :class:`AppServiceCertificateOrdersOperations` + """ + api_version = self._get_api_version('app_service_certificate_orders') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations_async import AppServiceCertificateOrdersOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import AppServiceCertificateOrdersOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import AppServiceCertificateOrdersOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def app_service_environments(self): + """Instance depends on the API version: + + * 2016-09-01: :class:`AppServiceEnvironmentsOperations` + * 2018-02-01: :class:`AppServiceEnvironmentsOperations` + * 2019-08-01: :class:`AppServiceEnvironmentsOperations` + """ + api_version = self._get_api_version('app_service_environments') + if api_version == '2016-09-01': + from ..v2016_09_01.aio.operations_async import AppServiceEnvironmentsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import AppServiceEnvironmentsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import AppServiceEnvironmentsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def app_service_plans(self): + """Instance depends on the API version: + + * 2016-09-01: :class:`AppServicePlansOperations` + * 2018-02-01: :class:`AppServicePlansOperations` + * 2019-08-01: :class:`AppServicePlansOperations` + """ + api_version = self._get_api_version('app_service_plans') + if api_version == '2016-09-01': + from ..v2016_09_01.aio.operations_async import AppServicePlansOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import AppServicePlansOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import AppServicePlansOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def billing_meters(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`BillingMetersOperations` + """ + api_version = self._get_api_version('billing_meters') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import BillingMetersOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def certificate_registration_provider(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`CertificateRegistrationProviderOperations` + * 2018-02-01: :class:`CertificateRegistrationProviderOperations` + * 2019-08-01: :class:`CertificateRegistrationProviderOperations` + """ + api_version = self._get_api_version('certificate_registration_provider') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations_async import CertificateRegistrationProviderOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import CertificateRegistrationProviderOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import CertificateRegistrationProviderOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def certificates(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`CertificatesOperations` + * 2018-02-01: :class:`CertificatesOperations` + * 2018-11-01: :class:`CertificatesOperations` + * 2019-08-01: :class:`CertificatesOperations` + """ + api_version = self._get_api_version('certificates') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import CertificatesOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import CertificatesOperations as OperationClass + elif api_version == '2018-11-01': + from ..v2018_11_01.aio.operations_async import CertificatesOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import CertificatesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def deleted_web_apps(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`DeletedWebAppsOperations` + * 2018-02-01: :class:`DeletedWebAppsOperations` + * 2019-08-01: :class:`DeletedWebAppsOperations` + """ + api_version = self._get_api_version('deleted_web_apps') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import DeletedWebAppsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import DeletedWebAppsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import DeletedWebAppsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def diagnostics(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`DiagnosticsOperations` + * 2018-02-01: :class:`DiagnosticsOperations` + * 2019-08-01: :class:`DiagnosticsOperations` + """ + api_version = self._get_api_version('diagnostics') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import DiagnosticsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import DiagnosticsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import DiagnosticsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def domain_registration_provider(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`DomainRegistrationProviderOperations` + * 2018-02-01: :class:`DomainRegistrationProviderOperations` + * 2019-08-01: :class:`DomainRegistrationProviderOperations` + """ + api_version = self._get_api_version('domain_registration_provider') + if api_version == '2015-04-01': + from ..v2015_04_01.aio.operations_async import DomainRegistrationProviderOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import DomainRegistrationProviderOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import DomainRegistrationProviderOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def domains(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`DomainsOperations` + * 2018-02-01: :class:`DomainsOperations` + * 2019-08-01: :class:`DomainsOperations` + """ + api_version = self._get_api_version('domains') + if api_version == '2015-04-01': + from ..v2015_04_01.aio.operations_async import DomainsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import DomainsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import DomainsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def provider(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`ProviderOperations` + * 2018-02-01: :class:`ProviderOperations` + * 2019-08-01: :class:`ProviderOperations` + """ + api_version = self._get_api_version('provider') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import ProviderOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import ProviderOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import ProviderOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def recommendations(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`RecommendationsOperations` + * 2018-02-01: :class:`RecommendationsOperations` + * 2019-08-01: :class:`RecommendationsOperations` + """ + api_version = self._get_api_version('recommendations') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import RecommendationsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import RecommendationsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import RecommendationsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def resource_health_metadata(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`ResourceHealthMetadataOperations` + * 2018-02-01: :class:`ResourceHealthMetadataOperations` + * 2019-08-01: :class:`ResourceHealthMetadataOperations` + """ + api_version = self._get_api_version('resource_health_metadata') + if api_version == '2016-03-01': + from ..v2016_03_01.aio.operations_async import ResourceHealthMetadataOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import ResourceHealthMetadataOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import ResourceHealthMetadataOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def static_sites(self): + """Instance depends on the API version: + + * 2019-08-01: :class:`StaticSitesOperations` + """ + api_version = self._get_api_version('static_sites') + if api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import StaticSitesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def top_level_domains(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`TopLevelDomainsOperations` + * 2018-02-01: :class:`TopLevelDomainsOperations` + * 2019-08-01: :class:`TopLevelDomainsOperations` + """ + api_version = self._get_api_version('top_level_domains') + if api_version == '2015-04-01': + from ..v2015_04_01.aio.operations_async import TopLevelDomainsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import TopLevelDomainsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import TopLevelDomainsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def web_apps(self): + """Instance depends on the API version: + + * 2016-08-01: :class:`WebAppsOperations` + * 2018-02-01: :class:`WebAppsOperations` + * 2019-08-01: :class:`WebAppsOperations` + """ + api_version = self._get_api_version('web_apps') + if api_version == '2016-08-01': + from ..v2016_08_01.aio.operations_async import WebAppsOperations as OperationClass + elif api_version == '2018-02-01': + from ..v2018_02_01.aio.operations_async import WebAppsOperations as OperationClass + elif api_version == '2019-08-01': + from ..v2019_08_01.aio.operations_async import WebAppsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): + await self._client.__aenter__() + return self + async def __aexit__(self, *exc_details): + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py index b96e0933169e..c6bbb427afa6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2015-04-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json new file mode 100644 index 000000000000..5c1ff30004ed --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json @@ -0,0 +1,60 @@ +{ + "chosen_version": "2015-04-01", + "total_api_version_list": ["2015-04-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "domains": "DomainsOperations", + "top_level_domains": "TopLevelDomainsOperations", + "domain_registration_provider": "DomainRegistrationProviderOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py index 2095c1d25e5f..3263c3a15c69 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py @@ -1,16 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration from .operations import DomainsOperations @@ -19,42 +24,56 @@ from . import models -class WebSiteManagementClient(SDKClient): - """WebSite Management Client +class WebSiteManagementClient(object): + """WebSite Management Client. - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration - - :ivar domains: Domains operations + :ivar domains: DomainsOperations operations :vartype domains: azure.mgmt.web.v2015_04_01.operations.DomainsOperations - :ivar top_level_domains: TopLevelDomains operations + :ivar top_level_domains: TopLevelDomainsOperations operations :vartype top_level_domains: azure.mgmt.web.v2015_04_01.operations.TopLevelDomainsOperations - :ivar domain_registration_provider: DomainRegistrationProvider operations + :ivar domain_registration_provider: DomainRegistrationProviderOperations operations :vartype domain_registration_provider: azure.mgmt.web.v2015_04_01.operations.DomainRegistrationProviderOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2015-04-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.domains = DomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.top_level_domains = TopLevelDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.domain_registration_provider = DomainRegistrationProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py new file mode 100644 index 000000000000..43dfb09376f5 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-04-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..749e590c018b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.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, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import DomainsOperations +from .operations_async import TopLevelDomainsOperations +from .operations_async import DomainRegistrationProviderOperations +from .. import models + + +class WebSiteManagementClient(object): + """WebSite Management Client. + + :ivar domains: DomainsOperations operations + :vartype domains: azure.mgmt.web.v2015_04_01.aio.operations_async.DomainsOperations + :ivar top_level_domains: TopLevelDomainsOperations operations + :vartype top_level_domains: azure.mgmt.web.v2015_04_01.aio.operations_async.TopLevelDomainsOperations + :ivar domain_registration_provider: DomainRegistrationProviderOperations operations + :vartype domain_registration_provider: azure.mgmt.web.v2015_04_01.aio.operations_async.DomainRegistrationProviderOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.domains = DomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.top_level_domains = TopLevelDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.domain_registration_provider = DomainRegistrationProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..50bf5a700aa7 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._domains_operations_async import DomainsOperations +from ._top_level_domains_operations_async import TopLevelDomainsOperations +from ._domain_registration_provider_operations_async import DomainRegistrationProviderOperations + +__all__ = [ + 'DomainsOperations', + 'TopLevelDomainsOperations', + 'DomainRegistrationProviderOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py new file mode 100644 index 000000000000..4e73d2f88444 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainRegistrationProviderOperations: + """DomainRegistrationProviderOperations 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.web.v2015_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 + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py new file mode 100644 index 000000000000..926da2d9e699 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py @@ -0,0 +1,1058 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainsOperations: + """DomainsOperations 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.web.v2015_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 + + async def check_availability( + self, + identifier: "models.NameIdentifier", + **kwargs + ) -> "models.DomainAvailablilityCheckResult": + """Check if a domain is available for registration. + + Check if a domain is available for registration. + + :param identifier: Name of the domain. + :type identifier: ~azure.mgmt.web.v2015_04_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainAvailablilityCheckResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainAvailablilityCheckResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_availability.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(identifier, 'NameIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainAvailablilityCheckResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DomainCollection"]: + """Get all domains in a subscription. + + Get all domains 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 DomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('DomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.DomainRegistration/domains'} # type: ignore + + async def get_control_center_sso_request( + self, + **kwargs + ) -> "models.DomainControlCenterSsoRequest": + """Generate a single sign-on request for the domain management portal. + + Generate a single sign-on request for the domain management portal. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainControlCenterSsoRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainControlCenterSsoRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.get_control_center_sso_request.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainControlCenterSsoRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} # type: ignore + + def list_recommendations( + self, + parameters: "models.DomainRecommendationSearchParameters", + **kwargs + ) -> AsyncIterable["models.NameIdentifierCollection"]: + """Get domain name recommendations based on keywords. + + Get domain name recommendations based on keywords. + + :param parameters: Search parameters for domain name recommendations. + :type parameters: ~azure.mgmt.web.v2015_04_01.models.DomainRecommendationSearchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NameIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.NameIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommendations.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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NameIdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.DomainCollection"]: + """Get all domains in a resource group. + + Get all domains in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 DomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('DomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} # type: ignore + + async def get( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> "models.Domain": + """Get a domain. + + Get a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + domain: "models.Domain", + **kwargs + ) -> "models.Domain": + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain, 'Domain') + 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]: + 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('Domain', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + domain: "models.Domain", + **kwargs + ) -> AsyncLROPoller["models.Domain"]: + """Creates or updates a domain. + + Creates or updates a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain: Domain registration information. + :type domain: ~azure.mgmt.web.v2015_04_01.models.Domain + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2015_04_01.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.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, + domain_name=domain_name, + domain=domain, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.DomainRegistration/domains/{domainName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + domain_name: str, + force_hard_delete_domain: Optional[bool] = None, + **kwargs + ) -> None: + """Delete a domain. + + Delete a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param force_hard_delete_domain: Specify :code:`true` to delete the domain + immediately. The default is :code:`false` which deletes the domain after 24 hours. + :type force_hard_delete_domain: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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] + if force_hard_delete_domain is not None: + query_parameters['forceHardDeleteDomain'] = self._serialize.query("force_hard_delete_domain", force_hard_delete_domain, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + domain_name: str, + domain: "models.DomainPatchResource", + **kwargs + ) -> "models.Domain": + """Creates or updates a domain. + + Creates or updates a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain: Domain registration information. + :type domain: ~azure.mgmt.web.v2015_04_01.models.DomainPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain, 'DomainPatchResource') + 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]: + 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('Domain', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + def list_ownership_identifiers( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> AsyncIterable["models.DomainOwnershipIdentifierCollection"]: + """Lists domain ownership identifiers. + + Lists domain ownership identifiers. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainOwnershipIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_ownership_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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: + 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('DomainOwnershipIdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} # type: ignore + + async def get_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Get ownership identifier for domain. + + Get ownership identifier for domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.get_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def create_or_update_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + domain_ownership_identifier: "models.DomainOwnershipIdentifier", + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def delete_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + **kwargs + ) -> None: + """Delete ownership identifier for domain. + + Delete ownership identifier for domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.delete_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def update_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + domain_ownership_identifier: "models.DomainOwnershipIdentifier", + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def renew( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> None: + """Renew a domain. + + Renew a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.renew.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py new file mode 100644 index 000000000000..b19e900abd6c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py @@ -0,0 +1,242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopLevelDomainsOperations: + """TopLevelDomainsOperations 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.web.v2015_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.TopLevelDomainCollection"]: + """Get all top-level domains supported for registration. + + Get all top-level domains supported for registration. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopLevelDomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.TopLevelDomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('TopLevelDomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.DomainRegistration/topLevelDomains'} # type: ignore + + async def get( + self, + name: str, + **kwargs + ) -> "models.TopLevelDomain": + """Get details of a top-level domain. + + Get details of a top-level domain. + + :param name: Name of the top-level domain. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopLevelDomain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.TopLevelDomain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopLevelDomain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} # type: ignore + + def list_agreements( + self, + name: str, + agreement_option: "models.TopLevelDomainAgreementOption", + **kwargs + ) -> AsyncIterable["models.TldLegalAgreementCollection"]: + """Gets all legal agreements that user needs to accept before purchasing a domain. + + Gets all legal agreements that user needs to accept before purchasing a domain. + + :param name: Name of the top-level domain. + :type name: str + :param agreement_option: Domain agreement options. + :type agreement_option: ~azure.mgmt.web.v2015_04_01.models.TopLevelDomainAgreementOption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TldLegalAgreementCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_04_01.models.TldLegalAgreementCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_agreements.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TldLegalAgreementCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/__init__.py index fe5a475ae205..1a66b222506a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/__init__.py @@ -1,271 +1,124 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import Address - from ._models_py3 import ApiDefinitionInfo - from ._models_py3 import AppServicePlan - from ._models_py3 import AutoHealActions - from ._models_py3 import AutoHealCustomAction - from ._models_py3 import AutoHealRules - from ._models_py3 import AutoHealTriggers - from ._models_py3 import Capability - from ._models_py3 import CloningInfo - from ._models_py3 import ConnStringInfo from ._models_py3 import Contact - from ._models_py3 import CorsSettings + from ._models_py3 import CsmOperationCollection from ._models_py3 import CsmOperationDescription from ._models_py3 import CsmOperationDescriptionProperties from ._models_py3 import CsmOperationDisplay from ._models_py3 import Dimension from ._models_py3 import Domain from ._models_py3 import DomainAvailablilityCheckResult + from ._models_py3 import DomainCollection from ._models_py3 import DomainControlCenterSsoRequest from ._models_py3 import DomainOwnershipIdentifier + from ._models_py3 import DomainOwnershipIdentifierCollection from ._models_py3 import DomainPatchResource from ._models_py3 import DomainPurchaseConsent from ._models_py3 import DomainRecommendationSearchParameters - from ._models_py3 import ErrorResponse, ErrorResponseException - from ._models_py3 import Experiments - from ._models_py3 import HandlerMapping - from ._models_py3 import HostingEnvironmentProfile + from ._models_py3 import ErrorResponse from ._models_py3 import HostName - from ._models_py3 import HostNameSslState - from ._models_py3 import HybridConnection - from ._models_py3 import HybridConnectionKey - from ._models_py3 import Identifier - from ._models_py3 import IpSecurityRestriction - from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MetricAvailability from ._models_py3 import MetricSpecification from ._models_py3 import NameIdentifier - from ._models_py3 import NameValuePair + from ._models_py3 import NameIdentifierCollection from ._models_py3 import ProxyOnlyResource - from ._models_py3 import PushSettings - from ._models_py3 import RampUpRule - from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource - from ._models_py3 import ResourceMetricAvailability - from ._models_py3 import ResourceMetricDefinition - from ._models_py3 import ResourceMetricName from ._models_py3 import ServiceSpecification - from ._models_py3 import Site - from ._models_py3 import SiteConfig - from ._models_py3 import SiteLimits - from ._models_py3 import SiteMachineKey - from ._models_py3 import SkuCapacity - from ._models_py3 import SkuDescription - from ._models_py3 import SlotSwapStatus - from ._models_py3 import SlowRequestsBasedTrigger - from ._models_py3 import SnapshotRecoveryRequest - from ._models_py3 import SnapshotRecoveryTarget - from ._models_py3 import StatusCodesBasedTrigger from ._models_py3 import TldLegalAgreement + from ._models_py3 import TldLegalAgreementCollection from ._models_py3 import TopLevelDomain from ._models_py3 import TopLevelDomainAgreementOption - from ._models_py3 import User - from ._models_py3 import VirtualApplication - from ._models_py3 import VirtualDirectory - from ._models_py3 import VnetGateway - from ._models_py3 import VnetInfo - from ._models_py3 import VnetRoute + from ._models_py3 import TopLevelDomainCollection except (SyntaxError, ImportError): - from ._models import Address - from ._models import ApiDefinitionInfo - from ._models import AppServicePlan - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import Capability - from ._models import CloningInfo - from ._models import ConnStringInfo - from ._models import Contact - from ._models import CorsSettings - from ._models import CsmOperationDescription - from ._models import CsmOperationDescriptionProperties - from ._models import CsmOperationDisplay - from ._models import Dimension - from ._models import Domain - from ._models import DomainAvailablilityCheckResult - from ._models import DomainControlCenterSsoRequest - from ._models import DomainOwnershipIdentifier - from ._models import DomainPatchResource - from ._models import DomainPurchaseConsent - from ._models import DomainRecommendationSearchParameters - from ._models import ErrorResponse, ErrorResponseException - from ._models import Experiments - from ._models import HandlerMapping - from ._models import HostingEnvironmentProfile - from ._models import HostName - from ._models import HostNameSslState - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import Identifier - from ._models import IpSecurityRestriction - from ._models import ManagedServiceIdentity - from ._models import MetricAvailability - from ._models import MetricSpecification - from ._models import NameIdentifier - from ._models import NameValuePair - from ._models import ProxyOnlyResource - from ._models import PushSettings - from ._models import RampUpRule - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import ResourceMetricName - from ._models import ServiceSpecification - from ._models import Site - from ._models import SiteConfig - from ._models import SiteLimits - from ._models import SiteMachineKey - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import SnapshotRecoveryRequest - from ._models import SnapshotRecoveryTarget - from ._models import StatusCodesBasedTrigger - from ._models import TldLegalAgreement - from ._models import TopLevelDomain - from ._models import TopLevelDomainAgreementOption - from ._models import User - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetRoute -from ._paged_models import CsmOperationDescriptionPaged -from ._paged_models import DomainOwnershipIdentifierPaged -from ._paged_models import DomainPaged -from ._paged_models import NameIdentifierPaged -from ._paged_models import TldLegalAgreementPaged -from ._paged_models import TopLevelDomainPaged + from ._models import Address # type: ignore + from ._models import Contact # type: ignore + from ._models import CsmOperationCollection # type: ignore + from ._models import CsmOperationDescription # type: ignore + from ._models import CsmOperationDescriptionProperties # type: ignore + from ._models import CsmOperationDisplay # type: ignore + from ._models import Dimension # type: ignore + from ._models import Domain # type: ignore + from ._models import DomainAvailablilityCheckResult # type: ignore + from ._models import DomainCollection # type: ignore + from ._models import DomainControlCenterSsoRequest # type: ignore + from ._models import DomainOwnershipIdentifier # type: ignore + from ._models import DomainOwnershipIdentifierCollection # type: ignore + from ._models import DomainPatchResource # type: ignore + from ._models import DomainPurchaseConsent # type: ignore + from ._models import DomainRecommendationSearchParameters # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import HostName # type: ignore + from ._models import MetricAvailability # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NameIdentifier # type: ignore + from ._models import NameIdentifierCollection # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import TldLegalAgreement # type: ignore + from ._models import TldLegalAgreementCollection # type: ignore + from ._models import TopLevelDomain # type: ignore + from ._models import TopLevelDomainAgreementOption # type: ignore + from ._models import TopLevelDomainCollection # type: ignore + from ._web_site_management_client_enums import ( - DomainStatus, - ProvisioningState, AzureResourceType, CustomHostNameDnsRecordType, - HostNameType, DnsType, + DomainPatchResourcePropertiesDomainNotRenewableReasonsItem, + DomainPropertiesDomainNotRenewableReasonsItem, + DomainStatus, DomainType, - RouteType, - ManagedServiceIdentityType, - AutoHealActionType, - ConnectionStringType, - ScmType, - ManagedPipelineMode, - SiteLoadBalancing, - SupportedTlsVersions, - SslState, - HostType, - UsageState, - SiteAvailabilityState, - StatusOptions, + HostNameType, + ProvisioningState, ) __all__ = [ 'Address', - 'ApiDefinitionInfo', - 'AppServicePlan', - 'AutoHealActions', - 'AutoHealCustomAction', - 'AutoHealRules', - 'AutoHealTriggers', - 'Capability', - 'CloningInfo', - 'ConnStringInfo', 'Contact', - 'CorsSettings', + 'CsmOperationCollection', 'CsmOperationDescription', 'CsmOperationDescriptionProperties', 'CsmOperationDisplay', 'Dimension', 'Domain', 'DomainAvailablilityCheckResult', + 'DomainCollection', 'DomainControlCenterSsoRequest', 'DomainOwnershipIdentifier', + 'DomainOwnershipIdentifierCollection', 'DomainPatchResource', 'DomainPurchaseConsent', 'DomainRecommendationSearchParameters', - 'ErrorResponse', 'ErrorResponseException', - 'Experiments', - 'HandlerMapping', - 'HostingEnvironmentProfile', + 'ErrorResponse', 'HostName', - 'HostNameSslState', - 'HybridConnection', - 'HybridConnectionKey', - 'Identifier', - 'IpSecurityRestriction', - 'ManagedServiceIdentity', 'MetricAvailability', 'MetricSpecification', 'NameIdentifier', - 'NameValuePair', + 'NameIdentifierCollection', 'ProxyOnlyResource', - 'PushSettings', - 'RampUpRule', - 'RequestsBasedTrigger', 'Resource', - 'ResourceMetricAvailability', - 'ResourceMetricDefinition', - 'ResourceMetricName', 'ServiceSpecification', - 'Site', - 'SiteConfig', - 'SiteLimits', - 'SiteMachineKey', - 'SkuCapacity', - 'SkuDescription', - 'SlotSwapStatus', - 'SlowRequestsBasedTrigger', - 'SnapshotRecoveryRequest', - 'SnapshotRecoveryTarget', - 'StatusCodesBasedTrigger', 'TldLegalAgreement', + 'TldLegalAgreementCollection', 'TopLevelDomain', 'TopLevelDomainAgreementOption', - 'User', - 'VirtualApplication', - 'VirtualDirectory', - 'VnetGateway', - 'VnetInfo', - 'VnetRoute', - 'DomainPaged', - 'NameIdentifierPaged', - 'DomainOwnershipIdentifierPaged', - 'TopLevelDomainPaged', - 'TldLegalAgreementPaged', - 'CsmOperationDescriptionPaged', - 'DomainStatus', - 'ProvisioningState', + 'TopLevelDomainCollection', 'AzureResourceType', 'CustomHostNameDnsRecordType', - 'HostNameType', 'DnsType', + 'DomainPatchResourcePropertiesDomainNotRenewableReasonsItem', + 'DomainPropertiesDomainNotRenewableReasonsItem', + 'DomainStatus', 'DomainType', - 'RouteType', - 'ManagedServiceIdentityType', - 'AutoHealActionType', - 'ConnectionStringType', - 'ScmType', - 'ManagedPipelineMode', - 'SiteLoadBalancing', - 'SupportedTlsVersions', - 'SslState', - 'HostType', - 'UsageState', - 'SiteAvailabilityState', - 'StatusOptions', + 'HostNameType', + 'ProvisioningState', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models.py index ef083134b528..b1289c9e9897 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models.py @@ -1,19 +1,16 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Address(Model): +class Address(msrest.serialization.Model): """Address information for domain registration. All required parameters must be populated in order to send to Azure. @@ -49,460 +46,22 @@ class Address(Model): 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Address, self).__init__(**kwargs) - self.address1 = kwargs.get('address1', None) + self.address1 = kwargs['address1'] self.address2 = kwargs.get('address2', None) - self.city = kwargs.get('city', None) - self.country = kwargs.get('country', None) - self.postal_code = kwargs.get('postal_code', None) - self.state = kwargs.get('state', None) + self.city = kwargs['city'] + self.country = kwargs['country'] + self.postal_code = kwargs['postal_code'] + self.state = kwargs['state'] -class ApiDefinitionInfo(Model): - """Information about the formal API definition for the app. - - :param url: The URL of the API definition. - :type url: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ApiDefinitionInfo, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - - -class Resource(Model): - """Azure resource. This resource is tracked in Azure Resource Manager. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) - self.type = None - self.tags = kwargs.get('tags', None) - - -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2015_04_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param admin_site_name: App Service plan administration site. - :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_04_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_04_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2015_04_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, **kwargs): - super(AppServicePlan, self).__init__(**kwargs) - self.app_service_plan_name = kwargs.get('app_service_plan_name', None) - self.worker_tier_name = kwargs.get('worker_tier_name', None) - self.status = None - self.subscription = None - self.admin_site_name = kwargs.get('admin_site_name', None) - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = kwargs.get('per_site_scaling', False) - self.number_of_sites = None - self.is_spot = kwargs.get('is_spot', None) - self.spot_expiration_time = kwargs.get('spot_expiration_time', None) - self.resource_group = None - self.reserved = kwargs.get('reserved', False) - self.target_worker_count = kwargs.get('target_worker_count', None) - self.target_worker_size_id = kwargs.get('target_worker_size_id', None) - self.provisioning_state = None - self.sku = kwargs.get('sku', None) - - -class AutoHealActions(Model): - """Actions which to take by the auto-heal module when a rule is triggered. - - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2015_04_01.models.AutoHealActionType - :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2015_04_01.models.AutoHealCustomAction - :param min_process_execution_time: Minimum time the process must execute - before taking the action - :type min_process_execution_time: str - """ - - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, - 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, - 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AutoHealActions, self).__init__(**kwargs) - self.action_type = kwargs.get('action_type', None) - self.custom_action = kwargs.get('custom_action', None) - self.min_process_execution_time = kwargs.get('min_process_execution_time', None) - - -class AutoHealCustomAction(Model): - """Custom action to be executed - when an auto heal rule is triggered. - - :param exe: Executable to be run. - :type exe: str - :param parameters: Parameters for the executable. - :type parameters: str - """ - - _attribute_map = { - 'exe': {'key': 'exe', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AutoHealCustomAction, self).__init__(**kwargs) - self.exe = kwargs.get('exe', None) - self.parameters = kwargs.get('parameters', None) - - -class AutoHealRules(Model): - """Rules that can be defined for auto-heal. - - :param triggers: Conditions that describe when to execute the auto-heal - actions. - :type triggers: ~azure.mgmt.web.v2015_04_01.models.AutoHealTriggers - :param actions: Actions to be executed when a rule is triggered. - :type actions: ~azure.mgmt.web.v2015_04_01.models.AutoHealActions - """ - - _attribute_map = { - 'triggers': {'key': 'triggers', 'type': 'AutoHealTriggers'}, - 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, - } - - def __init__(self, **kwargs): - super(AutoHealRules, self).__init__(**kwargs) - self.triggers = kwargs.get('triggers', None) - self.actions = kwargs.get('actions', None) - - -class AutoHealTriggers(Model): - """Triggers for auto-heal. - - :param requests: A rule based on total requests. - :type requests: ~azure.mgmt.web.v2015_04_01.models.RequestsBasedTrigger - :param private_bytes_in_kb: A rule based on private bytes. - :type private_bytes_in_kb: int - :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2015_04_01.models.StatusCodesBasedTrigger] - :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2015_04_01.models.SlowRequestsBasedTrigger - """ - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'RequestsBasedTrigger'}, - 'private_bytes_in_kb': {'key': 'privateBytesInKB', 'type': 'int'}, - 'status_codes': {'key': 'statusCodes', 'type': '[StatusCodesBasedTrigger]'}, - 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, - } - - def __init__(self, **kwargs): - super(AutoHealTriggers, self).__init__(**kwargs) - self.requests = kwargs.get('requests', None) - self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) - self.status_codes = kwargs.get('status_codes', None) - self.slow_requests = kwargs.get('slow_requests', None) - - -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Capability, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - self.reason = kwargs.get('reason', None) - - -class CloningInfo(Model): - """Information needed for cloning operation. - - All required parameters must be populated in order to send to Azure. - - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations - together to use the same snapshot. - :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. - :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. - :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. - :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type source_web_app_id: str - :param hosting_environment: App Service Environment. - :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. - :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. - :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. - :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. - :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. - :type ignore_quotas: bool - """ - - _validation = { - 'source_web_app_id': {'required': True}, - } - - _attribute_map = { - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'overwrite': {'key': 'overwrite', 'type': 'bool'}, - 'clone_custom_host_names': {'key': 'cloneCustomHostNames', 'type': 'bool'}, - 'clone_source_control': {'key': 'cloneSourceControl', 'type': 'bool'}, - 'source_web_app_id': {'key': 'sourceWebAppId', 'type': 'str'}, - 'hosting_environment': {'key': 'hostingEnvironment', 'type': 'str'}, - 'app_settings_overrides': {'key': 'appSettingsOverrides', 'type': '{str}'}, - 'configure_load_balancing': {'key': 'configureLoadBalancing', 'type': 'bool'}, - 'traffic_manager_profile_id': {'key': 'trafficManagerProfileId', 'type': 'str'}, - 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, - 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(CloningInfo, self).__init__(**kwargs) - self.correlation_id = kwargs.get('correlation_id', None) - self.overwrite = kwargs.get('overwrite', None) - self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) - self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) - self.hosting_environment = kwargs.get('hosting_environment', None) - self.app_settings_overrides = kwargs.get('app_settings_overrides', None) - self.configure_load_balancing = kwargs.get('configure_load_balancing', None) - self.traffic_manager_profile_id = kwargs.get('traffic_manager_profile_id', None) - self.traffic_manager_profile_name = kwargs.get('traffic_manager_profile_name', None) - self.ignore_quotas = kwargs.get('ignore_quotas', None) - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): - """Database connection string information. - - :param name: Name of connection string. - :type name: str - :param connection_string: Connection string value. - :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' - :type type: str or ~azure.mgmt.web.v2015_04_01.models.ConnectionStringType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, - } - - def __init__(self, **kwargs): - super(ConnStringInfo, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.connection_string = kwargs.get('connection_string', None) - self.type = kwargs.get('type', None) - - -class Contact(Model): - """Contact information for domain registration. If 'Domain Privacy' option is - not selected then the contact information is made publicly available - through the Whois - directories as per ICANN requirements. +class Contact(msrest.serialization.Model): + """Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information is made publicly available through the Whois +directories as per ICANN requirements. All required parameters must be populated in order to send to Azure. @@ -545,49 +104,65 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.address_mailing = kwargs.get('address_mailing', None) - self.email = kwargs.get('email', None) + self.email = kwargs['email'] self.fax = kwargs.get('fax', None) self.job_title = kwargs.get('job_title', None) - self.name_first = kwargs.get('name_first', None) - self.name_last = kwargs.get('name_last', None) + self.name_first = kwargs['name_first'] + self.name_last = kwargs['name_last'] self.name_middle = kwargs.get('name_middle', None) self.organization = kwargs.get('organization', None) - self.phone = kwargs.get('phone', None) + self.phone = kwargs['phone'] + +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. -class CorsSettings(Model): - """Cross-Origin Resource Sharing (CORS) settings for the app. + Variables are only populated by the server, and will be ignored when sending a request. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin - calls (for example: http://example.com:12345). Use "*" to allow all. - :type allowed_origins: list[str] + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(CorsSettings, self).__init__(**kwargs) - self.allowed_origins = kwargs.get('allowed_origins', None) + def __init__( + self, + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class CsmOperationDescription(Model): +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2015_04_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2015_04_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2015_04_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -597,7 +172,10 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -605,24 +183,27 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2015_04_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2015_04_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -642,7 +223,10 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -650,10 +234,9 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -672,7 +255,10 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -680,11 +266,60 @@ def __init__(self, **kwargs): self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) +class Resource(msrest.serialization.Model): + """Azure resource. This resource is tracked in Azure Resource Manager. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :param location: Required. Resource Location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = kwargs.get('kind', None) + self.location = kwargs['location'] + self.type = None + self.tags = kwargs.get('tags', None) + + class Domain(Resource): """Information about a domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -698,62 +333,58 @@ class Domain(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2015_04_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2015_04_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_04_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2015_04_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_04_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2015_04_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2015_04_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2015_04_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_04_01.models.DomainPropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType :param auth_code: :type auth_code: str @@ -764,10 +395,6 @@ class Domain(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -776,7 +403,6 @@ class Domain(Resource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -791,8 +417,8 @@ class Domain(Resource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -803,13 +429,16 @@ class Domain(Resource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Domain, self).__init__(**kwargs) self.contact_admin = kwargs.get('contact_admin', None) self.contact_billing = kwargs.get('contact_billing', None) @@ -833,46 +462,79 @@ def __init__(self, **kwargs): self.auth_code = kwargs.get('auth_code', None) -class DomainAvailablilityCheckResult(Model): +class DomainAvailablilityCheckResult(msrest.serialization.Model): """Domain availability check result. :param name: Name of the domain. :type name: str - :param available: true if domain can be purchased using - CreateDomain API; otherwise, false. + :param available: :code:`true` if domain can be purchased using CreateDomain API; + otherwise, :code:`false`. :type available: bool - :param domain_type: Valid values are Regular domain: Azure will charge the - full price of domain registration, SoftDeleted: Purchasing this domain - will simply restore it and this operation will not cost anything. Possible - values include: 'Regular', 'SoftDeleted' + :param domain_type: Valid values are Regular domain: Azure will charge the full price of domain + registration, SoftDeleted: Purchasing this domain will simply restore it and this operation + will not cost anything. Possible values include: "Regular", "SoftDeleted". :type domain_type: str or ~azure.mgmt.web.v2015_04_01.models.DomainType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'available': {'key': 'available', 'type': 'bool'}, - 'domain_type': {'key': 'domainType', 'type': 'DomainType'}, + 'domain_type': {'key': 'domainType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainAvailablilityCheckResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available = kwargs.get('available', None) self.domain_type = kwargs.get('domain_type', None) -class DomainControlCenterSsoRequest(Model): +class DomainCollection(msrest.serialization.Model): + """Collection of domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.Domain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DomainCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DomainControlCenterSsoRequest(msrest.serialization.Model): """Single sign-on request information for domain management. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar url: URL where the single sign-on request is to be made. :vartype url: str :ivar post_parameter_key: Post parameter key. :vartype post_parameter_key: str - :ivar post_parameter_value: Post parameter value. Client should use - 'application/x-www-form-urlencoded' encoding for this value. + :ivar post_parameter_value: Post parameter value. Client should use 'application/x-www-form- + urlencoded' encoding for this value. :vartype post_parameter_value: str """ @@ -888,19 +550,20 @@ class DomainControlCenterSsoRequest(Model): 'post_parameter_value': {'key': 'postParameterValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainControlCenterSsoRequest, self).__init__(**kwargs) self.url = None self.post_parameter_key = None self.post_parameter_value = None -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -925,7 +588,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -936,8 +602,7 @@ def __init__(self, **kwargs): class DomainOwnershipIdentifier(ProxyOnlyResource): """Domain ownership Identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -965,19 +630,51 @@ class DomainOwnershipIdentifier(ProxyOnlyResource): 'ownership_id': {'key': 'properties.ownershipId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainOwnershipIdentifier, self).__init__(**kwargs) self.ownership_id = kwargs.get('ownership_id', None) -class DomainPatchResource(ProxyOnlyResource): - """ARM resource for a domain. +class DomainOwnershipIdentifierCollection(msrest.serialization.Model): + """Collection of domain ownership identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DomainOwnershipIdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DomainPatchResource(ProxyOnlyResource): + """ARM resource for a domain. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -986,60 +683,56 @@ class DomainPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2015_04_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2015_04_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_04_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2015_04_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_04_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2015_04_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2015_04_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2015_04_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_04_01.models.DomainPatchResourcePropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType :param auth_code: :type auth_code: str @@ -1049,10 +742,6 @@ class DomainPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -1061,7 +750,6 @@ class DomainPatchResource(ProxyOnlyResource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -1074,8 +762,8 @@ class DomainPatchResource(ProxyOnlyResource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -1086,13 +774,16 @@ class DomainPatchResource(ProxyOnlyResource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainPatchResource, self).__init__(**kwargs) self.contact_admin = kwargs.get('contact_admin', None) self.contact_billing = kwargs.get('contact_billing', None) @@ -1116,18 +807,16 @@ def __init__(self, **kwargs): self.auth_code = kwargs.get('auth_code', None) -class DomainPurchaseConsent(Model): - """Domain purchase consent object, representing acceptance of applicable legal - agreements. +class DomainPurchaseConsent(msrest.serialization.Model): + """Domain purchase consent object, representing acceptance of applicable legal agreements. - :param agreement_keys: List of applicable legal agreement keys. This list - can be retrieved using ListLegalAgreements API under - TopLevelDomain resource. + :param agreement_keys: List of applicable legal agreement keys. This list can be retrieved + using ListLegalAgreements API under :code:`TopLevelDomain` resource. :type agreement_keys: list[str] :param agreed_by: Client IP address. :type agreed_by: str :param agreed_at: Timestamp when the agreements were accepted. - :type agreed_at: datetime + :type agreed_at: ~datetime.datetime """ _attribute_map = { @@ -1136,18 +825,20 @@ class DomainPurchaseConsent(Model): 'agreed_at': {'key': 'agreedAt', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainPurchaseConsent, self).__init__(**kwargs) self.agreement_keys = kwargs.get('agreement_keys', None) self.agreed_by = kwargs.get('agreed_by', None) self.agreed_at = kwargs.get('agreed_at', None) -class DomainRecommendationSearchParameters(Model): +class DomainRecommendationSearchParameters(msrest.serialization.Model): """Domain recommendation search parameters. - :param keywords: Keywords to be used for generating domain - recommendations. + :param keywords: Keywords to be used for generating domain recommendations. :type keywords: str :param max_domain_recommendations: Maximum number of recommendations. :type max_domain_recommendations: int @@ -1158,13 +849,16 @@ class DomainRecommendationSearchParameters(Model): 'max_domain_recommendations': {'key': 'maxDomainRecommendations', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainRecommendationSearchParameters, self).__init__(**kwargs) self.keywords = kwargs.get('keywords', None) self.max_domain_recommendations = kwargs.get('max_domain_recommendations', None) -class ErrorResponse(Model): +class ErrorResponse(msrest.serialization.Model): """Error Response. :param code: Error code. @@ -1178,400 +872,62 @@ class ErrorResponse(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. +class HostName(msrest.serialization.Model): + """Details of a hostname derived from a domain. - :param deserialize: A deserializer - :param response: Server response to be deserialized. + :param name: Name of the hostname. + :type name: str + :param site_names: List of apps the hostname is assigned to. This list will have more than one + app only if the hostname is pointing to a Traffic Manager. + :type site_names: list[str] + :param azure_resource_name: Name of the Azure resource the hostname is assigned to. If it is + assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the + app name. + :type azure_resource_name: str + :param azure_resource_type: Type of the Azure resource the hostname is assigned to. Possible + values include: "Website", "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2015_04_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Type of the DNS record. Possible values include: + "CName", "A". + :type custom_host_name_dns_record_type: str or + ~azure.mgmt.web.v2015_04_01.models.CustomHostNameDnsRecordType + :param host_name_type: Type of the hostname. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2015_04_01.models.HostNameType """ - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'site_names': {'key': 'siteNames', 'type': '[str]'}, + 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, + 'azure_resource_type': {'key': 'azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'hostNameType', 'type': 'str'}, + } + def __init__( + self, + **kwargs + ): + super(HostName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.site_names = kwargs.get('site_names', None) + self.azure_resource_name = kwargs.get('azure_resource_name', None) + self.azure_resource_type = kwargs.get('azure_resource_type', None) + self.custom_host_name_dns_record_type = kwargs.get('custom_host_name_dns_record_type', None) + self.host_name_type = kwargs.get('host_name_type', None) -class Experiments(Model): - """Routing rules in production experiments. - :param ramp_up_rules: List of ramp-up rules. - :type ramp_up_rules: list[~azure.mgmt.web.v2015_04_01.models.RampUpRule] - """ - - _attribute_map = { - 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, - } - - def __init__(self, **kwargs): - super(Experiments, self).__init__(**kwargs) - self.ramp_up_rules = kwargs.get('ramp_up_rules', None) - - -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. - - :param extension: Requests with this extension will be handled using the - specified FastCGI application. - :type extension: str - :param script_processor: The absolute path to the FastCGI application. - :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. - :type arguments: str - """ - - _attribute_map = { - 'extension': {'key': 'extension', 'type': 'str'}, - 'script_processor': {'key': 'scriptProcessor', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HandlerMapping, self).__init__(**kwargs) - self.extension = kwargs.get('extension', None) - self.script_processor = kwargs.get('script_processor', None) - self.arguments = kwargs.get('arguments', None) - - -class HostingEnvironmentProfile(Model): - """Specification for an App Service Environment to use for this resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param id: Resource ID of the App Service Environment. - :type id: str - :ivar name: Name of the App Service Environment. - :vartype name: str - :ivar type: Resource type of the App Service Environment. - :vartype type: str - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HostingEnvironmentProfile, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = None - self.type = None - - -class HostName(Model): - """Details of a hostname derived from a domain. - - :param name: Name of the hostname. - :type name: str - :param site_names: List of apps the hostname is assigned to. This list - will have more than one app only if the hostname is pointing to a Traffic - Manager. - :type site_names: list[str] - :param azure_resource_name: Name of the Azure resource the hostname is - assigned to. If it is assigned to a Traffic Manager then it will be the - Traffic Manager name otherwise it will be the app name. - :type azure_resource_name: str - :param azure_resource_type: Type of the Azure resource the hostname is - assigned to. Possible values include: 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2015_04_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Type of the DNS record. Possible - values include: 'CName', 'A' - :type custom_host_name_dns_record_type: str or - ~azure.mgmt.web.v2015_04_01.models.CustomHostNameDnsRecordType - :param host_name_type: Type of the hostname. Possible values include: - 'Verified', 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2015_04_01.models.HostNameType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'site_names': {'key': 'siteNames', 'type': '[str]'}, - 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'hostNameType', 'type': 'HostNameType'}, - } - - def __init__(self, **kwargs): - super(HostName, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.site_names = kwargs.get('site_names', None) - self.azure_resource_name = kwargs.get('azure_resource_name', None) - self.azure_resource_type = kwargs.get('azure_resource_type', None) - self.custom_host_name_dns_record_type = kwargs.get('custom_host_name_dns_record_type', None) - self.host_name_type = kwargs.get('host_name_type', None) - - -class HostNameSslState(Model): - """SSL-enabled hostname. - - :param name: Hostname. - :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' - :type ssl_state: str or ~azure.mgmt.web.v2015_04_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. - :type virtual_ip: str - :param thumbprint: SSL certificate thumbprint. - :type thumbprint: str - :param to_update: Set to true to update existing hostname. - :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' - :type host_type: str or ~azure.mgmt.web.v2015_04_01.models.HostType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, - 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, **kwargs): - super(HostNameSslState, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.ssl_state = kwargs.get('ssl_state', None) - self.virtual_ip = kwargs.get('virtual_ip', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.to_update = kwargs.get('to_update', None) - self.host_type = kwargs.get('host_type', None) - - -class HybridConnection(ProxyOnlyResource): - """Hybrid Connection contract. This is used to configure a Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param service_bus_namespace: The name of the Service Bus namespace. - :type service_bus_namespace: str - :param relay_name: The name of the Service Bus relay. - :type relay_name: str - :param relay_arm_uri: The ARM URI to the Service Bus relay. - :type relay_arm_uri: str - :param hostname: The hostname of the endpoint. - :type hostname: str - :param port: The port of the endpoint. - :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. - :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned - normally, use the POST /listKeys API instead. - :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net - :type service_bus_suffix: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'service_bus_namespace': {'key': 'properties.serviceBusNamespace', 'type': 'str'}, - 'relay_name': {'key': 'properties.relayName', 'type': 'str'}, - 'relay_arm_uri': {'key': 'properties.relayArmUri', 'type': 'str'}, - 'hostname': {'key': 'properties.hostname', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HybridConnection, self).__init__(**kwargs) - self.service_bus_namespace = kwargs.get('service_bus_namespace', None) - self.relay_name = kwargs.get('relay_name', None) - self.relay_arm_uri = kwargs.get('relay_arm_uri', None) - self.hostname = kwargs.get('hostname', None) - self.port = kwargs.get('port', None) - self.send_key_name = kwargs.get('send_key_name', None) - self.send_key_value = kwargs.get('send_key_value', None) - self.service_bus_suffix = kwargs.get('service_bus_suffix', None) - - -class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar send_key_name: The name of the send key. - :vartype send_key_name: str - :ivar send_key_value: The value of the send key. - :vartype send_key_value: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'send_key_name': {'readonly': True}, - 'send_key_value': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HybridConnectionKey, self).__init__(**kwargs) - self.send_key_name = None - self.send_key_value = None - - -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) - - -class IpSecurityRestriction(Model): - """IP security restriction on an app. - - All required parameters must be populated in order to send to Azure. - - :param ip_address: Required. IP address the security restriction is valid - for. - :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. - :type subnet_mask: str - """ - - _validation = { - 'ip_address': {'required': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = kwargs.get('ip_address', None) - self.subnet_mask = kwargs.get('subnet_mask', None) - - -class ManagedServiceIdentity(Model): - """Managed service identity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2015_04_01.models.ManagedServiceIdentityType - :ivar tenant_id: Tenant of managed service identity. - :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. - :vartype principal_id: str - """ - - _validation = { - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.tenant_id = None - self.principal_id = None - - -class MetricAvailability(Model): - """Retention policy of a resource metric. +class MetricAvailability(msrest.serialization.Model): + """Retention policy of a resource metric. :param time_grain: :type time_grain: str @@ -1584,13 +940,16 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.blob_duration = kwargs.get('blob_duration', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -1622,8 +981,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2015_04_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2015_04_01.models.MetricAvailability] """ _attribute_map = { @@ -1644,7 +1002,10 @@ class MetricSpecification(Model): 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1663,7 +1024,7 @@ def __init__(self, **kwargs): self.availabilities = kwargs.get('availabilities', None) -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -1674,205 +1035,140 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class NameValuePair(Model): - """Name value pair. - - :param name: Pair name. - :type name: str - :param value: Pair value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(NameValuePair, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class NameIdentifierCollection(msrest.serialization.Model): + """Collection of domain name identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. - :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. - :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. - Tags can consist of alphanumeric characters and the following: - '_', '@', '#', '.', ':', '-'. - Validation should be performed at the PushRequestHandler. - :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. - :type dynamic_tags_json: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.NameIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'is_push_enabled': {'key': 'properties.isPushEnabled', 'type': 'bool'}, - 'tag_whitelist_json': {'key': 'properties.tagWhitelistJson', 'type': 'str'}, - 'tags_requiring_auth': {'key': 'properties.tagsRequiringAuth', 'type': 'str'}, - 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[NameIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(PushSettings, self).__init__(**kwargs) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) - self.tags_requiring_auth = kwargs.get('tags_requiring_auth', None) - self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) - - -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. - - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. - :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. - :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. - :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. - :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. - :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. - :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ - :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. - :type name: str + def __init__( + self, + **kwargs + ): + super(NameIdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ServiceSpecification(msrest.serialization.Model): + """Resource metrics service provided by Microsoft.Insights resource provider. + + :param metric_specifications: + :type metric_specifications: list[~azure.mgmt.web.v2015_04_01.models.MetricSpecification] """ _attribute_map = { - 'action_host_name': {'key': 'actionHostName', 'type': 'str'}, - 'reroute_percentage': {'key': 'reroutePercentage', 'type': 'float'}, - 'change_step': {'key': 'changeStep', 'type': 'float'}, - 'change_interval_in_minutes': {'key': 'changeIntervalInMinutes', 'type': 'int'}, - 'min_reroute_percentage': {'key': 'minReroutePercentage', 'type': 'float'}, - 'max_reroute_percentage': {'key': 'maxReroutePercentage', 'type': 'float'}, - 'change_decision_callback_url': {'key': 'changeDecisionCallbackUrl', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): - super(RampUpRule, self).__init__(**kwargs) - self.action_host_name = kwargs.get('action_host_name', None) - self.reroute_percentage = kwargs.get('reroute_percentage', None) - self.change_step = kwargs.get('change_step', None) - self.change_interval_in_minutes = kwargs.get('change_interval_in_minutes', None) - self.min_reroute_percentage = kwargs.get('min_reroute_percentage', None) - self.max_reroute_percentage = kwargs.get('max_reroute_percentage', None) - self.change_decision_callback_url = kwargs.get('change_decision_callback_url', None) - self.name = kwargs.get('name', None) + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) -class RequestsBasedTrigger(Model): - """Trigger based on total requests. +class TldLegalAgreement(msrest.serialization.Model): + """Legal agreement for a top level domain. + + All required parameters must be populated in order to send to Azure. - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str + :param agreement_key: Required. Unique identifier for the agreement. + :type agreement_key: str + :param title: Required. Agreement title. + :type title: str + :param content: Required. Agreement details. + :type content: str + :param url: URL where a copy of the agreement details is hosted. + :type url: str """ + _validation = { + 'agreement_key': {'required': True}, + 'title': {'required': True}, + 'content': {'required': True}, + } + _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, + 'agreement_key': {'key': 'agreementKey', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): - super(RequestsBasedTrigger, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) + def __init__( + self, + **kwargs + ): + super(TldLegalAgreement, self).__init__(**kwargs) + self.agreement_key = kwargs['agreement_key'] + self.title = kwargs['title'] + self.content = kwargs['content'] + self.url = kwargs.get('url', None) + +class TldLegalAgreementCollection(msrest.serialization.Model): + """Collection of top-level domain legal agreements. -class ResourceMetricAvailability(Model): - """Metrics availability and retention. + Variables are only populated by the server, and will be ignored when sending a request. - 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 time_grain: Time grain . - :vartype time_grain: str - :ivar retention: Retention period for the current time grain. - :vartype retention: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.TldLegalAgreement] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[TldLegalAgreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(ResourceMetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None + def __init__( + self, + **kwargs + ): + super(TldLegalAgreementCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class ResourceMetricDefinition(ProxyOnlyResource): - """Metadata for the metrics. +class TopLevelDomain(ProxyOnlyResource): + """A top level domain object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1882,36 +1178,18 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2015_04_01.models.ResourceMetricName - :ivar unit: Unit of the metric. - :vartype unit: str - :ivar primary_aggregation_type: Primary aggregation type. - :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2015_04_01.models.ResourceMetricAvailability] - :ivar resource_uri: Resource URI. - :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str - :ivar properties: Resource metric definition properties. - :vartype properties: dict[str, str] + :ivar domain_name: Name of the top level domain. + :vartype domain_name: str + :param privacy: If :code:`true`, then the top level domain supports domain + privacy; otherwise, :code:`false`. + :type privacy: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, - 'unit': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'metric_availabilities': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, - 'properties': {'readonly': True}, + 'domain_name': {'readonly': True}, } _attribute_map = { @@ -1919,923 +1197,28 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, - 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, - 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, - 'properties': {'key': 'properties.properties', 'type': '{str}'}, + 'domain_name': {'key': 'properties.name', 'type': 'str'}, + 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, } - def __init__(self, **kwargs): - super(ResourceMetricDefinition, self).__init__(**kwargs) - self.resource_metric_definition_name = None - self.unit = None - self.primary_aggregation_type = None - self.metric_availabilities = None - self.resource_uri = None - self.resource_metric_definition_id = None - self.properties = None - + def __init__( + self, + **kwargs + ): + super(TopLevelDomain, self).__init__(**kwargs) + self.domain_name = None + self.privacy = kwargs.get('privacy', None) -class ResourceMetricName(Model): - """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. +class TopLevelDomainAgreementOption(msrest.serialization.Model): + """Options for retrieving the list of top level domain legal agreements. - :ivar value: metric name value. - :vartype value: str - :ivar localized_value: Localized metric name value. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ResourceMetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class ServiceSpecification(Model): - """Resource metrics service provided by Microsoft.Insights resource provider. - - :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2015_04_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__(self, **kwargs): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Site(Resource): - """A web app, a mobile app backend, or an API app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :ivar state: Current state of the app. - :vartype state: str - :ivar host_names: Hostnames associated with the app. - :vartype host_names: list[str] - :ivar repository_site_name: Name of the repository site. - :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' - :vartype usage_state: str or ~azure.mgmt.web.v2015_04_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). - :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, - the app is not served on those hostnames. - :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2015_04_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2015_04_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: - "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". - :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . - :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime - :param site_config: Configuration of the app. - :type site_config: ~azure.mgmt.web.v2015_04_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. - :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . - :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. - :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_04_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. - :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. - :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. - :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. - :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. - :vartype possible_outbound_ip_addresses: str - :param container_size: Size of the function container. - :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). - :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime - :ivar max_number_of_workers: Maximum number of workers. - This only applies to Functions container. - :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. - :type cloning_info: ~azure.mgmt.web.v2015_04_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2015_04_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. - :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. - :vartype is_default_container: bool - :ivar default_host_name: Default hostname of the app. Read-only. - :vartype default_host_name: str - :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2015_04_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests - :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2015_04_01.models.ManagedServiceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'host_names': {'readonly': True}, - 'repository_site_name': {'readonly': True}, - 'usage_state': {'readonly': True}, - 'enabled_host_names': {'readonly': True}, - 'availability_state': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'traffic_manager_host_names': {'readonly': True}, - 'target_swap_slot': {'readonly': True}, - 'outbound_ip_addresses': {'readonly': True}, - 'possible_outbound_ip_addresses': {'readonly': True}, - 'suspended_till': {'readonly': True}, - 'max_number_of_workers': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'is_default_container': {'readonly': True}, - 'default_host_name': {'readonly': True}, - 'slot_swap_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, - 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, - 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, - 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, - 'site_config': {'key': 'properties.siteConfig', 'type': 'SiteConfig'}, - 'traffic_manager_host_names': {'key': 'properties.trafficManagerHostNames', 'type': '[str]'}, - 'scm_site_also_stopped': {'key': 'properties.scmSiteAlsoStopped', 'type': 'bool'}, - 'target_swap_slot': {'key': 'properties.targetSwapSlot', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'client_affinity_enabled': {'key': 'properties.clientAffinityEnabled', 'type': 'bool'}, - 'client_cert_enabled': {'key': 'properties.clientCertEnabled', 'type': 'bool'}, - 'host_names_disabled': {'key': 'properties.hostNamesDisabled', 'type': 'bool'}, - 'outbound_ip_addresses': {'key': 'properties.outboundIpAddresses', 'type': 'str'}, - 'possible_outbound_ip_addresses': {'key': 'properties.possibleOutboundIpAddresses', 'type': 'str'}, - 'container_size': {'key': 'properties.containerSize', 'type': 'int'}, - 'daily_memory_time_quota': {'key': 'properties.dailyMemoryTimeQuota', 'type': 'int'}, - 'suspended_till': {'key': 'properties.suspendedTill', 'type': 'iso-8601'}, - 'max_number_of_workers': {'key': 'properties.maxNumberOfWorkers', 'type': 'int'}, - 'cloning_info': {'key': 'properties.cloningInfo', 'type': 'CloningInfo'}, - 'snapshot_info': {'key': 'properties.snapshotInfo', 'type': 'SnapshotRecoveryRequest'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'is_default_container': {'key': 'properties.isDefaultContainer', 'type': 'bool'}, - 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, - 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, - 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - } - - def __init__(self, **kwargs): - super(Site, self).__init__(**kwargs) - self.state = None - self.host_names = None - self.repository_site_name = None - self.usage_state = None - self.enabled = kwargs.get('enabled', None) - self.enabled_host_names = None - self.availability_state = None - self.host_name_ssl_states = kwargs.get('host_name_ssl_states', None) - self.server_farm_id = kwargs.get('server_farm_id', None) - self.reserved = kwargs.get('reserved', False) - self.last_modified_time_utc = None - self.site_config = kwargs.get('site_config', None) - self.traffic_manager_host_names = None - self.scm_site_also_stopped = kwargs.get('scm_site_also_stopped', False) - self.target_swap_slot = None - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.client_affinity_enabled = kwargs.get('client_affinity_enabled', None) - self.client_cert_enabled = kwargs.get('client_cert_enabled', None) - self.host_names_disabled = kwargs.get('host_names_disabled', None) - self.outbound_ip_addresses = None - self.possible_outbound_ip_addresses = None - self.container_size = kwargs.get('container_size', None) - self.daily_memory_time_quota = kwargs.get('daily_memory_time_quota', None) - self.suspended_till = None - self.max_number_of_workers = None - self.cloning_info = kwargs.get('cloning_info', None) - self.snapshot_info = kwargs.get('snapshot_info', None) - self.resource_group = None - self.is_default_container = None - self.default_host_name = None - self.slot_swap_status = None - self.https_only = kwargs.get('https_only', None) - self.identity = kwargs.get('identity', None) - - -class SiteConfig(Model): - """Configuration of an App Service app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param number_of_workers: Number of workers. - :type number_of_workers: int - :param default_documents: Default documents. - :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . - :type net_framework_version: str - :param php_version: Version of PHP. - :type php_version: str - :param python_version: Version of Python. - :type python_version: str - :param node_version: Version of Node.js. - :type node_version: str - :param linux_fx_version: Linux App Framework and version - :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. - :type request_tracing_enabled: bool - :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. - :type remote_debugging_enabled: bool - :param remote_debugging_version: Remote debugging version. - :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. - :type http_logging_enabled: bool - :param logs_directory_size_limit: HTTP logs directory size limit. - :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. - :type detailed_error_logging_enabled: bool - :param publishing_username: Publishing user name. - :type publishing_username: str - :param app_settings: Application settings. - :type app_settings: list[~azure.mgmt.web.v2015_04_01.models.NameValuePair] - :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2015_04_01.models.ConnStringInfo] - :ivar machine_key: Site MachineKey. - :vartype machine_key: ~azure.mgmt.web.v2015_04_01.models.SiteMachineKey - :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2015_04_01.models.HandlerMapping] - :param document_root: Document root. - :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' - :type scm_type: str or ~azure.mgmt.web.v2015_04_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. - :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. - :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. - :type always_on: bool - :param java_version: Java version. - :type java_version: str - :param java_container: Java container. - :type java_container: str - :param java_container_version: Java container version. - :type java_container_version: str - :param app_command_line: App command line to launch. - :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2015_04_01.models.ManagedPipelineMode - :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2015_04_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2015_04_01.models.SiteLoadBalancing - :param experiments: This is work around for polymorphic types. - :type experiments: ~azure.mgmt.web.v2015_04_01.models.Experiments - :param limits: Site limits. - :type limits: ~azure.mgmt.web.v2015_04_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. - :type auto_heal_enabled: bool - :param auto_heal_rules: Auto Heal rules. - :type auto_heal_rules: ~azure.mgmt.web.v2015_04_01.models.AutoHealRules - :param tracing_options: Tracing options. - :type tracing_options: str - :param vnet_name: Virtual Network name. - :type vnet_name: str - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.web.v2015_04_01.models.CorsSettings - :param push: Push endpoint settings. - :type push: ~azure.mgmt.web.v2015_04_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. - :type api_definition: ~azure.mgmt.web.v2015_04_01.models.ApiDefinitionInfo - :param auto_swap_slot_name: Auto-swap slot name. - :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . - :type local_my_sql_enabled: bool - :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2015_04_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . - :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2015_04_01.models.SupportedTlsVersions - """ - - _validation = { - 'machine_key': {'readonly': True}, - } - - _attribute_map = { - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'default_documents': {'key': 'defaultDocuments', 'type': '[str]'}, - 'net_framework_version': {'key': 'netFrameworkVersion', 'type': 'str'}, - 'php_version': {'key': 'phpVersion', 'type': 'str'}, - 'python_version': {'key': 'pythonVersion', 'type': 'str'}, - 'node_version': {'key': 'nodeVersion', 'type': 'str'}, - 'linux_fx_version': {'key': 'linuxFxVersion', 'type': 'str'}, - 'request_tracing_enabled': {'key': 'requestTracingEnabled', 'type': 'bool'}, - 'request_tracing_expiration_time': {'key': 'requestTracingExpirationTime', 'type': 'iso-8601'}, - 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, - 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, - 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, - 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, - 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, - 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, - 'app_settings': {'key': 'appSettings', 'type': '[NameValuePair]'}, - 'connection_strings': {'key': 'connectionStrings', 'type': '[ConnStringInfo]'}, - 'machine_key': {'key': 'machineKey', 'type': 'SiteMachineKey'}, - 'handler_mappings': {'key': 'handlerMappings', 'type': '[HandlerMapping]'}, - 'document_root': {'key': 'documentRoot', 'type': 'str'}, - 'scm_type': {'key': 'scmType', 'type': 'str'}, - 'use32_bit_worker_process': {'key': 'use32BitWorkerProcess', 'type': 'bool'}, - 'web_sockets_enabled': {'key': 'webSocketsEnabled', 'type': 'bool'}, - 'always_on': {'key': 'alwaysOn', 'type': 'bool'}, - 'java_version': {'key': 'javaVersion', 'type': 'str'}, - 'java_container': {'key': 'javaContainer', 'type': 'str'}, - 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, - 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, - 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, - 'experiments': {'key': 'experiments', 'type': 'Experiments'}, - 'limits': {'key': 'limits', 'type': 'SiteLimits'}, - 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, - 'auto_heal_rules': {'key': 'autoHealRules', 'type': 'AutoHealRules'}, - 'tracing_options': {'key': 'tracingOptions', 'type': 'str'}, - 'vnet_name': {'key': 'vnetName', 'type': 'str'}, - 'cors': {'key': 'cors', 'type': 'CorsSettings'}, - 'push': {'key': 'push', 'type': 'PushSettings'}, - 'api_definition': {'key': 'apiDefinition', 'type': 'ApiDefinitionInfo'}, - 'auto_swap_slot_name': {'key': 'autoSwapSlotName', 'type': 'str'}, - 'local_my_sql_enabled': {'key': 'localMySqlEnabled', 'type': 'bool'}, - 'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'http20_enabled': {'key': 'http20Enabled', 'type': 'bool'}, - 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SiteConfig, self).__init__(**kwargs) - self.number_of_workers = kwargs.get('number_of_workers', None) - self.default_documents = kwargs.get('default_documents', None) - self.net_framework_version = kwargs.get('net_framework_version', "v4.6") - self.php_version = kwargs.get('php_version', None) - self.python_version = kwargs.get('python_version', None) - self.node_version = kwargs.get('node_version', None) - self.linux_fx_version = kwargs.get('linux_fx_version', None) - self.request_tracing_enabled = kwargs.get('request_tracing_enabled', None) - self.request_tracing_expiration_time = kwargs.get('request_tracing_expiration_time', None) - self.remote_debugging_enabled = kwargs.get('remote_debugging_enabled', None) - self.remote_debugging_version = kwargs.get('remote_debugging_version', None) - self.http_logging_enabled = kwargs.get('http_logging_enabled', None) - self.logs_directory_size_limit = kwargs.get('logs_directory_size_limit', None) - self.detailed_error_logging_enabled = kwargs.get('detailed_error_logging_enabled', None) - self.publishing_username = kwargs.get('publishing_username', None) - self.app_settings = kwargs.get('app_settings', None) - self.connection_strings = kwargs.get('connection_strings', None) - self.machine_key = None - self.handler_mappings = kwargs.get('handler_mappings', None) - self.document_root = kwargs.get('document_root', None) - self.scm_type = kwargs.get('scm_type', None) - self.use32_bit_worker_process = kwargs.get('use32_bit_worker_process', None) - self.web_sockets_enabled = kwargs.get('web_sockets_enabled', None) - self.always_on = kwargs.get('always_on', None) - self.java_version = kwargs.get('java_version', None) - self.java_container = kwargs.get('java_container', None) - self.java_container_version = kwargs.get('java_container_version', None) - self.app_command_line = kwargs.get('app_command_line', None) - self.managed_pipeline_mode = kwargs.get('managed_pipeline_mode', None) - self.virtual_applications = kwargs.get('virtual_applications', None) - self.load_balancing = kwargs.get('load_balancing', None) - self.experiments = kwargs.get('experiments', None) - self.limits = kwargs.get('limits', None) - self.auto_heal_enabled = kwargs.get('auto_heal_enabled', None) - self.auto_heal_rules = kwargs.get('auto_heal_rules', None) - self.tracing_options = kwargs.get('tracing_options', None) - self.vnet_name = kwargs.get('vnet_name', None) - self.cors = kwargs.get('cors', None) - self.push = kwargs.get('push', None) - self.api_definition = kwargs.get('api_definition', None) - self.auto_swap_slot_name = kwargs.get('auto_swap_slot_name', None) - self.local_my_sql_enabled = kwargs.get('local_my_sql_enabled', False) - self.ip_security_restrictions = kwargs.get('ip_security_restrictions', None) - self.http20_enabled = kwargs.get('http20_enabled', True) - self.min_tls_version = kwargs.get('min_tls_version', None) - - -class SiteLimits(Model): - """Metric limits set on an app. - - :param max_percentage_cpu: Maximum allowed CPU usage percentage. - :type max_percentage_cpu: float - :param max_memory_in_mb: Maximum allowed memory usage in MB. - :type max_memory_in_mb: long - :param max_disk_size_in_mb: Maximum allowed disk size usage in MB. - :type max_disk_size_in_mb: long - """ - - _attribute_map = { - 'max_percentage_cpu': {'key': 'maxPercentageCpu', 'type': 'float'}, - 'max_memory_in_mb': {'key': 'maxMemoryInMb', 'type': 'long'}, - 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, - } - - def __init__(self, **kwargs): - super(SiteLimits, self).__init__(**kwargs) - self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) - self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) - self.max_disk_size_in_mb = kwargs.get('max_disk_size_in_mb', None) - - -class SiteMachineKey(Model): - """MachineKey of an app. - - :param validation: MachineKey validation. - :type validation: str - :param validation_key: Validation key. - :type validation_key: str - :param decryption: Algorithm used for decryption. - :type decryption: str - :param decryption_key: Decryption key. - :type decryption_key: str - """ - - _attribute_map = { - 'validation': {'key': 'validation', 'type': 'str'}, - 'validation_key': {'key': 'validationKey', 'type': 'str'}, - 'decryption': {'key': 'decryption', 'type': 'str'}, - 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SiteMachineKey, self).__init__(**kwargs) - self.validation = kwargs.get('validation', None) - self.validation_key = kwargs.get('validation_key', None) - self.decryption = kwargs.get('decryption', None) - self.decryption_key = kwargs.get('decryption_key', None) - - -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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, **kwargs): - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) - self.maximum = kwargs.get('maximum', None) - self.default = kwargs.get('default', None) - self.scale_type = kwargs.get('scale_type', None) - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2015_04_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2015_04_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, **kwargs): - super(SkuDescription, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - self.sku_capacity = kwargs.get('sku_capacity', None) - self.locations = kwargs.get('locations', None) - self.capabilities = kwargs.get('capabilities', None) - - -class SlotSwapStatus(Model): - """The status of the last successful slot swap operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime - :ivar source_slot_name: The source slot of the last swap operation. - :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. - :vartype destination_slot_name: str - """ - - _validation = { - 'timestamp_utc': {'readonly': True}, - 'source_slot_name': {'readonly': True}, - 'destination_slot_name': {'readonly': True}, - } - - _attribute_map = { - 'timestamp_utc': {'key': 'timestampUtc', 'type': 'iso-8601'}, - 'source_slot_name': {'key': 'sourceSlotName', 'type': 'str'}, - 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SlotSwapStatus, self).__init__(**kwargs) - self.timestamp_utc = None - self.source_slot_name = None - self.destination_slot_name = None - - -class SlowRequestsBasedTrigger(Model): - """Trigger based on request execution time. - - :param time_taken: Time taken. - :type time_taken: str - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'time_taken': {'key': 'timeTaken', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SlowRequestsBasedTrigger, self).__init__(**kwargs) - self.time_taken = kwargs.get('time_taken', None) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class SnapshotRecoveryRequest(ProxyOnlyResource): - """Details about app recovery operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. - :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2015_04_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. - :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. - :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. - This setting is only necessary when RecoverConfiguration is enabled. - :type ignore_conflicting_host_names: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'overwrite': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'str'}, - 'recovery_target': {'key': 'properties.recoveryTarget', 'type': 'SnapshotRecoveryTarget'}, - 'overwrite': {'key': 'properties.overwrite', 'type': 'bool'}, - 'recover_configuration': {'key': 'properties.recoverConfiguration', 'type': 'bool'}, - 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(SnapshotRecoveryRequest, self).__init__(**kwargs) - self.snapshot_time = kwargs.get('snapshot_time', None) - self.recovery_target = kwargs.get('recovery_target', None) - self.overwrite = kwargs.get('overwrite', None) - self.recover_configuration = kwargs.get('recover_configuration', None) - self.ignore_conflicting_host_names = kwargs.get('ignore_conflicting_host_names', None) - - -class SnapshotRecoveryTarget(Model): - """Specifies the web app that snapshot contents will be written to. - - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS - :type location: str - :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type id: str - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SnapshotRecoveryTarget, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = kwargs.get('id', None) - - -class StatusCodesBasedTrigger(Model): - """Trigger based on status code. - - :param status: HTTP status code. - :type status: int - :param sub_status: Request Sub Status. - :type sub_status: int - :param win32_status: Win32 error code. - :type win32_status: int - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'int'}, - 'sub_status': {'key': 'subStatus', 'type': 'int'}, - 'win32_status': {'key': 'win32Status', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(StatusCodesBasedTrigger, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.sub_status = kwargs.get('sub_status', None) - self.win32_status = kwargs.get('win32_status', None) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class TldLegalAgreement(Model): - """Legal agreement for a top level domain. - - All required parameters must be populated in order to send to Azure. - - :param agreement_key: Required. Unique identifier for the agreement. - :type agreement_key: str - :param title: Required. Agreement title. - :type title: str - :param content: Required. Agreement details. - :type content: str - :param url: URL where a copy of the agreement details is hosted. - :type url: str - """ - - _validation = { - 'agreement_key': {'required': True}, - 'title': {'required': True}, - 'content': {'required': True}, - } - - _attribute_map = { - 'agreement_key': {'key': 'agreementKey', 'type': 'str'}, - 'title': {'key': 'title', 'type': 'str'}, - 'content': {'key': 'content', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(TldLegalAgreement, self).__init__(**kwargs) - self.agreement_key = kwargs.get('agreement_key', None) - self.title = kwargs.get('title', None) - self.content = kwargs.get('content', None) - self.url = kwargs.get('url', None) - - -class TopLevelDomain(ProxyOnlyResource): - """A top level domain object. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar domain_name: Name of the top level domain. - :vartype domain_name: str - :param privacy: If true, then the top level domain supports - domain privacy; otherwise, false. - :type privacy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'domain_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'domain_name': {'key': 'properties.name', 'type': 'str'}, - 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(TopLevelDomain, self).__init__(**kwargs) - self.domain_name = None - self.privacy = kwargs.get('privacy', None) - - -class TopLevelDomainAgreementOption(Model): - """Options for retrieving the list of top level domain legal agreements. - - :param include_privacy: If true, then the list of agreements - will include agreements for domain privacy as well; otherwise, - false. - :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. - :type for_transfer: bool + :param include_privacy: If :code:`true`, then the list of agreements will include + agreements for domain privacy as well; otherwise, :code:`false`. + :type include_privacy: bool + :param for_transfer: If :code:`true`, then the list of agreements will include + agreements for domain transfer as well; otherwise, :code:`false`. + :type for_transfer: bool """ _attribute_map = { @@ -2843,284 +1226,42 @@ class TopLevelDomainAgreementOption(Model): 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopLevelDomainAgreementOption, self).__init__(**kwargs) self.include_privacy = kwargs.get('include_privacy', None) self.for_transfer = kwargs.get('for_transfer', None) -class User(ProxyOnlyResource): - """User credentials used for publishing activity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param user_name: Username - :type user_name: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.name', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(User, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.publishing_user_name = kwargs.get('publishing_user_name', None) - self.publishing_password = kwargs.get('publishing_password', None) - self.publishing_password_hash = kwargs.get('publishing_password_hash', None) - self.publishing_password_hash_salt = kwargs.get('publishing_password_hash_salt', None) - - -class VirtualApplication(Model): - """Virtual application in an app. - - :param virtual_path: Virtual path. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. - :type preload_enabled: bool - :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2015_04_01.models.VirtualDirectory] - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - 'preload_enabled': {'key': 'preloadEnabled', 'type': 'bool'}, - 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, - } - - def __init__(self, **kwargs): - super(VirtualApplication, self).__init__(**kwargs) - self.virtual_path = kwargs.get('virtual_path', None) - self.physical_path = kwargs.get('physical_path', None) - self.preload_enabled = kwargs.get('preload_enabled', None) - self.virtual_directories = kwargs.get('virtual_directories', None) - +class TopLevelDomainCollection(msrest.serialization.Model): + """Collection of Top-level domains. -class VirtualDirectory(Model): - """Directory for virtual application. - - :param virtual_path: Path to virtual application. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VirtualDirectory, self).__init__(**kwargs) - self.virtual_path = kwargs.get('virtual_path', None) - self.physical_path = kwargs.get('physical_path', None) - - -class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_name: The Virtual Network name. - :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. - :type vpn_package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, - 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetGateway, self).__init__(**kwargs) - self.vnet_name = kwargs.get('vnet_name', None) - self.vpn_package_uri = kwargs.get('vpn_package_uri', None) - - -class VnetInfo(ProxyOnlyResource): - """Virtual Network information contract. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_resource_id: The Virtual Network's resource ID. - :type vnet_resource_id: str - :ivar cert_thumbprint: The client certificate thumbprint. - :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a - Point-To-Site VPN connection. - :type cert_blob: bytearray - :ivar routes: The routes that this Virtual Network connection uses. - :vartype routes: list[~azure.mgmt.web.v2015_04_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. - :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. - :type dns_servers: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'cert_thumbprint': {'readonly': True}, - 'routes': {'readonly': True}, - 'resync_required': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_resource_id': {'key': 'properties.vnetResourceId', 'type': 'str'}, - 'cert_thumbprint': {'key': 'properties.certThumbprint', 'type': 'str'}, - 'cert_blob': {'key': 'properties.certBlob', 'type': 'bytearray'}, - 'routes': {'key': 'properties.routes', 'type': '[VnetRoute]'}, - 'resync_required': {'key': 'properties.resyncRequired', 'type': 'bool'}, - 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetInfo, self).__init__(**kwargs) - self.vnet_resource_id = kwargs.get('vnet_resource_id', None) - self.cert_thumbprint = None - self.cert_blob = kwargs.get('cert_blob', None) - self.routes = None - self.resync_required = None - self.dns_servers = kwargs.get('dns_servers', None) - - -class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. - :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. - :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. - :type end_address: str - :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 - INHERITED - Routes inherited from the real Virtual Network routes - STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' - :type route_type: str or ~azure.mgmt.web.v2015_04_01.models.RouteType + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.TopLevelDomain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_route_name': {'key': 'properties.name', 'type': 'str'}, - 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, - 'end_address': {'key': 'properties.endAddress', 'type': 'str'}, - 'route_type': {'key': 'properties.routeType', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[TopLevelDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(VnetRoute, self).__init__(**kwargs) - self.vnet_route_name = kwargs.get('vnet_route_name', None) - self.start_address = kwargs.get('start_address', None) - self.end_address = kwargs.get('end_address', None) - self.route_type = kwargs.get('route_type', None) + def __init__( + self, + **kwargs + ): + super(TopLevelDomainCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models_py3.py index dd0eb24ec946..d00ed4bdb982 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_models_py3.py @@ -1,19 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Address(Model): +from ._web_site_management_client_enums import * + + +class Address(msrest.serialization.Model): """Address information for domain registration. All required parameters must be populated in order to send to Azure. @@ -49,7 +51,17 @@ class Address(Model): 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, *, address1: str, city: str, country: str, postal_code: str, state: str, address2: str=None, **kwargs) -> None: + def __init__( + self, + *, + address1: str, + city: str, + country: str, + postal_code: str, + state: str, + address2: Optional[str] = None, + **kwargs + ): super(Address, self).__init__(**kwargs) self.address1 = address1 self.address2 = address2 @@ -59,450 +71,9 @@ def __init__(self, *, address1: str, city: str, country: str, postal_code: str, self.state = state -class ApiDefinitionInfo(Model): - """Information about the formal API definition for the app. - - :param url: The URL of the API definition. - :type url: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, *, url: str=None, **kwargs) -> None: - super(ApiDefinitionInfo, self).__init__(**kwargs) - self.url = url - - -class Resource(Model): - """Azure resource. This resource is tracked in Azure Resource Manager. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.kind = kind - self.location = location - self.type = None - self.tags = tags - - -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2015_04_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param admin_site_name: App Service plan administration site. - :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_04_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_04_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2015_04_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, tags=None, worker_tier_name: str=None, admin_site_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, is_spot: bool=None, spot_expiration_time=None, reserved: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: - super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_plan_name = app_service_plan_name - self.worker_tier_name = worker_tier_name - self.status = None - self.subscription = None - self.admin_site_name = admin_site_name - self.hosting_environment_profile = hosting_environment_profile - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = per_site_scaling - self.number_of_sites = None - self.is_spot = is_spot - self.spot_expiration_time = spot_expiration_time - self.resource_group = None - self.reserved = reserved - self.target_worker_count = target_worker_count - self.target_worker_size_id = target_worker_size_id - self.provisioning_state = None - self.sku = sku - - -class AutoHealActions(Model): - """Actions which to take by the auto-heal module when a rule is triggered. - - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2015_04_01.models.AutoHealActionType - :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2015_04_01.models.AutoHealCustomAction - :param min_process_execution_time: Minimum time the process must execute - before taking the action - :type min_process_execution_time: str - """ - - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, - 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, - 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, - } - - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: - super(AutoHealActions, self).__init__(**kwargs) - self.action_type = action_type - self.custom_action = custom_action - self.min_process_execution_time = min_process_execution_time - - -class AutoHealCustomAction(Model): - """Custom action to be executed - when an auto heal rule is triggered. - - :param exe: Executable to be run. - :type exe: str - :param parameters: Parameters for the executable. - :type parameters: str - """ - - _attribute_map = { - 'exe': {'key': 'exe', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: - super(AutoHealCustomAction, self).__init__(**kwargs) - self.exe = exe - self.parameters = parameters - - -class AutoHealRules(Model): - """Rules that can be defined for auto-heal. - - :param triggers: Conditions that describe when to execute the auto-heal - actions. - :type triggers: ~azure.mgmt.web.v2015_04_01.models.AutoHealTriggers - :param actions: Actions to be executed when a rule is triggered. - :type actions: ~azure.mgmt.web.v2015_04_01.models.AutoHealActions - """ - - _attribute_map = { - 'triggers': {'key': 'triggers', 'type': 'AutoHealTriggers'}, - 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, - } - - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: - super(AutoHealRules, self).__init__(**kwargs) - self.triggers = triggers - self.actions = actions - - -class AutoHealTriggers(Model): - """Triggers for auto-heal. - - :param requests: A rule based on total requests. - :type requests: ~azure.mgmt.web.v2015_04_01.models.RequestsBasedTrigger - :param private_bytes_in_kb: A rule based on private bytes. - :type private_bytes_in_kb: int - :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2015_04_01.models.StatusCodesBasedTrigger] - :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2015_04_01.models.SlowRequestsBasedTrigger - """ - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'RequestsBasedTrigger'}, - 'private_bytes_in_kb': {'key': 'privateBytesInKB', 'type': 'int'}, - 'status_codes': {'key': 'statusCodes', 'type': '[StatusCodesBasedTrigger]'}, - 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, - } - - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: - super(AutoHealTriggers, self).__init__(**kwargs) - self.requests = requests - self.private_bytes_in_kb = private_bytes_in_kb - self.status_codes = status_codes - self.slow_requests = slow_requests - - -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: - super(Capability, self).__init__(**kwargs) - self.name = name - self.value = value - self.reason = reason - - -class CloningInfo(Model): - """Information needed for cloning operation. - - All required parameters must be populated in order to send to Azure. - - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations - together to use the same snapshot. - :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. - :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. - :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. - :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type source_web_app_id: str - :param hosting_environment: App Service Environment. - :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. - :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. - :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. - :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. - :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. - :type ignore_quotas: bool - """ - - _validation = { - 'source_web_app_id': {'required': True}, - } - - _attribute_map = { - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'overwrite': {'key': 'overwrite', 'type': 'bool'}, - 'clone_custom_host_names': {'key': 'cloneCustomHostNames', 'type': 'bool'}, - 'clone_source_control': {'key': 'cloneSourceControl', 'type': 'bool'}, - 'source_web_app_id': {'key': 'sourceWebAppId', 'type': 'str'}, - 'hosting_environment': {'key': 'hostingEnvironment', 'type': 'str'}, - 'app_settings_overrides': {'key': 'appSettingsOverrides', 'type': '{str}'}, - 'configure_load_balancing': {'key': 'configureLoadBalancing', 'type': 'bool'}, - 'traffic_manager_profile_id': {'key': 'trafficManagerProfileId', 'type': 'str'}, - 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, - 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, - } - - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, ignore_quotas: bool=None, **kwargs) -> None: - super(CloningInfo, self).__init__(**kwargs) - self.correlation_id = correlation_id - self.overwrite = overwrite - self.clone_custom_host_names = clone_custom_host_names - self.clone_source_control = clone_source_control - self.source_web_app_id = source_web_app_id - self.hosting_environment = hosting_environment - self.app_settings_overrides = app_settings_overrides - self.configure_load_balancing = configure_load_balancing - self.traffic_manager_profile_id = traffic_manager_profile_id - self.traffic_manager_profile_name = traffic_manager_profile_name - self.ignore_quotas = ignore_quotas - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): - """Database connection string information. - - :param name: Name of connection string. - :type name: str - :param connection_string: Connection string value. - :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' - :type type: str or ~azure.mgmt.web.v2015_04_01.models.ConnectionStringType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, - } - - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: - super(ConnStringInfo, self).__init__(**kwargs) - self.name = name - self.connection_string = connection_string - self.type = type - - -class Contact(Model): - """Contact information for domain registration. If 'Domain Privacy' option is - not selected then the contact information is made publicly available - through the Whois - directories as per ICANN requirements. +class Contact(msrest.serialization.Model): + """Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information is made publicly available through the Whois +directories as per ICANN requirements. All required parameters must be populated in order to send to Azure. @@ -545,7 +116,20 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, email: str, name_first: str, name_last: str, phone: str, address_mailing=None, fax: str=None, job_title: str=None, name_middle: str=None, organization: str=None, **kwargs) -> None: + def __init__( + self, + *, + email: str, + name_first: str, + name_last: str, + phone: str, + address_mailing: Optional["Address"] = None, + fax: Optional[str] = None, + job_title: Optional[str] = None, + name_middle: Optional[str] = None, + organization: Optional[str] = None, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.address_mailing = address_mailing self.email = email @@ -558,36 +142,51 @@ def __init__(self, *, email: str, name_first: str, name_last: str, phone: str, a self.phone = phone -class CorsSettings(Model): - """Cross-Origin Resource Sharing (CORS) settings for the app. +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + Variables are only populated by the server, and will be ignored when sending a request. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin - calls (for example: http://example.com:12345). Use "*" to allow all. - :type allowed_origins: list[str] + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, allowed_origins=None, **kwargs) -> None: - super(CorsSettings, self).__init__(**kwargs) - self.allowed_origins = allowed_origins + def __init__( + self, + *, + value: List["CsmOperationDescription"], + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class CsmOperationDescription(Model): +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2015_04_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2015_04_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2015_04_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -597,7 +196,15 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["CsmOperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["CsmOperationDescriptionProperties"] = None, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = name self.display = display @@ -605,24 +212,29 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties self.properties = properties -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2015_04_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2015_04_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = service_specification -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -642,7 +254,15 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -650,10 +270,9 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -672,7 +291,15 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, internal_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -680,11 +307,64 @@ def __init__(self, *, name: str=None, display_name: str=None, internal_name: str self.to_be_exported_for_shoebox = to_be_exported_for_shoebox +class Resource(msrest.serialization.Model): + """Azure resource. This resource is tracked in Azure Resource Manager. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :param location: Required. Resource Location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = kind + self.location = location + self.type = None + self.tags = tags + + class Domain(Resource): """Information about a domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -698,62 +378,58 @@ class Domain(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2015_04_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2015_04_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_04_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2015_04_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_04_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2015_04_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2015_04_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2015_04_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_04_01.models.DomainPropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType :param auth_code: :type auth_code: str @@ -764,10 +440,6 @@ class Domain(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -776,7 +448,6 @@ class Domain(Resource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -791,8 +462,8 @@ class Domain(Resource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -803,13 +474,31 @@ class Domain(Resource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, *, location: str, contact_admin, contact_billing, contact_registrant, contact_tech, consent, kind: str=None, tags=None, privacy: bool=None, auto_renew: bool=True, dns_type=None, dns_zone_id: str=None, target_dns_type=None, auth_code: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + contact_admin: Optional["Contact"] = None, + contact_billing: Optional["Contact"] = None, + contact_registrant: Optional["Contact"] = None, + contact_tech: Optional["Contact"] = None, + privacy: Optional[bool] = None, + auto_renew: Optional[bool] = True, + consent: Optional["DomainPurchaseConsent"] = None, + dns_type: Optional[Union[str, "DnsType"]] = None, + dns_zone_id: Optional[str] = None, + target_dns_type: Optional[Union[str, "DnsType"]] = None, + auth_code: Optional[str] = None, + **kwargs + ): super(Domain, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.contact_admin = contact_admin self.contact_billing = contact_billing @@ -833,46 +522,85 @@ def __init__(self, *, location: str, contact_admin, contact_billing, contact_reg self.auth_code = auth_code -class DomainAvailablilityCheckResult(Model): +class DomainAvailablilityCheckResult(msrest.serialization.Model): """Domain availability check result. :param name: Name of the domain. :type name: str - :param available: true if domain can be purchased using - CreateDomain API; otherwise, false. + :param available: :code:`true` if domain can be purchased using CreateDomain API; + otherwise, :code:`false`. :type available: bool - :param domain_type: Valid values are Regular domain: Azure will charge the - full price of domain registration, SoftDeleted: Purchasing this domain - will simply restore it and this operation will not cost anything. Possible - values include: 'Regular', 'SoftDeleted' + :param domain_type: Valid values are Regular domain: Azure will charge the full price of domain + registration, SoftDeleted: Purchasing this domain will simply restore it and this operation + will not cost anything. Possible values include: "Regular", "SoftDeleted". :type domain_type: str or ~azure.mgmt.web.v2015_04_01.models.DomainType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'available': {'key': 'available', 'type': 'bool'}, - 'domain_type': {'key': 'domainType', 'type': 'DomainType'}, + 'domain_type': {'key': 'domainType', 'type': 'str'}, } - def __init__(self, *, name: str=None, available: bool=None, domain_type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available: Optional[bool] = None, + domain_type: Optional[Union[str, "DomainType"]] = None, + **kwargs + ): super(DomainAvailablilityCheckResult, self).__init__(**kwargs) self.name = name self.available = available self.domain_type = domain_type -class DomainControlCenterSsoRequest(Model): +class DomainCollection(msrest.serialization.Model): + """Collection of domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.Domain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Domain"], + **kwargs + ): + super(DomainCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DomainControlCenterSsoRequest(msrest.serialization.Model): """Single sign-on request information for domain management. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar url: URL where the single sign-on request is to be made. :vartype url: str :ivar post_parameter_key: Post parameter key. :vartype post_parameter_key: str - :ivar post_parameter_value: Post parameter value. Client should use - 'application/x-www-form-urlencoded' encoding for this value. + :ivar post_parameter_value: Post parameter value. Client should use 'application/x-www-form- + urlencoded' encoding for this value. :vartype post_parameter_value: str """ @@ -888,19 +616,20 @@ class DomainControlCenterSsoRequest(Model): 'post_parameter_value': {'key': 'postParameterValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DomainControlCenterSsoRequest, self).__init__(**kwargs) self.url = None self.post_parameter_key = None self.post_parameter_value = None -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -925,7 +654,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -936,8 +670,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class DomainOwnershipIdentifier(ProxyOnlyResource): """Domain ownership Identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -965,19 +698,56 @@ class DomainOwnershipIdentifier(ProxyOnlyResource): 'ownership_id': {'key': 'properties.ownershipId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, ownership_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + ownership_id: Optional[str] = None, + **kwargs + ): super(DomainOwnershipIdentifier, self).__init__(kind=kind, **kwargs) self.ownership_id = ownership_id -class DomainPatchResource(ProxyOnlyResource): - """ARM resource for a domain. +class DomainOwnershipIdentifierCollection(msrest.serialization.Model): + """Collection of domain ownership identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DomainOwnershipIdentifier"], + **kwargs + ): + super(DomainOwnershipIdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DomainPatchResource(ProxyOnlyResource): + """ARM resource for a domain. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -986,60 +756,56 @@ class DomainPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2015_04_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2015_04_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2015_04_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_04_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2015_04_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_04_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2015_04_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2015_04_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2015_04_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_04_01.models.DomainPatchResourcePropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2015_04_01.models.DnsType :param auth_code: :type auth_code: str @@ -1049,10 +815,6 @@ class DomainPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -1061,7 +823,6 @@ class DomainPatchResource(ProxyOnlyResource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -1074,8 +835,8 @@ class DomainPatchResource(ProxyOnlyResource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -1086,13 +847,29 @@ class DomainPatchResource(ProxyOnlyResource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, *, contact_admin, contact_billing, contact_registrant, contact_tech, consent, kind: str=None, privacy: bool=None, auto_renew: bool=True, dns_type=None, dns_zone_id: str=None, target_dns_type=None, auth_code: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + contact_admin: Optional["Contact"] = None, + contact_billing: Optional["Contact"] = None, + contact_registrant: Optional["Contact"] = None, + contact_tech: Optional["Contact"] = None, + privacy: Optional[bool] = None, + auto_renew: Optional[bool] = True, + consent: Optional["DomainPurchaseConsent"] = None, + dns_type: Optional[Union[str, "DnsType"]] = None, + dns_zone_id: Optional[str] = None, + target_dns_type: Optional[Union[str, "DnsType"]] = None, + auth_code: Optional[str] = None, + **kwargs + ): super(DomainPatchResource, self).__init__(kind=kind, **kwargs) self.contact_admin = contact_admin self.contact_billing = contact_billing @@ -1116,18 +893,16 @@ def __init__(self, *, contact_admin, contact_billing, contact_registrant, contac self.auth_code = auth_code -class DomainPurchaseConsent(Model): - """Domain purchase consent object, representing acceptance of applicable legal - agreements. +class DomainPurchaseConsent(msrest.serialization.Model): + """Domain purchase consent object, representing acceptance of applicable legal agreements. - :param agreement_keys: List of applicable legal agreement keys. This list - can be retrieved using ListLegalAgreements API under - TopLevelDomain resource. + :param agreement_keys: List of applicable legal agreement keys. This list can be retrieved + using ListLegalAgreements API under :code:`TopLevelDomain` resource. :type agreement_keys: list[str] :param agreed_by: Client IP address. :type agreed_by: str :param agreed_at: Timestamp when the agreements were accepted. - :type agreed_at: datetime + :type agreed_at: ~datetime.datetime """ _attribute_map = { @@ -1136,18 +911,24 @@ class DomainPurchaseConsent(Model): 'agreed_at': {'key': 'agreedAt', 'type': 'iso-8601'}, } - def __init__(self, *, agreement_keys=None, agreed_by: str=None, agreed_at=None, **kwargs) -> None: + def __init__( + self, + *, + agreement_keys: Optional[List[str]] = None, + agreed_by: Optional[str] = None, + agreed_at: Optional[datetime.datetime] = None, + **kwargs + ): super(DomainPurchaseConsent, self).__init__(**kwargs) self.agreement_keys = agreement_keys self.agreed_by = agreed_by self.agreed_at = agreed_at -class DomainRecommendationSearchParameters(Model): +class DomainRecommendationSearchParameters(msrest.serialization.Model): """Domain recommendation search parameters. - :param keywords: Keywords to be used for generating domain - recommendations. + :param keywords: Keywords to be used for generating domain recommendations. :type keywords: str :param max_domain_recommendations: Maximum number of recommendations. :type max_domain_recommendations: int @@ -1158,13 +939,19 @@ class DomainRecommendationSearchParameters(Model): 'max_domain_recommendations': {'key': 'maxDomainRecommendations', 'type': 'int'}, } - def __init__(self, *, keywords: str=None, max_domain_recommendations: int=None, **kwargs) -> None: + def __init__( + self, + *, + keywords: Optional[str] = None, + max_domain_recommendations: Optional[int] = None, + **kwargs + ): super(DomainRecommendationSearchParameters, self).__init__(**kwargs) self.keywords = keywords self.max_domain_recommendations = max_domain_recommendations -class ErrorResponse(Model): +class ErrorResponse(msrest.serialization.Model): """Error Response. :param code: Error code. @@ -1178,138 +965,61 @@ class ErrorResponse(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) - - -class Experiments(Model): - """Routing rules in production experiments. +class HostName(msrest.serialization.Model): + """Details of a hostname derived from a domain. - :param ramp_up_rules: List of ramp-up rules. - :type ramp_up_rules: list[~azure.mgmt.web.v2015_04_01.models.RampUpRule] - """ - - _attribute_map = { - 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, - } - - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: - super(Experiments, self).__init__(**kwargs) - self.ramp_up_rules = ramp_up_rules - - -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. - - :param extension: Requests with this extension will be handled using the - specified FastCGI application. - :type extension: str - :param script_processor: The absolute path to the FastCGI application. - :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. - :type arguments: str - """ - - _attribute_map = { - 'extension': {'key': 'extension', 'type': 'str'}, - 'script_processor': {'key': 'scriptProcessor', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': 'str'}, - } - - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: - super(HandlerMapping, self).__init__(**kwargs) - self.extension = extension - self.script_processor = script_processor - self.arguments = arguments - - -class HostingEnvironmentProfile(Model): - """Specification for an App Service Environment to use for this resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param id: Resource ID of the App Service Environment. - :type id: str - :ivar name: Name of the App Service Environment. - :vartype name: str - :ivar type: Resource type of the App Service Environment. - :vartype type: str - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, *, id: str=None, **kwargs) -> None: - super(HostingEnvironmentProfile, self).__init__(**kwargs) - self.id = id - self.name = None - self.type = None - - -class HostName(Model): - """Details of a hostname derived from a domain. - - :param name: Name of the hostname. - :type name: str - :param site_names: List of apps the hostname is assigned to. This list - will have more than one app only if the hostname is pointing to a Traffic - Manager. - :type site_names: list[str] - :param azure_resource_name: Name of the Azure resource the hostname is - assigned to. If it is assigned to a Traffic Manager then it will be the - Traffic Manager name otherwise it will be the app name. - :type azure_resource_name: str - :param azure_resource_type: Type of the Azure resource the hostname is - assigned to. Possible values include: 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2015_04_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Type of the DNS record. Possible - values include: 'CName', 'A' - :type custom_host_name_dns_record_type: str or - ~azure.mgmt.web.v2015_04_01.models.CustomHostNameDnsRecordType - :param host_name_type: Type of the hostname. Possible values include: - 'Verified', 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2015_04_01.models.HostNameType + :param name: Name of the hostname. + :type name: str + :param site_names: List of apps the hostname is assigned to. This list will have more than one + app only if the hostname is pointing to a Traffic Manager. + :type site_names: list[str] + :param azure_resource_name: Name of the Azure resource the hostname is assigned to. If it is + assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the + app name. + :type azure_resource_name: str + :param azure_resource_type: Type of the Azure resource the hostname is assigned to. Possible + values include: "Website", "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2015_04_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Type of the DNS record. Possible values include: + "CName", "A". + :type custom_host_name_dns_record_type: str or + ~azure.mgmt.web.v2015_04_01.models.CustomHostNameDnsRecordType + :param host_name_type: Type of the hostname. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2015_04_01.models.HostNameType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'site_names': {'key': 'siteNames', 'type': '[str]'}, 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'hostNameType', 'type': 'HostNameType'}, - } - - def __init__(self, *, name: str=None, site_names=None, azure_resource_name: str=None, azure_resource_type=None, custom_host_name_dns_record_type=None, host_name_type=None, **kwargs) -> None: + 'azure_resource_type': {'key': 'azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'hostNameType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + site_names: Optional[List[str]] = None, + azure_resource_name: Optional[str] = None, + azure_resource_type: Optional[Union[str, "AzureResourceType"]] = None, + custom_host_name_dns_record_type: Optional[Union[str, "CustomHostNameDnsRecordType"]] = None, + host_name_type: Optional[Union[str, "HostNameType"]] = None, + **kwargs + ): super(HostName, self).__init__(**kwargs) self.name = name self.site_names = site_names @@ -1319,258 +1029,7 @@ def __init__(self, *, name: str=None, site_names=None, azure_resource_name: str= self.host_name_type = host_name_type -class HostNameSslState(Model): - """SSL-enabled hostname. - - :param name: Hostname. - :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' - :type ssl_state: str or ~azure.mgmt.web.v2015_04_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. - :type virtual_ip: str - :param thumbprint: SSL certificate thumbprint. - :type thumbprint: str - :param to_update: Set to true to update existing hostname. - :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' - :type host_type: str or ~azure.mgmt.web.v2015_04_01.models.HostType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, - 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: - super(HostNameSslState, self).__init__(**kwargs) - self.name = name - self.ssl_state = ssl_state - self.virtual_ip = virtual_ip - self.thumbprint = thumbprint - self.to_update = to_update - self.host_type = host_type - - -class HybridConnection(ProxyOnlyResource): - """Hybrid Connection contract. This is used to configure a Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param service_bus_namespace: The name of the Service Bus namespace. - :type service_bus_namespace: str - :param relay_name: The name of the Service Bus relay. - :type relay_name: str - :param relay_arm_uri: The ARM URI to the Service Bus relay. - :type relay_arm_uri: str - :param hostname: The hostname of the endpoint. - :type hostname: str - :param port: The port of the endpoint. - :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. - :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned - normally, use the POST /listKeys API instead. - :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net - :type service_bus_suffix: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'service_bus_namespace': {'key': 'properties.serviceBusNamespace', 'type': 'str'}, - 'relay_name': {'key': 'properties.relayName', 'type': 'str'}, - 'relay_arm_uri': {'key': 'properties.relayArmUri', 'type': 'str'}, - 'hostname': {'key': 'properties.hostname', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: - super(HybridConnection, self).__init__(kind=kind, **kwargs) - self.service_bus_namespace = service_bus_namespace - self.relay_name = relay_name - self.relay_arm_uri = relay_arm_uri - self.hostname = hostname - self.port = port - self.send_key_name = send_key_name - self.send_key_value = send_key_value - self.service_bus_suffix = service_bus_suffix - - -class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar send_key_name: The name of the send key. - :vartype send_key_name: str - :ivar send_key_value: The value of the send key. - :vartype send_key_value: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'send_key_name': {'readonly': True}, - 'send_key_value': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) - self.send_key_name = None - self.send_key_value = None - - -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: - super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id - - -class IpSecurityRestriction(Model): - """IP security restriction on an app. - - All required parameters must be populated in order to send to Azure. - - :param ip_address: Required. IP address the security restriction is valid - for. - :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. - :type subnet_mask: str - """ - - _validation = { - 'ip_address': {'required': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, - } - - def __init__(self, *, ip_address: str, subnet_mask: str=None, **kwargs) -> None: - super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = ip_address - self.subnet_mask = subnet_mask - - -class ManagedServiceIdentity(Model): - """Managed service identity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2015_04_01.models.ManagedServiceIdentityType - :ivar tenant_id: Tenant of managed service identity. - :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. - :vartype principal_id: str - """ - - _validation = { - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__(self, *, type=None, **kwargs) -> None: - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.type = type - self.tenant_id = None - self.principal_id = None - - -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -1584,13 +1043,19 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, time_grain: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = time_grain self.blob_duration = blob_duration -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -1622,8 +1087,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2015_04_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2015_04_01.models.MetricAvailability] """ _attribute_map = { @@ -1644,7 +1108,26 @@ class MetricSpecification(Model): 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, supports_instance_level_aggregation: bool=None, enable_regional_mdm_account: bool=None, source_mdm_account: str=None, source_mdm_namespace: str=None, metric_filter_pattern: str=None, fill_gap_with_zero: bool=None, is_internal: bool=None, dimensions=None, category: str=None, availabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supports_instance_level_aggregation: Optional[bool] = None, + enable_regional_mdm_account: Optional[bool] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + metric_filter_pattern: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + is_internal: Optional[bool] = None, + dimensions: Optional[List["Dimension"]] = None, + category: Optional[str] = None, + availabilities: Optional[List["MetricAvailability"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1663,7 +1146,7 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio self.availabilities = availabilities -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -1674,205 +1157,153 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = name -class NameValuePair(Model): - """Name value pair. - - :param name: Pair name. - :type name: str - :param value: Pair value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: - super(NameValuePair, self).__init__(**kwargs) - self.name = name - self.value = value - - -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class NameIdentifierCollection(msrest.serialization.Model): + """Collection of domain name identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. - :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. - :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. - Tags can consist of alphanumeric characters and the following: - '_', '@', '#', '.', ':', '-'. - Validation should be performed at the PushRequestHandler. - :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. - :type dynamic_tags_json: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.NameIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'is_push_enabled': {'key': 'properties.isPushEnabled', 'type': 'bool'}, - 'tag_whitelist_json': {'key': 'properties.tagWhitelistJson', 'type': 'str'}, - 'tags_requiring_auth': {'key': 'properties.tagsRequiringAuth', 'type': 'str'}, - 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[NameIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: - super(PushSettings, self).__init__(kind=kind, **kwargs) - self.is_push_enabled = is_push_enabled - self.tag_whitelist_json = tag_whitelist_json - self.tags_requiring_auth = tags_requiring_auth - self.dynamic_tags_json = dynamic_tags_json - - -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. - - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. - :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. - :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. - :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. - :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. - :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. - :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ - :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. - :type name: str + def __init__( + self, + *, + value: List["NameIdentifier"], + **kwargs + ): + super(NameIdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ServiceSpecification(msrest.serialization.Model): + """Resource metrics service provided by Microsoft.Insights resource provider. + + :param metric_specifications: + :type metric_specifications: list[~azure.mgmt.web.v2015_04_01.models.MetricSpecification] """ _attribute_map = { - 'action_host_name': {'key': 'actionHostName', 'type': 'str'}, - 'reroute_percentage': {'key': 'reroutePercentage', 'type': 'float'}, - 'change_step': {'key': 'changeStep', 'type': 'float'}, - 'change_interval_in_minutes': {'key': 'changeIntervalInMinutes', 'type': 'int'}, - 'min_reroute_percentage': {'key': 'minReroutePercentage', 'type': 'float'}, - 'max_reroute_percentage': {'key': 'maxReroutePercentage', 'type': 'float'}, - 'change_decision_callback_url': {'key': 'changeDecisionCallbackUrl', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: - super(RampUpRule, self).__init__(**kwargs) - self.action_host_name = action_host_name - self.reroute_percentage = reroute_percentage - self.change_step = change_step - self.change_interval_in_minutes = change_interval_in_minutes - self.min_reroute_percentage = min_reroute_percentage - self.max_reroute_percentage = max_reroute_percentage - self.change_decision_callback_url = change_decision_callback_url - self.name = name + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications -class RequestsBasedTrigger(Model): - """Trigger based on total requests. +class TldLegalAgreement(msrest.serialization.Model): + """Legal agreement for a top level domain. + + All required parameters must be populated in order to send to Azure. - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str + :param agreement_key: Required. Unique identifier for the agreement. + :type agreement_key: str + :param title: Required. Agreement title. + :type title: str + :param content: Required. Agreement details. + :type content: str + :param url: URL where a copy of the agreement details is hosted. + :type url: str """ + _validation = { + 'agreement_key': {'required': True}, + 'title': {'required': True}, + 'content': {'required': True}, + } + _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, + 'agreement_key': {'key': 'agreementKey', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: - super(RequestsBasedTrigger, self).__init__(**kwargs) - self.count = count - self.time_interval = time_interval + def __init__( + self, + *, + agreement_key: str, + title: str, + content: str, + url: Optional[str] = None, + **kwargs + ): + super(TldLegalAgreement, self).__init__(**kwargs) + self.agreement_key = agreement_key + self.title = title + self.content = content + self.url = url + +class TldLegalAgreementCollection(msrest.serialization.Model): + """Collection of top-level domain legal agreements. -class ResourceMetricAvailability(Model): - """Metrics availability and retention. + Variables are only populated by the server, and will be ignored when sending a request. - 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 time_grain: Time grain . - :vartype time_grain: str - :ivar retention: Retention period for the current time grain. - :vartype retention: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.TldLegalAgreement] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[TldLegalAgreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(ResourceMetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None + def __init__( + self, + *, + value: List["TldLegalAgreement"], + **kwargs + ): + super(TldLegalAgreementCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class ResourceMetricDefinition(ProxyOnlyResource): - """Metadata for the metrics. +class TopLevelDomain(ProxyOnlyResource): + """A top level domain object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1882,36 +1313,18 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2015_04_01.models.ResourceMetricName - :ivar unit: Unit of the metric. - :vartype unit: str - :ivar primary_aggregation_type: Primary aggregation type. - :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2015_04_01.models.ResourceMetricAvailability] - :ivar resource_uri: Resource URI. - :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str - :ivar properties: Resource metric definition properties. - :vartype properties: dict[str, str] + :ivar domain_name: Name of the top level domain. + :vartype domain_name: str + :param privacy: If :code:`true`, then the top level domain supports domain + privacy; otherwise, :code:`false`. + :type privacy: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, - 'unit': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'metric_availabilities': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, - 'properties': {'readonly': True}, + 'domain_name': {'readonly': True}, } _attribute_map = { @@ -1919,1208 +1332,79 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, - 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, - 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, - 'properties': {'key': 'properties.properties', 'type': '{str}'}, + 'domain_name': {'key': 'properties.name', 'type': 'str'}, + 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) - self.resource_metric_definition_name = None - self.unit = None - self.primary_aggregation_type = None - self.metric_availabilities = None - self.resource_uri = None - self.resource_metric_definition_id = None - self.properties = None - + def __init__( + self, + *, + kind: Optional[str] = None, + privacy: Optional[bool] = None, + **kwargs + ): + super(TopLevelDomain, self).__init__(kind=kind, **kwargs) + self.domain_name = None + self.privacy = privacy -class ResourceMetricName(Model): - """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. +class TopLevelDomainAgreementOption(msrest.serialization.Model): + """Options for retrieving the list of top level domain legal agreements. - :ivar value: metric name value. - :vartype value: str - :ivar localized_value: Localized metric name value. - :vartype localized_value: str + :param include_privacy: If :code:`true`, then the list of agreements will include + agreements for domain privacy as well; otherwise, :code:`false`. + :type include_privacy: bool + :param for_transfer: If :code:`true`, then the list of agreements will include + agreements for domain transfer as well; otherwise, :code:`false`. + :type for_transfer: bool """ - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + 'include_privacy': {'key': 'includePrivacy', 'type': 'bool'}, + 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, } - def __init__(self, **kwargs) -> None: - super(ResourceMetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None + def __init__( + self, + *, + include_privacy: Optional[bool] = None, + for_transfer: Optional[bool] = None, + **kwargs + ): + super(TopLevelDomainAgreementOption, self).__init__(**kwargs) + self.include_privacy = include_privacy + self.for_transfer = for_transfer -class ServiceSpecification(Model): - """Resource metrics service provided by Microsoft.Insights resource provider. +class TopLevelDomainCollection(msrest.serialization.Model): + """Collection of Top-level domains. - :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2015_04_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__(self, *, metric_specifications=None, **kwargs) -> None: - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = metric_specifications - - -class Site(Resource): - """A web app, a mobile app backend, or an API app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :ivar state: Current state of the app. - :vartype state: str - :ivar host_names: Hostnames associated with the app. - :vartype host_names: list[str] - :ivar repository_site_name: Name of the repository site. - :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' - :vartype usage_state: str or ~azure.mgmt.web.v2015_04_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). - :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, - the app is not served on those hostnames. - :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2015_04_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2015_04_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: - "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". - :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . - :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime - :param site_config: Configuration of the app. - :type site_config: ~azure.mgmt.web.v2015_04_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. - :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . - :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. - :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_04_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. - :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. - :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. - :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. - :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. - :vartype possible_outbound_ip_addresses: str - :param container_size: Size of the function container. - :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). - :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime - :ivar max_number_of_workers: Maximum number of workers. - This only applies to Functions container. - :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. - :type cloning_info: ~azure.mgmt.web.v2015_04_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2015_04_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. - :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. - :vartype is_default_container: bool - :ivar default_host_name: Default hostname of the app. Read-only. - :vartype default_host_name: str - :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2015_04_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests - :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2015_04_01.models.ManagedServiceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'host_names': {'readonly': True}, - 'repository_site_name': {'readonly': True}, - 'usage_state': {'readonly': True}, - 'enabled_host_names': {'readonly': True}, - 'availability_state': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'traffic_manager_host_names': {'readonly': True}, - 'target_swap_slot': {'readonly': True}, - 'outbound_ip_addresses': {'readonly': True}, - 'possible_outbound_ip_addresses': {'readonly': True}, - 'suspended_till': {'readonly': True}, - 'max_number_of_workers': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'is_default_container': {'readonly': True}, - 'default_host_name': {'readonly': True}, - 'slot_swap_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, - 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, - 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, - 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, - 'site_config': {'key': 'properties.siteConfig', 'type': 'SiteConfig'}, - 'traffic_manager_host_names': {'key': 'properties.trafficManagerHostNames', 'type': '[str]'}, - 'scm_site_also_stopped': {'key': 'properties.scmSiteAlsoStopped', 'type': 'bool'}, - 'target_swap_slot': {'key': 'properties.targetSwapSlot', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'client_affinity_enabled': {'key': 'properties.clientAffinityEnabled', 'type': 'bool'}, - 'client_cert_enabled': {'key': 'properties.clientCertEnabled', 'type': 'bool'}, - 'host_names_disabled': {'key': 'properties.hostNamesDisabled', 'type': 'bool'}, - 'outbound_ip_addresses': {'key': 'properties.outboundIpAddresses', 'type': 'str'}, - 'possible_outbound_ip_addresses': {'key': 'properties.possibleOutboundIpAddresses', 'type': 'str'}, - 'container_size': {'key': 'properties.containerSize', 'type': 'int'}, - 'daily_memory_time_quota': {'key': 'properties.dailyMemoryTimeQuota', 'type': 'int'}, - 'suspended_till': {'key': 'properties.suspendedTill', 'type': 'iso-8601'}, - 'max_number_of_workers': {'key': 'properties.maxNumberOfWorkers', 'type': 'int'}, - 'cloning_info': {'key': 'properties.cloningInfo', 'type': 'CloningInfo'}, - 'snapshot_info': {'key': 'properties.snapshotInfo', 'type': 'SnapshotRecoveryRequest'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'is_default_container': {'key': 'properties.isDefaultContainer', 'type': 'bool'}, - 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, - 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, - 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, snapshot_info=None, https_only: bool=None, identity=None, **kwargs) -> None: - super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.state = None - self.host_names = None - self.repository_site_name = None - self.usage_state = None - self.enabled = enabled - self.enabled_host_names = None - self.availability_state = None - self.host_name_ssl_states = host_name_ssl_states - self.server_farm_id = server_farm_id - self.reserved = reserved - self.last_modified_time_utc = None - self.site_config = site_config - self.traffic_manager_host_names = None - self.scm_site_also_stopped = scm_site_also_stopped - self.target_swap_slot = None - self.hosting_environment_profile = hosting_environment_profile - self.client_affinity_enabled = client_affinity_enabled - self.client_cert_enabled = client_cert_enabled - self.host_names_disabled = host_names_disabled - self.outbound_ip_addresses = None - self.possible_outbound_ip_addresses = None - self.container_size = container_size - self.daily_memory_time_quota = daily_memory_time_quota - self.suspended_till = None - self.max_number_of_workers = None - self.cloning_info = cloning_info - self.snapshot_info = snapshot_info - self.resource_group = None - self.is_default_container = None - self.default_host_name = None - self.slot_swap_status = None - self.https_only = https_only - self.identity = identity - - -class SiteConfig(Model): - """Configuration of an App Service app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param number_of_workers: Number of workers. - :type number_of_workers: int - :param default_documents: Default documents. - :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . - :type net_framework_version: str - :param php_version: Version of PHP. - :type php_version: str - :param python_version: Version of Python. - :type python_version: str - :param node_version: Version of Node.js. - :type node_version: str - :param linux_fx_version: Linux App Framework and version - :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. - :type request_tracing_enabled: bool - :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. - :type remote_debugging_enabled: bool - :param remote_debugging_version: Remote debugging version. - :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. - :type http_logging_enabled: bool - :param logs_directory_size_limit: HTTP logs directory size limit. - :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. - :type detailed_error_logging_enabled: bool - :param publishing_username: Publishing user name. - :type publishing_username: str - :param app_settings: Application settings. - :type app_settings: list[~azure.mgmt.web.v2015_04_01.models.NameValuePair] - :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2015_04_01.models.ConnStringInfo] - :ivar machine_key: Site MachineKey. - :vartype machine_key: ~azure.mgmt.web.v2015_04_01.models.SiteMachineKey - :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2015_04_01.models.HandlerMapping] - :param document_root: Document root. - :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' - :type scm_type: str or ~azure.mgmt.web.v2015_04_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. - :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. - :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. - :type always_on: bool - :param java_version: Java version. - :type java_version: str - :param java_container: Java container. - :type java_container: str - :param java_container_version: Java container version. - :type java_container_version: str - :param app_command_line: App command line to launch. - :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2015_04_01.models.ManagedPipelineMode - :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2015_04_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2015_04_01.models.SiteLoadBalancing - :param experiments: This is work around for polymorphic types. - :type experiments: ~azure.mgmt.web.v2015_04_01.models.Experiments - :param limits: Site limits. - :type limits: ~azure.mgmt.web.v2015_04_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. - :type auto_heal_enabled: bool - :param auto_heal_rules: Auto Heal rules. - :type auto_heal_rules: ~azure.mgmt.web.v2015_04_01.models.AutoHealRules - :param tracing_options: Tracing options. - :type tracing_options: str - :param vnet_name: Virtual Network name. - :type vnet_name: str - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.web.v2015_04_01.models.CorsSettings - :param push: Push endpoint settings. - :type push: ~azure.mgmt.web.v2015_04_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. - :type api_definition: ~azure.mgmt.web.v2015_04_01.models.ApiDefinitionInfo - :param auto_swap_slot_name: Auto-swap slot name. - :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . - :type local_my_sql_enabled: bool - :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2015_04_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . - :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2015_04_01.models.SupportedTlsVersions - """ - - _validation = { - 'machine_key': {'readonly': True}, - } - - _attribute_map = { - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'default_documents': {'key': 'defaultDocuments', 'type': '[str]'}, - 'net_framework_version': {'key': 'netFrameworkVersion', 'type': 'str'}, - 'php_version': {'key': 'phpVersion', 'type': 'str'}, - 'python_version': {'key': 'pythonVersion', 'type': 'str'}, - 'node_version': {'key': 'nodeVersion', 'type': 'str'}, - 'linux_fx_version': {'key': 'linuxFxVersion', 'type': 'str'}, - 'request_tracing_enabled': {'key': 'requestTracingEnabled', 'type': 'bool'}, - 'request_tracing_expiration_time': {'key': 'requestTracingExpirationTime', 'type': 'iso-8601'}, - 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, - 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, - 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, - 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, - 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, - 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, - 'app_settings': {'key': 'appSettings', 'type': '[NameValuePair]'}, - 'connection_strings': {'key': 'connectionStrings', 'type': '[ConnStringInfo]'}, - 'machine_key': {'key': 'machineKey', 'type': 'SiteMachineKey'}, - 'handler_mappings': {'key': 'handlerMappings', 'type': '[HandlerMapping]'}, - 'document_root': {'key': 'documentRoot', 'type': 'str'}, - 'scm_type': {'key': 'scmType', 'type': 'str'}, - 'use32_bit_worker_process': {'key': 'use32BitWorkerProcess', 'type': 'bool'}, - 'web_sockets_enabled': {'key': 'webSocketsEnabled', 'type': 'bool'}, - 'always_on': {'key': 'alwaysOn', 'type': 'bool'}, - 'java_version': {'key': 'javaVersion', 'type': 'str'}, - 'java_container': {'key': 'javaContainer', 'type': 'str'}, - 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, - 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, - 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, - 'experiments': {'key': 'experiments', 'type': 'Experiments'}, - 'limits': {'key': 'limits', 'type': 'SiteLimits'}, - 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, - 'auto_heal_rules': {'key': 'autoHealRules', 'type': 'AutoHealRules'}, - 'tracing_options': {'key': 'tracingOptions', 'type': 'str'}, - 'vnet_name': {'key': 'vnetName', 'type': 'str'}, - 'cors': {'key': 'cors', 'type': 'CorsSettings'}, - 'push': {'key': 'push', 'type': 'PushSettings'}, - 'api_definition': {'key': 'apiDefinition', 'type': 'ApiDefinitionInfo'}, - 'auto_swap_slot_name': {'key': 'autoSwapSlotName', 'type': 'str'}, - 'local_my_sql_enabled': {'key': 'localMySqlEnabled', 'type': 'bool'}, - 'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'http20_enabled': {'key': 'http20Enabled', 'type': 'bool'}, - 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, - } - - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, ip_security_restrictions=None, http20_enabled: bool=True, min_tls_version=None, **kwargs) -> None: - super(SiteConfig, self).__init__(**kwargs) - self.number_of_workers = number_of_workers - self.default_documents = default_documents - self.net_framework_version = net_framework_version - self.php_version = php_version - self.python_version = python_version - self.node_version = node_version - self.linux_fx_version = linux_fx_version - self.request_tracing_enabled = request_tracing_enabled - self.request_tracing_expiration_time = request_tracing_expiration_time - self.remote_debugging_enabled = remote_debugging_enabled - self.remote_debugging_version = remote_debugging_version - self.http_logging_enabled = http_logging_enabled - self.logs_directory_size_limit = logs_directory_size_limit - self.detailed_error_logging_enabled = detailed_error_logging_enabled - self.publishing_username = publishing_username - self.app_settings = app_settings - self.connection_strings = connection_strings - self.machine_key = None - self.handler_mappings = handler_mappings - self.document_root = document_root - self.scm_type = scm_type - self.use32_bit_worker_process = use32_bit_worker_process - self.web_sockets_enabled = web_sockets_enabled - self.always_on = always_on - self.java_version = java_version - self.java_container = java_container - self.java_container_version = java_container_version - self.app_command_line = app_command_line - self.managed_pipeline_mode = managed_pipeline_mode - self.virtual_applications = virtual_applications - self.load_balancing = load_balancing - self.experiments = experiments - self.limits = limits - self.auto_heal_enabled = auto_heal_enabled - self.auto_heal_rules = auto_heal_rules - self.tracing_options = tracing_options - self.vnet_name = vnet_name - self.cors = cors - self.push = push - self.api_definition = api_definition - self.auto_swap_slot_name = auto_swap_slot_name - self.local_my_sql_enabled = local_my_sql_enabled - self.ip_security_restrictions = ip_security_restrictions - self.http20_enabled = http20_enabled - self.min_tls_version = min_tls_version - - -class SiteLimits(Model): - """Metric limits set on an app. - - :param max_percentage_cpu: Maximum allowed CPU usage percentage. - :type max_percentage_cpu: float - :param max_memory_in_mb: Maximum allowed memory usage in MB. - :type max_memory_in_mb: long - :param max_disk_size_in_mb: Maximum allowed disk size usage in MB. - :type max_disk_size_in_mb: long - """ - - _attribute_map = { - 'max_percentage_cpu': {'key': 'maxPercentageCpu', 'type': 'float'}, - 'max_memory_in_mb': {'key': 'maxMemoryInMb', 'type': 'long'}, - 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, - } - - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: - super(SiteLimits, self).__init__(**kwargs) - self.max_percentage_cpu = max_percentage_cpu - self.max_memory_in_mb = max_memory_in_mb - self.max_disk_size_in_mb = max_disk_size_in_mb - - -class SiteMachineKey(Model): - """MachineKey of an app. - - :param validation: MachineKey validation. - :type validation: str - :param validation_key: Validation key. - :type validation_key: str - :param decryption: Algorithm used for decryption. - :type decryption: str - :param decryption_key: Decryption key. - :type decryption_key: str - """ - - _attribute_map = { - 'validation': {'key': 'validation', 'type': 'str'}, - 'validation_key': {'key': 'validationKey', 'type': 'str'}, - 'decryption': {'key': 'decryption', 'type': 'str'}, - 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, - } - - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: - super(SiteMachineKey, self).__init__(**kwargs) - self.validation = validation - self.validation_key = validation_key - self.decryption = decryption - self.decryption_key = decryption_key - - -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2015_04_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2015_04_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: - super(SkuDescription, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - self.sku_capacity = sku_capacity - self.locations = locations - self.capabilities = capabilities - - -class SlotSwapStatus(Model): - """The status of the last successful slot swap operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime - :ivar source_slot_name: The source slot of the last swap operation. - :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. - :vartype destination_slot_name: str - """ - - _validation = { - 'timestamp_utc': {'readonly': True}, - 'source_slot_name': {'readonly': True}, - 'destination_slot_name': {'readonly': True}, - } - - _attribute_map = { - 'timestamp_utc': {'key': 'timestampUtc', 'type': 'iso-8601'}, - 'source_slot_name': {'key': 'sourceSlotName', 'type': 'str'}, - 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(SlotSwapStatus, self).__init__(**kwargs) - self.timestamp_utc = None - self.source_slot_name = None - self.destination_slot_name = None - - -class SlowRequestsBasedTrigger(Model): - """Trigger based on request execution time. - - :param time_taken: Time taken. - :type time_taken: str - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'time_taken': {'key': 'timeTaken', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: - super(SlowRequestsBasedTrigger, self).__init__(**kwargs) - self.time_taken = time_taken - self.count = count - self.time_interval = time_interval - - -class SnapshotRecoveryRequest(ProxyOnlyResource): - """Details about app recovery operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. - :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2015_04_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. - :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. - :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. - This setting is only necessary when RecoverConfiguration is enabled. - :type ignore_conflicting_host_names: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'overwrite': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'str'}, - 'recovery_target': {'key': 'properties.recoveryTarget', 'type': 'SnapshotRecoveryTarget'}, - 'overwrite': {'key': 'properties.overwrite', 'type': 'bool'}, - 'recover_configuration': {'key': 'properties.recoverConfiguration', 'type': 'bool'}, - 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, - } - - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_target=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, **kwargs) -> None: - super(SnapshotRecoveryRequest, self).__init__(kind=kind, **kwargs) - self.snapshot_time = snapshot_time - self.recovery_target = recovery_target - self.overwrite = overwrite - self.recover_configuration = recover_configuration - self.ignore_conflicting_host_names = ignore_conflicting_host_names - - -class SnapshotRecoveryTarget(Model): - """Specifies the web app that snapshot contents will be written to. - - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS - :type location: str - :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type id: str - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: - super(SnapshotRecoveryTarget, self).__init__(**kwargs) - self.location = location - self.id = id - - -class StatusCodesBasedTrigger(Model): - """Trigger based on status code. - - :param status: HTTP status code. - :type status: int - :param sub_status: Request Sub Status. - :type sub_status: int - :param win32_status: Win32 error code. - :type win32_status: int - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'int'}, - 'sub_status': {'key': 'subStatus', 'type': 'int'}, - 'win32_status': {'key': 'win32Status', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: - super(StatusCodesBasedTrigger, self).__init__(**kwargs) - self.status = status - self.sub_status = sub_status - self.win32_status = win32_status - self.count = count - self.time_interval = time_interval - - -class TldLegalAgreement(Model): - """Legal agreement for a top level domain. - - All required parameters must be populated in order to send to Azure. - - :param agreement_key: Required. Unique identifier for the agreement. - :type agreement_key: str - :param title: Required. Agreement title. - :type title: str - :param content: Required. Agreement details. - :type content: str - :param url: URL where a copy of the agreement details is hosted. - :type url: str - """ - - _validation = { - 'agreement_key': {'required': True}, - 'title': {'required': True}, - 'content': {'required': True}, - } - - _attribute_map = { - 'agreement_key': {'key': 'agreementKey', 'type': 'str'}, - 'title': {'key': 'title', 'type': 'str'}, - 'content': {'key': 'content', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, *, agreement_key: str, title: str, content: str, url: str=None, **kwargs) -> None: - super(TldLegalAgreement, self).__init__(**kwargs) - self.agreement_key = agreement_key - self.title = title - self.content = content - self.url = url - - -class TopLevelDomain(ProxyOnlyResource): - """A top level domain object. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar domain_name: Name of the top level domain. - :vartype domain_name: str - :param privacy: If true, then the top level domain supports - domain privacy; otherwise, false. - :type privacy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'domain_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'domain_name': {'key': 'properties.name', 'type': 'str'}, - 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, - } - - def __init__(self, *, kind: str=None, privacy: bool=None, **kwargs) -> None: - super(TopLevelDomain, self).__init__(kind=kind, **kwargs) - self.domain_name = None - self.privacy = privacy - - -class TopLevelDomainAgreementOption(Model): - """Options for retrieving the list of top level domain legal agreements. - - :param include_privacy: If true, then the list of agreements - will include agreements for domain privacy as well; otherwise, - false. - :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. - :type for_transfer: bool - """ - - _attribute_map = { - 'include_privacy': {'key': 'includePrivacy', 'type': 'bool'}, - 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, - } - - def __init__(self, *, include_privacy: bool=None, for_transfer: bool=None, **kwargs) -> None: - super(TopLevelDomainAgreementOption, self).__init__(**kwargs) - self.include_privacy = include_privacy - self.for_transfer = for_transfer - - -class User(ProxyOnlyResource): - """User credentials used for publishing activity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param user_name: Username - :type user_name: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.name', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, - } - - def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, **kwargs) -> None: - super(User, self).__init__(kind=kind, **kwargs) - self.user_name = user_name - self.publishing_user_name = publishing_user_name - self.publishing_password = publishing_password - self.publishing_password_hash = publishing_password_hash - self.publishing_password_hash_salt = publishing_password_hash_salt - - -class VirtualApplication(Model): - """Virtual application in an app. - - :param virtual_path: Virtual path. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. - :type preload_enabled: bool - :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2015_04_01.models.VirtualDirectory] - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - 'preload_enabled': {'key': 'preloadEnabled', 'type': 'bool'}, - 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, - } - - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: - super(VirtualApplication, self).__init__(**kwargs) - self.virtual_path = virtual_path - self.physical_path = physical_path - self.preload_enabled = preload_enabled - self.virtual_directories = virtual_directories - - -class VirtualDirectory(Model): - """Directory for virtual application. - - :param virtual_path: Path to virtual application. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - } - - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: - super(VirtualDirectory, self).__init__(**kwargs) - self.virtual_path = virtual_path - self.physical_path = physical_path - - -class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_name: The Virtual Network name. - :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. - :type vpn_package_uri: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_04_01.models.TopLevelDomain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, - 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[TopLevelDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: - super(VnetGateway, self).__init__(kind=kind, **kwargs) - self.vnet_name = vnet_name - self.vpn_package_uri = vpn_package_uri - - -class VnetInfo(ProxyOnlyResource): - """Virtual Network information contract. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_resource_id: The Virtual Network's resource ID. - :type vnet_resource_id: str - :ivar cert_thumbprint: The client certificate thumbprint. - :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a - Point-To-Site VPN connection. - :type cert_blob: bytearray - :ivar routes: The routes that this Virtual Network connection uses. - :vartype routes: list[~azure.mgmt.web.v2015_04_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. - :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. - :type dns_servers: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'cert_thumbprint': {'readonly': True}, - 'routes': {'readonly': True}, - 'resync_required': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_resource_id': {'key': 'properties.vnetResourceId', 'type': 'str'}, - 'cert_thumbprint': {'key': 'properties.certThumbprint', 'type': 'str'}, - 'cert_blob': {'key': 'properties.certBlob', 'type': 'bytearray'}, - 'routes': {'key': 'properties.routes', 'type': '[VnetRoute]'}, - 'resync_required': {'key': 'properties.resyncRequired', 'type': 'bool'}, - 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: bytearray=None, dns_servers: str=None, **kwargs) -> None: - super(VnetInfo, self).__init__(kind=kind, **kwargs) - self.vnet_resource_id = vnet_resource_id - self.cert_thumbprint = None - self.cert_blob = cert_blob - self.routes = None - self.resync_required = None - self.dns_servers = dns_servers - - -class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. - :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. - :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. - :type end_address: str - :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 - INHERITED - Routes inherited from the real Virtual Network routes - STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' - :type route_type: str or ~azure.mgmt.web.v2015_04_01.models.RouteType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_route_name': {'key': 'properties.name', 'type': 'str'}, - 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, - 'end_address': {'key': 'properties.endAddress', 'type': 'str'}, - 'route_type': {'key': 'properties.routeType', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: - super(VnetRoute, self).__init__(kind=kind, **kwargs) - self.vnet_route_name = vnet_route_name - self.start_address = start_address - self.end_address = end_address - self.route_type = route_type + def __init__( + self, + *, + value: List["TopLevelDomain"], + **kwargs + ): + super(TopLevelDomainCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_web_site_management_client_enums.py index 22f218bb63e5..329d9b4e5281 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_web_site_management_client_enums.py @@ -1,182 +1,112 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class DomainStatus(str, Enum): - - active = "Active" - awaiting = "Awaiting" - cancelled = "Cancelled" - confiscated = "Confiscated" - disabled = "Disabled" - excluded = "Excluded" - expired = "Expired" - failed = "Failed" - held = "Held" - locked = "Locked" - parked = "Parked" - pending = "Pending" - reserved = "Reserved" - reverted = "Reverted" - suspended = "Suspended" - transferred = "Transferred" - unknown = "Unknown" - unlocked = "Unlocked" - unparked = "Unparked" - updated = "Updated" - json_converter_failed = "JsonConverterFailed" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" - - -class AzureResourceType(str, Enum): - - website = "Website" - traffic_manager = "TrafficManager" - - -class CustomHostNameDnsRecordType(str, Enum): - - cname = "CName" - a = "A" - - -class HostNameType(str, Enum): - - verified = "Verified" - managed = "Managed" - - -class DnsType(str, Enum): - - azure_dns = "AzureDns" - default_domain_registrar_dns = "DefaultDomainRegistrarDns" - - -class DomainType(str, Enum): - - regular = "Regular" - soft_deleted = "SoftDeleted" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AzureResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Azure resource the hostname is assigned to. + """ + + WEBSITE = "Website" + TRAFFIC_MANAGER = "TrafficManager" + +class CustomHostNameDnsRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the DNS record. + """ + + C_NAME = "CName" + A = "A" + +class DnsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current DNS type + """ + + AZURE_DNS = "AzureDns" + DEFAULT_DOMAIN_REGISTRAR_DNS = "DefaultDomainRegistrarDns" + +class DomainPatchResourcePropertiesDomainNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class DomainPropertiesDomainNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class DomainStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Domain registration status. + """ + + ACTIVE = "Active" + AWAITING = "Awaiting" + CANCELLED = "Cancelled" + CONFISCATED = "Confiscated" + DISABLED = "Disabled" + EXCLUDED = "Excluded" + EXPIRED = "Expired" + FAILED = "Failed" + HELD = "Held" + LOCKED = "Locked" + PARKED = "Parked" + PENDING = "Pending" + RESERVED = "Reserved" + REVERTED = "Reverted" + SUSPENDED = "Suspended" + TRANSFERRED = "Transferred" + UNKNOWN = "Unknown" + UNLOCKED = "Unlocked" + UNPARKED = "Unparked" + UPDATED = "Updated" + JSON_CONVERTER_FAILED = "JsonConverterFailed" + +class DomainType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Valid values are Regular domain: Azure will charge the full price of domain registration, + SoftDeleted: Purchasing this domain will simply restore it and this operation will not cost + anything. + """ + + REGULAR = "Regular" + SOFT_DELETED = "SoftDeleted" + +class HostNameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the hostname. + """ + + VERIFIED = "Verified" + MANAGED = "Managed" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Domain provisioning state. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/__init__.py index c190a5674c86..ab719ee73294 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._domains_operations import DomainsOperations diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py index c2d79d623ed4..d471245e4f0b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py @@ -1,106 +1,109 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DomainRegistrationProviderOperations(object): """DomainRegistrationProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2015_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. - :ivar api_version: API Version. Constant value: "2015-04-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-01" - - self.config = config + self._config = config def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2015_04_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2015_04_01.models.CsmOperationDescription] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py index 921f7bcf808c..2ba62ddcfb86 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py @@ -1,1104 +1,1078 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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]] class DomainsOperations(object): """DomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2015_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. - :ivar api_version: API Version. Constant value: "2015-04-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-01" - - self.config = config + self._config = config def check_availability( - self, name=None, custom_headers=None, raw=False, **operation_config): + self, + identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainAvailablilityCheckResult" """Check if a domain is available for registration. Check if a domain is available for registration. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainAvailablilityCheckResult or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2015_04_01.models.DomainAvailablilityCheckResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param identifier: Name of the domain. + :type identifier: ~azure.mgmt.web.v2015_04_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainAvailablilityCheckResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainAvailablilityCheckResult + :raises: ~azure.core.exceptions.HttpResponseError """ - identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_availability.metadata['url'] + url = self.check_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DomainAvailablilityCheckResult', response) + deserialized = self._deserialize('DomainAvailablilityCheckResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} # type: ignore def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainCollection"] """Get all domains in a subscription. Get all domains in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.web.v2015_04_01.models.DomainPaged[~azure.mgmt.web.v2015_04_01.models.Domain] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} # type: ignore def get_control_center_sso_request( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DomainControlCenterSsoRequest" """Generate a single sign-on request for the domain management portal. Generate a single sign-on request for the domain management portal. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainControlCenterSsoRequest or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2015_04_01.models.DomainControlCenterSsoRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainControlCenterSsoRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainControlCenterSsoRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.get_control_center_sso_request.metadata['url'] + url = self.get_control_center_sso_request.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DomainControlCenterSsoRequest', response) + deserialized = self._deserialize('DomainControlCenterSsoRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} + get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} # type: ignore def list_recommendations( - self, keywords=None, max_domain_recommendations=None, custom_headers=None, raw=False, **operation_config): + self, + parameters, # type: "models.DomainRecommendationSearchParameters" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.NameIdentifierCollection"] """Get domain name recommendations based on keywords. Get domain name recommendations based on keywords. - :param keywords: Keywords to be used for generating domain - recommendations. - :type keywords: str - :param max_domain_recommendations: Maximum number of recommendations. - :type max_domain_recommendations: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of NameIdentifier - :rtype: - ~azure.mgmt.web.v2015_04_01.models.NameIdentifierPaged[~azure.mgmt.web.v2015_04_01.models.NameIdentifier] - :raises: :class:`CloudError` + :param parameters: Search parameters for domain name recommendations. + :type parameters: ~azure.mgmt.web.v2015_04_01.models.DomainRecommendationSearchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NameIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.NameIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.DomainRecommendationSearchParameters(keywords=keywords, max_domain_recommendations=max_domain_recommendations) + cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommendations.metadata['url'] + url = self.list_recommendations.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('NameIdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.NameIdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainCollection"] """Get all domains in a resource group. Get all domains in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.web.v2015_04_01.models.DomainPaged[~azure.mgmt.web.v2015_04_01.models.Domain] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} # type: ignore def get( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Get a domain. Get a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2015_04_01.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Domain"] """Creates or updates a domain. Creates or updates a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain: Domain registration information. :type domain: ~azure.mgmt.web.v2015_04_01.models.Domain - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Domain or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2015_04_01.models.Domain] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2015_04_01.models.Domain]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2015_04_01.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain=domain, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Domain', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + domain_name=domain_name, + domain=domain, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + 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 + ) + 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.DomainRegistration/domains/{domainName}'} # type: ignore def delete( - self, resource_group_name, domain_name, force_hard_delete_domain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + force_hard_delete_domain=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Delete a domain. Delete a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param force_hard_delete_domain: Specify true to delete - the domain immediately. The default is false which - deletes the domain after 24 hours. + :param force_hard_delete_domain: Specify :code:`true` to delete the domain + immediately. The default is :code:`false` which deletes the domain after 24 hours. :type force_hard_delete_domain: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if force_hard_delete_domain is not None: query_parameters['forceHardDeleteDomain'] = self._serialize.query("force_hard_delete_domain", force_hard_delete_domain, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def update( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.DomainPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Creates or updates a domain. Creates or updates a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain: Domain registration information. :type domain: ~azure.mgmt.web.v2015_04_01.models.DomainPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2015_04_01.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def list_ownership_identifiers( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainOwnershipIdentifierCollection"] """Lists domain ownership identifiers. Lists domain ownership identifiers. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DomainOwnershipIdentifier - :rtype: - ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifierPaged[~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainOwnershipIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_ownership_identifiers.metadata['url'] + url = self.list_ownership_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainOwnershipIdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainOwnershipIdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} # type: ignore def get_ownership_identifier( - self, resource_group_name, domain_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" """Get ownership identifier for domain. Get ownership identifier for domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.get_ownership_identifier.metadata['url'] + url = self.get_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def create_or_update_ownership_identifier( - self, resource_group_name, domain_name, name, kind=None, ownership_id=None, custom_headers=None, raw=False, **operation_config): - """Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + domain_ownership_identifier, # type: "models.DomainOwnershipIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param kind: Kind of resource. - :type kind: str - :param ownership_id: Ownership Id. - :type ownership_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.DomainOwnershipIdentifier(kind=kind, ownership_id=ownership_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_ownership_identifier.metadata['url'] + url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def delete_ownership_identifier( - self, resource_group_name, domain_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete ownership identifier for domain. Delete ownership identifier for domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.delete_ownership_identifier.metadata['url'] + url = self.delete_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + if cls: + return cls(pipeline_response, None, {}) - def update_ownership_identifier( - self, resource_group_name, domain_name, name, kind=None, ownership_id=None, custom_headers=None, raw=False, **operation_config): - """Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. + delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def update_ownership_identifier( + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + domain_ownership_identifier, # type: "models.DomainOwnershipIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param kind: Kind of resource. - :type kind: str - :param ownership_id: Ownership Id. - :type ownership_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2015_04_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.DomainOwnershipIdentifier(kind=kind, ownership_id=ownership_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_ownership_identifier.metadata['url'] + url = self.update_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def renew( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Renew a domain. Renew a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.renew.metadata['url'] + url = self.renew.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py index bdfe01b2f801..850452f62c5a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py @@ -1,255 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class TopLevelDomainsOperations(object): """TopLevelDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2015_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. - :ivar api_version: API Version. Constant value: "2015-04-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-04-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TopLevelDomainCollection"] """Get all top-level domains supported for registration. Get all top-level domains supported for registration. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TopLevelDomain - :rtype: - ~azure.mgmt.web.v2015_04_01.models.TopLevelDomainPaged[~azure.mgmt.web.v2015_04_01.models.TopLevelDomain] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopLevelDomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.TopLevelDomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TopLevelDomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TopLevelDomainPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} # type: ignore def get( - self, name, custom_headers=None, raw=False, **operation_config): + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TopLevelDomain" """Get details of a top-level domain. Get details of a top-level domain. :param name: Name of the top-level domain. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TopLevelDomain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2015_04_01.models.TopLevelDomain or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopLevelDomain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_04_01.models.TopLevelDomain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TopLevelDomain', response) + deserialized = self._deserialize('TopLevelDomain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} # type: ignore def list_agreements( - self, name, include_privacy=None, for_transfer=None, custom_headers=None, raw=False, **operation_config): - """Gets all legal agreements that user needs to accept before purchasing a - domain. + self, + name, # type: str + agreement_option, # type: "models.TopLevelDomainAgreementOption" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TldLegalAgreementCollection"] + """Gets all legal agreements that user needs to accept before purchasing a domain. - Gets all legal agreements that user needs to accept before purchasing a - domain. + Gets all legal agreements that user needs to accept before purchasing a domain. :param name: Name of the top-level domain. :type name: str - :param include_privacy: If true, then the list of - agreements will include agreements for domain privacy as well; - otherwise, false. - :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. - :type for_transfer: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TldLegalAgreement - :rtype: - ~azure.mgmt.web.v2015_04_01.models.TldLegalAgreementPaged[~azure.mgmt.web.v2015_04_01.models.TldLegalAgreement] - :raises: :class:`CloudError` + :param agreement_option: Domain agreement options. + :type agreement_option: ~azure.mgmt.web.v2015_04_01.models.TopLevelDomainAgreementOption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TldLegalAgreementCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_04_01.models.TldLegalAgreementCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - agreement_option = models.TopLevelDomainAgreementOption(include_privacy=include_privacy, for_transfer=for_transfer) + cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-04-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_agreements.metadata['url'] + url = self.list_agreements.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TldLegalAgreementCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TldLegalAgreementPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} + return ItemPaged( + get_next, extract_data + ) + list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py index b96e0933169e..b90edb7045d6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2015-08-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json new file mode 100644 index 000000000000..ef0a01ba2d38 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json @@ -0,0 +1,59 @@ +{ + "chosen_version": "2015-08-01", + "total_api_version_list": ["2015-08-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "app_service_certificate_orders": "AppServiceCertificateOrdersOperations", + "certificate_registration_provider": "CertificateRegistrationProviderOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py index ffe20b2588d0..9716d61f52a9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py @@ -1,16 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration from .operations import AppServiceCertificateOrdersOperations @@ -18,38 +23,52 @@ from . import models -class WebSiteManagementClient(SDKClient): - """WebSite Management Client +class WebSiteManagementClient(object): + """WebSite Management Client. - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration - - :ivar app_service_certificate_orders: AppServiceCertificateOrders operations + :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations :vartype app_service_certificate_orders: azure.mgmt.web.v2015_08_01.operations.AppServiceCertificateOrdersOperations - :ivar certificate_registration_provider: CertificateRegistrationProvider operations + :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations :vartype certificate_registration_provider: azure.mgmt.web.v2015_08_01.operations.CertificateRegistrationProviderOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2015-08-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.app_service_certificate_orders = AppServiceCertificateOrdersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificate_registration_provider = CertificateRegistrationProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py new file mode 100644 index 000000000000..3c95c55bc9bb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-08-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..aa153b08b90f --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import AppServiceCertificateOrdersOperations +from .operations_async import CertificateRegistrationProviderOperations +from .. import models + + +class WebSiteManagementClient(object): + """WebSite Management Client. + + :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations + :vartype app_service_certificate_orders: azure.mgmt.web.v2015_08_01.aio.operations_async.AppServiceCertificateOrdersOperations + :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations + :vartype certificate_registration_provider: azure.mgmt.web.v2015_08_01.aio.operations_async.CertificateRegistrationProviderOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificate_registration_provider = CertificateRegistrationProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..721731261c24 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__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_service_certificate_orders_operations_async import AppServiceCertificateOrdersOperations +from ._certificate_registration_provider_operations_async import CertificateRegistrationProviderOperations + +__all__ = [ + 'AppServiceCertificateOrdersOperations', + 'CertificateRegistrationProviderOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py new file mode 100644 index 000000000000..de0a51c2f8df --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py @@ -0,0 +1,1399 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServiceCertificateOrdersOperations: + """AppServiceCertificateOrdersOperations 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.web.v2015_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateOrderCollection"]: + """List all certificate orders in a subscription. + + List all certificate orders 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 AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('AppServiceCertificateOrderCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.CertificateRegistration/certificateOrders'} # type: ignore + + async def validate_purchase_information( + self, + app_service_certificate_order: "models.AppServiceCertificateOrder", + **kwargs + ) -> None: + """Validate information for a certificate order. + + Validate information for a certificate order. + + :param app_service_certificate_order: Information for a certificate order. + :type app_service_certificate_order: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_purchase_information.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') + 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 [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, {}) + + validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateOrderCollection"]: + """Get certificate orders in a resource group. + + Get certificate orders in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServiceCertificateOrderCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore + + async def get( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> "models.AppServiceCertificateOrder": + """Get a certificate order. + + Get a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order.. + :type certificate_order_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrder", + **kwargs + ) -> "models.AppServiceCertificateOrder": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') + 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]: + 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('AppServiceCertificateOrder', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrder", + **kwargs + ) -> AsyncLROPoller["models.AppServiceCertificateOrder"]: + """Create or update a certificate purchase order. + + Create or update a certificate purchase order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceCertificateOrder or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + lro_delay = kwargs.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, + certificate_order_name=certificate_order_name, + certificate_distinguished_name=certificate_distinguished_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Delete an existing certificate order. + + Delete an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrderPatchResource", + **kwargs + ) -> "models.AppServiceCertificateOrder": + """Create or update a certificate purchase order. + + Create or update a certificate purchase order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') + 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, 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('AppServiceCertificateOrder', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + def list_certificates( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateCollection"]: + """List all certificates associated with a certificate order. + + List all certificates associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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: + 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('AppServiceCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} # type: ignore + + async def get_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + **kwargs + ) -> "models.AppServiceCertificateResource": + """Get the certificate associated with a certificate order. + + Get the certificate associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.get_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def _create_or_update_certificate_initial( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificateResource", + **kwargs + ) -> "models.AppServiceCertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') + 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]: + 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('AppServiceCertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def begin_create_or_update_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificateResource", + **kwargs + ) -> AsyncLROPoller["models.AppServiceCertificateResource"]: + """Creates or updates a certificate and associates with key vault secret. + + Creates or updates a certificate and associates with key vault secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :param key_vault_certificate: Key vault certificate resource Id. + :type key_vault_certificate: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceCertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + lro_delay = kwargs.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_certificate_initial( + resource_group_name=resource_group_name, + certificate_order_name=certificate_order_name, + name=name, + key_vault_certificate=key_vault_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def delete_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + **kwargs + ) -> None: + """Delete the certificate associated with a certificate order. + + Delete the certificate associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def update_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificatePatchResource", + **kwargs + ) -> "models.AppServiceCertificateResource": + """Creates or updates a certificate and associates with key vault secret. + + Creates or updates a certificate and associates with key vault secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :param key_vault_certificate: Key vault certificate resource Id. + :type key_vault_certificate: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') + 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, 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('AppServiceCertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def reissue( + self, + resource_group_name: str, + certificate_order_name: str, + reissue_certificate_order_request: "models.ReissueCertificateOrderRequest", + **kwargs + ) -> None: + """Reissue an existing certificate order. + + Reissue an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param reissue_certificate_order_request: Parameters for the reissue. + :type reissue_certificate_order_request: ~azure.mgmt.web.v2015_08_01.models.ReissueCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.reissue.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') + 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 [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, {}) + + reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} # type: ignore + + async def renew( + self, + resource_group_name: str, + certificate_order_name: str, + renew_certificate_order_request: "models.RenewCertificateOrderRequest", + **kwargs + ) -> None: + """Renew an existing certificate order. + + Renew an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param renew_certificate_order_request: Renew parameters. + :type renew_certificate_order_request: ~azure.mgmt.web.v2015_08_01.models.RenewCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.renew.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') + 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 [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, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} # type: ignore + + async def resend_email( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Resend certificate email. + + Resend certificate email. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.resend_email.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} # type: ignore + + async def resend_request_emails( + self, + resource_group_name: str, + certificate_order_name: str, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> None: + """Verify domain ownership for this certificate order. + + Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name_identifier: Email address. + :type name_identifier: ~azure.mgmt.web.v2015_08_01.models.NameIdentifier + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.resend_request_emails.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + 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 [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, {}) + + resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} # type: ignore + + async def retrieve_site_seal( + self, + resource_group_name: str, + certificate_order_name: str, + site_seal_request: "models.SiteSealRequest", + **kwargs + ) -> "models.SiteSeal": + """Verify domain ownership for this certificate order. + + Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param site_seal_request: Site seal request. + :type site_seal_request: ~azure.mgmt.web.v2015_08_01.models.SiteSealRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSeal, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.SiteSeal + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.retrieve_site_seal.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteSeal', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} # type: ignore + + async def verify_domain_ownership( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Verify domain ownership for this certificate order. + + Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.verify_domain_ownership.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} # type: ignore + + async def retrieve_certificate_actions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.CertificateOrderAction"]: + """Retrieve the list of certificate actions. + + Retrieve the list of certificate actions. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate order. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateOrderAction, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2015_08_01.models.CertificateOrderAction] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.retrieve_certificate_actions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[CertificateOrderAction]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} # type: ignore + + async def retrieve_certificate_email_history( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.CertificateEmail"]: + """Retrieve email history. + + Retrieve email history. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate order. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateEmail, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2015_08_01.models.CertificateEmail] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[CertificateEmail]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py new file mode 100644 index 000000000000..f863a5b700c6 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificateRegistrationProviderOperations: + """CertificateRegistrationProviderOperations 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.web.v2015_08_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 + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2015_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/__init__.py index 325f9d716c75..cfd51a6bc689 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/__init__.py @@ -1,255 +1,105 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from ._models_py3 import ApiDefinitionInfo from ._models_py3 import AppServiceCertificate + from ._models_py3 import AppServiceCertificateCollection from ._models_py3 import AppServiceCertificateOrder + from ._models_py3 import AppServiceCertificateOrderCollection from ._models_py3 import AppServiceCertificateOrderPatchResource from ._models_py3 import AppServiceCertificatePatchResource from ._models_py3 import AppServiceCertificateResource - from ._models_py3 import AppServicePlan - from ._models_py3 import AutoHealActions - from ._models_py3 import AutoHealCustomAction - from ._models_py3 import AutoHealRules - from ._models_py3 import AutoHealTriggers - from ._models_py3 import Capability from ._models_py3 import CertificateDetails from ._models_py3 import CertificateEmail from ._models_py3 import CertificateOrderAction - from ._models_py3 import CloningInfo - from ._models_py3 import ConnStringInfo - from ._models_py3 import CorsSettings + from ._models_py3 import CsmOperationCollection from ._models_py3 import CsmOperationDescription from ._models_py3 import CsmOperationDescriptionProperties from ._models_py3 import CsmOperationDisplay from ._models_py3 import Dimension - from ._models_py3 import Experiments - from ._models_py3 import HandlerMapping - from ._models_py3 import HostingEnvironmentProfile - from ._models_py3 import HostNameSslState - from ._models_py3 import HybridConnection - from ._models_py3 import HybridConnectionKey - from ._models_py3 import Identifier - from ._models_py3 import IpSecurityRestriction - from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MetricAvailability from ._models_py3 import MetricSpecification from ._models_py3 import NameIdentifier - from ._models_py3 import NameValuePair from ._models_py3 import ProxyOnlyResource - from ._models_py3 import PushSettings - from ._models_py3 import RampUpRule from ._models_py3 import ReissueCertificateOrderRequest from ._models_py3 import RenewCertificateOrderRequest - from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource - from ._models_py3 import ResourceMetricAvailability - from ._models_py3 import ResourceMetricDefinition - from ._models_py3 import ResourceMetricName from ._models_py3 import ServiceSpecification - from ._models_py3 import Site - from ._models_py3 import SiteConfig - from ._models_py3 import SiteLimits - from ._models_py3 import SiteMachineKey from ._models_py3 import SiteSeal from ._models_py3 import SiteSealRequest - from ._models_py3 import SkuCapacity - from ._models_py3 import SkuDescription - from ._models_py3 import SlotSwapStatus - from ._models_py3 import SlowRequestsBasedTrigger - from ._models_py3 import SnapshotRecoveryRequest - from ._models_py3 import SnapshotRecoveryTarget - from ._models_py3 import StatusCodesBasedTrigger - from ._models_py3 import User - from ._models_py3 import VirtualApplication - from ._models_py3 import VirtualDirectory - from ._models_py3 import VnetGateway - from ._models_py3 import VnetInfo - from ._models_py3 import VnetRoute except (SyntaxError, ImportError): - from ._models import ApiDefinitionInfo - from ._models import AppServiceCertificate - from ._models import AppServiceCertificateOrder - from ._models import AppServiceCertificateOrderPatchResource - from ._models import AppServiceCertificatePatchResource - from ._models import AppServiceCertificateResource - from ._models import AppServicePlan - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import Capability - from ._models import CertificateDetails - from ._models import CertificateEmail - from ._models import CertificateOrderAction - from ._models import CloningInfo - from ._models import ConnStringInfo - from ._models import CorsSettings - from ._models import CsmOperationDescription - from ._models import CsmOperationDescriptionProperties - from ._models import CsmOperationDisplay - from ._models import Dimension - from ._models import Experiments - from ._models import HandlerMapping - from ._models import HostingEnvironmentProfile - from ._models import HostNameSslState - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import Identifier - from ._models import IpSecurityRestriction - from ._models import ManagedServiceIdentity - from ._models import MetricAvailability - from ._models import MetricSpecification - from ._models import NameIdentifier - from ._models import NameValuePair - from ._models import ProxyOnlyResource - from ._models import PushSettings - from ._models import RampUpRule - from ._models import ReissueCertificateOrderRequest - from ._models import RenewCertificateOrderRequest - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import ResourceMetricName - from ._models import ServiceSpecification - from ._models import Site - from ._models import SiteConfig - from ._models import SiteLimits - from ._models import SiteMachineKey - from ._models import SiteSeal - from ._models import SiteSealRequest - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import SnapshotRecoveryRequest - from ._models import SnapshotRecoveryTarget - from ._models import StatusCodesBasedTrigger - from ._models import User - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetRoute -from ._paged_models import AppServiceCertificateOrderPaged -from ._paged_models import AppServiceCertificateResourcePaged -from ._paged_models import CsmOperationDescriptionPaged + from ._models import AppServiceCertificate # type: ignore + from ._models import AppServiceCertificateCollection # type: ignore + from ._models import AppServiceCertificateOrder # type: ignore + from ._models import AppServiceCertificateOrderCollection # type: ignore + from ._models import AppServiceCertificateOrderPatchResource # type: ignore + from ._models import AppServiceCertificatePatchResource # type: ignore + from ._models import AppServiceCertificateResource # type: ignore + from ._models import CertificateDetails # type: ignore + from ._models import CertificateEmail # type: ignore + from ._models import CertificateOrderAction # type: ignore + from ._models import CsmOperationCollection # type: ignore + from ._models import CsmOperationDescription # type: ignore + from ._models import CsmOperationDescriptionProperties # type: ignore + from ._models import CsmOperationDisplay # type: ignore + from ._models import Dimension # type: ignore + from ._models import MetricAvailability # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NameIdentifier # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import ReissueCertificateOrderRequest # type: ignore + from ._models import RenewCertificateOrderRequest # type: ignore + from ._models import Resource # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import SiteSeal # type: ignore + from ._models import SiteSealRequest # type: ignore + from ._web_site_management_client_enums import ( - KeyVaultSecretStatus, + AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem, + AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem, + CertificateOrderActionType, + CertificateOrderStatus, CertificateProductType, + KeyVaultSecretStatus, ProvisioningState, - CertificateOrderStatus, - CertificateOrderActionType, - RouteType, - ManagedServiceIdentityType, - AutoHealActionType, - ConnectionStringType, - ScmType, - ManagedPipelineMode, - SiteLoadBalancing, - SupportedTlsVersions, - SslState, - HostType, - UsageState, - SiteAvailabilityState, - StatusOptions, ) __all__ = [ - 'ApiDefinitionInfo', 'AppServiceCertificate', + 'AppServiceCertificateCollection', 'AppServiceCertificateOrder', + 'AppServiceCertificateOrderCollection', 'AppServiceCertificateOrderPatchResource', 'AppServiceCertificatePatchResource', 'AppServiceCertificateResource', - 'AppServicePlan', - 'AutoHealActions', - 'AutoHealCustomAction', - 'AutoHealRules', - 'AutoHealTriggers', - 'Capability', 'CertificateDetails', 'CertificateEmail', 'CertificateOrderAction', - 'CloningInfo', - 'ConnStringInfo', - 'CorsSettings', + 'CsmOperationCollection', 'CsmOperationDescription', 'CsmOperationDescriptionProperties', 'CsmOperationDisplay', 'Dimension', - 'Experiments', - 'HandlerMapping', - 'HostingEnvironmentProfile', - 'HostNameSslState', - 'HybridConnection', - 'HybridConnectionKey', - 'Identifier', - 'IpSecurityRestriction', - 'ManagedServiceIdentity', 'MetricAvailability', 'MetricSpecification', 'NameIdentifier', - 'NameValuePair', 'ProxyOnlyResource', - 'PushSettings', - 'RampUpRule', 'ReissueCertificateOrderRequest', 'RenewCertificateOrderRequest', - 'RequestsBasedTrigger', 'Resource', - 'ResourceMetricAvailability', - 'ResourceMetricDefinition', - 'ResourceMetricName', 'ServiceSpecification', - 'Site', - 'SiteConfig', - 'SiteLimits', - 'SiteMachineKey', 'SiteSeal', 'SiteSealRequest', - 'SkuCapacity', - 'SkuDescription', - 'SlotSwapStatus', - 'SlowRequestsBasedTrigger', - 'SnapshotRecoveryRequest', - 'SnapshotRecoveryTarget', - 'StatusCodesBasedTrigger', - 'User', - 'VirtualApplication', - 'VirtualDirectory', - 'VnetGateway', - 'VnetInfo', - 'VnetRoute', - 'AppServiceCertificateOrderPaged', - 'AppServiceCertificateResourcePaged', - 'CsmOperationDescriptionPaged', - 'KeyVaultSecretStatus', + 'AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem', + 'AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem', + 'CertificateOrderActionType', + 'CertificateOrderStatus', 'CertificateProductType', + 'KeyVaultSecretStatus', 'ProvisioningState', - 'CertificateOrderStatus', - 'CertificateOrderActionType', - 'RouteType', - 'ManagedServiceIdentityType', - 'AutoHealActionType', - 'ConnectionStringType', - 'ScmType', - 'ManagedPipelineMode', - 'SiteLoadBalancing', - 'SupportedTlsVersions', - 'SslState', - 'HostType', - 'UsageState', - 'SiteAvailabilityState', - 'StatusOptions', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models.py index 9e7cf0ed076d..6025dd1763b3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models.py @@ -1,51 +1,29 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import msrest.serialization -class ApiDefinitionInfo(Model): - """Information about the formal API definition for the app. - - :param url: The URL of the API definition. - :type url: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ApiDefinitionInfo, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - - -class AppServiceCertificate(Model): +class AppServiceCertificate(msrest.serialization.Model): """Key Vault container for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -55,21 +33,55 @@ class AppServiceCertificate(Model): _attribute_map = { 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificate, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) self.provisioning_state = None -class Resource(Model): +class AppServiceCertificateCollection(msrest.serialization.Model): + """Collection of certificate order certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceCertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -83,7 +95,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -103,12 +115,15 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.type = None self.tags = kwargs.get('tags', None) @@ -116,8 +131,7 @@ def __init__(self, **kwargs): class AppServiceCertificateOrder(Resource): """SSL certificate purchase order. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -131,63 +145,54 @@ class AppServiceCertificateOrder(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2015_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -197,7 +202,6 @@ class AppServiceCertificateOrder(Resource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -223,10 +227,10 @@ class AppServiceCertificateOrder(Resource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -239,7 +243,10 @@ class AppServiceCertificateOrder(Resource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateOrder, self).__init__(**kwargs) self.certificates = kwargs.get('certificates', None) self.distinguished_name = kwargs.get('distinguished_name', None) @@ -262,12 +269,42 @@ def __init__(self, **kwargs): self.next_auto_renewal_time_stamp = None -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class AppServiceCertificateOrderCollection(msrest.serialization.Model): + """Collection of certificate orders. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateOrder]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceCertificateOrderCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -292,7 +329,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -303,10 +343,7 @@ def __init__(self, **kwargs): class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): """ARM resource for a certificate order that is purchased through Azure. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -317,60 +354,51 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2015_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -379,7 +407,6 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -403,10 +430,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -419,7 +446,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateOrderPatchResource, self).__init__(**kwargs) self.certificates = kwargs.get('certificates', None) self.distinguished_name = kwargs.get('distinguished_name', None) @@ -443,11 +473,9 @@ def __init__(self, **kwargs): class AppServiceCertificatePatchResource(ProxyOnlyResource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -461,14 +489,12 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -485,10 +511,13 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificatePatchResource, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) @@ -496,11 +525,9 @@ def __init__(self, **kwargs): class AppServiceCertificateResource(Resource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -514,20 +541,18 @@ class AppServiceCertificateResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -547,281 +572,23 @@ class AppServiceCertificateResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateResource, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) self.provisioning_state = None -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2015_08_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param admin_site_name: App Service plan administration site. - :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2015_08_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, **kwargs): - super(AppServicePlan, self).__init__(**kwargs) - self.app_service_plan_name = kwargs.get('app_service_plan_name', None) - self.worker_tier_name = kwargs.get('worker_tier_name', None) - self.status = None - self.subscription = None - self.admin_site_name = kwargs.get('admin_site_name', None) - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = kwargs.get('per_site_scaling', False) - self.number_of_sites = None - self.is_spot = kwargs.get('is_spot', None) - self.spot_expiration_time = kwargs.get('spot_expiration_time', None) - self.resource_group = None - self.reserved = kwargs.get('reserved', False) - self.target_worker_count = kwargs.get('target_worker_count', None) - self.target_worker_size_id = kwargs.get('target_worker_size_id', None) - self.provisioning_state = None - self.sku = kwargs.get('sku', None) - - -class AutoHealActions(Model): - """Actions which to take by the auto-heal module when a rule is triggered. - - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2015_08_01.models.AutoHealActionType - :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2015_08_01.models.AutoHealCustomAction - :param min_process_execution_time: Minimum time the process must execute - before taking the action - :type min_process_execution_time: str - """ - - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, - 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, - 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AutoHealActions, self).__init__(**kwargs) - self.action_type = kwargs.get('action_type', None) - self.custom_action = kwargs.get('custom_action', None) - self.min_process_execution_time = kwargs.get('min_process_execution_time', None) - - -class AutoHealCustomAction(Model): - """Custom action to be executed - when an auto heal rule is triggered. - - :param exe: Executable to be run. - :type exe: str - :param parameters: Parameters for the executable. - :type parameters: str - """ - - _attribute_map = { - 'exe': {'key': 'exe', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AutoHealCustomAction, self).__init__(**kwargs) - self.exe = kwargs.get('exe', None) - self.parameters = kwargs.get('parameters', None) - - -class AutoHealRules(Model): - """Rules that can be defined for auto-heal. - - :param triggers: Conditions that describe when to execute the auto-heal - actions. - :type triggers: ~azure.mgmt.web.v2015_08_01.models.AutoHealTriggers - :param actions: Actions to be executed when a rule is triggered. - :type actions: ~azure.mgmt.web.v2015_08_01.models.AutoHealActions - """ - - _attribute_map = { - 'triggers': {'key': 'triggers', 'type': 'AutoHealTriggers'}, - 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, - } - - def __init__(self, **kwargs): - super(AutoHealRules, self).__init__(**kwargs) - self.triggers = kwargs.get('triggers', None) - self.actions = kwargs.get('actions', None) - - -class AutoHealTriggers(Model): - """Triggers for auto-heal. - - :param requests: A rule based on total requests. - :type requests: ~azure.mgmt.web.v2015_08_01.models.RequestsBasedTrigger - :param private_bytes_in_kb: A rule based on private bytes. - :type private_bytes_in_kb: int - :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2015_08_01.models.StatusCodesBasedTrigger] - :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2015_08_01.models.SlowRequestsBasedTrigger - """ - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'RequestsBasedTrigger'}, - 'private_bytes_in_kb': {'key': 'privateBytesInKB', 'type': 'int'}, - 'status_codes': {'key': 'statusCodes', 'type': '[StatusCodesBasedTrigger]'}, - 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, - } - - def __init__(self, **kwargs): - super(AutoHealTriggers, self).__init__(**kwargs) - self.requests = kwargs.get('requests', None) - self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) - self.status_codes = kwargs.get('status_codes', None) - self.slow_requests = kwargs.get('slow_requests', None) - - -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Capability, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - self.reason = kwargs.get('reason', None) - - -class CertificateDetails(Model): +class CertificateDetails(msrest.serialization.Model): """SSL certificate details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar version: Certificate Version. :vartype version: int @@ -832,9 +599,9 @@ class CertificateDetails(Model): :ivar subject: Certificate Subject. :vartype subject: str :ivar not_before: Date Certificate is valid from. - :vartype not_before: datetime + :vartype not_before: ~datetime.datetime :ivar not_after: Date Certificate is valid to. - :vartype not_after: datetime + :vartype not_after: ~datetime.datetime :ivar signature_algorithm: Certificate Signature algorithm. :vartype signature_algorithm: str :ivar issuer: Certificate Issuer. @@ -867,7 +634,10 @@ class CertificateDetails(Model): 'raw_data': {'key': 'rawData', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateDetails, self).__init__(**kwargs) self.version = None self.serial_number = None @@ -883,8 +653,7 @@ def __init__(self, **kwargs): class CertificateEmail(ProxyOnlyResource): """SSL certificate email. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -897,7 +666,7 @@ class CertificateEmail(ProxyOnlyResource): :param email_id: Email id. :type email_id: str :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime """ _validation = { @@ -915,7 +684,10 @@ class CertificateEmail(ProxyOnlyResource): 'time_stamp': {'key': 'properties.timeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateEmail, self).__init__(**kwargs) self.email_id = kwargs.get('email_id', None) self.time_stamp = kwargs.get('time_stamp', None) @@ -924,8 +696,7 @@ def __init__(self, **kwargs): class CertificateOrderAction(ProxyOnlyResource): """Certificate order action. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -935,16 +706,15 @@ class CertificateOrderAction(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param certificate_order_action_type: Action type. Possible values - include: 'CertificateIssued', 'CertificateOrderCanceled', - 'CertificateOrderCreated', 'CertificateRevoked', - 'DomainValidationComplete', 'FraudDetected', 'OrgNameChange', - 'OrgValidationComplete', 'SanDrop', 'FraudCleared', 'CertificateExpired', - 'CertificateExpirationWarning', 'FraudDocumentationRequired', 'Unknown' - :type certificate_order_action_type: str or + :param type_properties_type: Action type. Possible values include: "CertificateIssued", + "CertificateOrderCanceled", "CertificateOrderCreated", "CertificateRevoked", + "DomainValidationComplete", "FraudDetected", "OrgNameChange", "OrgValidationComplete", + "SanDrop", "FraudCleared", "CertificateExpired", "CertificateExpirationWarning", + "FraudDocumentationRequired", "Unknown". + :type type_properties_type: str or ~azure.mgmt.web.v2015_08_01.models.CertificateOrderActionType :param created_at: Time at which the certificate action was performed. - :type created_at: datetime + :type created_at: ~datetime.datetime """ _validation = { @@ -958,161 +728,62 @@ class CertificateOrderAction(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'certificate_order_action_type': {'key': 'properties.type', 'type': 'CertificateOrderActionType'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOrderAction, self).__init__(**kwargs) - self.certificate_order_action_type = kwargs.get('certificate_order_action_type', None) + self.type_properties_type = kwargs.get('type_properties_type', None) self.created_at = kwargs.get('created_at', None) -class CloningInfo(Model): - """Information needed for cloning operation. +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations - together to use the same snapshot. - :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. - :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. - :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. - :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type source_web_app_id: str - :param hosting_environment: App Service Environment. - :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. - :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. - :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. - :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. - :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. - :type ignore_quotas: bool + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_08_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'source_web_app_id': {'required': True}, - } - - _attribute_map = { - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'overwrite': {'key': 'overwrite', 'type': 'bool'}, - 'clone_custom_host_names': {'key': 'cloneCustomHostNames', 'type': 'bool'}, - 'clone_source_control': {'key': 'cloneSourceControl', 'type': 'bool'}, - 'source_web_app_id': {'key': 'sourceWebAppId', 'type': 'str'}, - 'hosting_environment': {'key': 'hostingEnvironment', 'type': 'str'}, - 'app_settings_overrides': {'key': 'appSettingsOverrides', 'type': '{str}'}, - 'configure_load_balancing': {'key': 'configureLoadBalancing', 'type': 'bool'}, - 'traffic_manager_profile_id': {'key': 'trafficManagerProfileId', 'type': 'str'}, - 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, - 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(CloningInfo, self).__init__(**kwargs) - self.correlation_id = kwargs.get('correlation_id', None) - self.overwrite = kwargs.get('overwrite', None) - self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) - self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) - self.hosting_environment = kwargs.get('hosting_environment', None) - self.app_settings_overrides = kwargs.get('app_settings_overrides', None) - self.configure_load_balancing = kwargs.get('configure_load_balancing', None) - self.traffic_manager_profile_id = kwargs.get('traffic_manager_profile_id', None) - self.traffic_manager_profile_name = kwargs.get('traffic_manager_profile_name', None) - self.ignore_quotas = kwargs.get('ignore_quotas', None) - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): - """Database connection string information. - - :param name: Name of connection string. - :type name: str - :param connection_string: Connection string value. - :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' - :type type: str or ~azure.mgmt.web.v2015_08_01.models.ConnectionStringType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } - def __init__(self, **kwargs): - super(ConnStringInfo, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.connection_string = kwargs.get('connection_string', None) - self.type = kwargs.get('type', None) - - -class CorsSettings(Model): - """Cross-Origin Resource Sharing (CORS) settings for the app. - - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin - calls (for example: http://example.com:12345). Use "*" to allow all. - :type allowed_origins: list[str] - """ - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(CorsSettings, self).__init__(**kwargs) - self.allowed_origins = kwargs.get('allowed_origins', None) + def __init__( + self, + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class CsmOperationDescription(Model): +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2015_08_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2015_08_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2015_08_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -1122,7 +793,10 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1130,24 +804,27 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2015_08_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2015_08_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -1167,7 +844,10 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1175,10 +855,9 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -1197,7 +876,10 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1205,127 +887,127 @@ def __init__(self, **kwargs): self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class Experiments(Model): - """Routing rules in production experiments. - - :param ramp_up_rules: List of ramp-up rules. - :type ramp_up_rules: list[~azure.mgmt.web.v2015_08_01.models.RampUpRule] - """ - - _attribute_map = { - 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, - } +class MetricAvailability(msrest.serialization.Model): + """Retention policy of a resource metric. - def __init__(self, **kwargs): - super(Experiments, self).__init__(**kwargs) - self.ramp_up_rules = kwargs.get('ramp_up_rules', None) - - -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. - - :param extension: Requests with this extension will be handled using the - specified FastCGI application. - :type extension: str - :param script_processor: The absolute path to the FastCGI application. - :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. - :type arguments: str + :param time_grain: + :type time_grain: str + :param blob_duration: + :type blob_duration: str """ _attribute_map = { - 'extension': {'key': 'extension', 'type': 'str'}, - 'script_processor': {'key': 'scriptProcessor', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': 'str'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): - super(HandlerMapping, self).__init__(**kwargs) - self.extension = kwargs.get('extension', None) - self.script_processor = kwargs.get('script_processor', None) - self.arguments = kwargs.get('arguments', None) - + def __init__( + self, + **kwargs + ): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.blob_duration = kwargs.get('blob_duration', None) -class HostingEnvironmentProfile(Model): - """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. +class MetricSpecification(msrest.serialization.Model): + """Definition of a single resource metric. - :param id: Resource ID of the App Service Environment. - :type id: str - :ivar name: Name of the App Service Environment. - :vartype name: str - :ivar type: Resource type of the App Service Environment. - :vartype type: str + :param name: + :type name: str + :param display_name: + :type display_name: str + :param display_description: + :type display_description: str + :param unit: + :type unit: str + :param aggregation_type: + :type aggregation_type: str + :param supports_instance_level_aggregation: + :type supports_instance_level_aggregation: bool + :param enable_regional_mdm_account: + :type enable_regional_mdm_account: bool + :param source_mdm_account: + :type source_mdm_account: str + :param source_mdm_namespace: + :type source_mdm_namespace: str + :param metric_filter_pattern: + :type metric_filter_pattern: str + :param fill_gap_with_zero: + :type fill_gap_with_zero: bool + :param is_internal: + :type is_internal: bool + :param dimensions: + :type dimensions: list[~azure.mgmt.web.v2015_08_01.models.Dimension] + :param category: + :type category: str + :param availabilities: + :type availabilities: list[~azure.mgmt.web.v2015_08_01.models.MetricAvailability] """ - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supports_instance_level_aggregation': {'key': 'supportsInstanceLevelAggregation', 'type': 'bool'}, + 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'is_internal': {'key': 'isInternal', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'category': {'key': 'category', 'type': 'str'}, + 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, **kwargs): - super(HostingEnvironmentProfile, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = None - self.type = None + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supports_instance_level_aggregation = kwargs.get('supports_instance_level_aggregation', None) + self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) + self.source_mdm_account = kwargs.get('source_mdm_account', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) + self.metric_filter_pattern = kwargs.get('metric_filter_pattern', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.is_internal = kwargs.get('is_internal', None) + self.dimensions = kwargs.get('dimensions', None) + self.category = kwargs.get('category', None) + self.availabilities = kwargs.get('availabilities', None) -class HostNameSslState(Model): - """SSL-enabled hostname. +class NameIdentifier(msrest.serialization.Model): + """Identifies an object. - :param name: Hostname. + :param name: Name of the object. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' - :type ssl_state: str or ~azure.mgmt.web.v2015_08_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. - :type virtual_ip: str - :param thumbprint: SSL certificate thumbprint. - :type thumbprint: str - :param to_update: Set to true to update existing hostname. - :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' - :type host_type: str or ~azure.mgmt.web.v2015_08_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, - 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, } - def __init__(self, **kwargs): - super(HostNameSslState, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(NameIdentifier, self).__init__(**kwargs) self.name = kwargs.get('name', None) - self.ssl_state = kwargs.get('ssl_state', None) - self.virtual_ip = kwargs.get('virtual_ip', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.to_update = kwargs.get('to_update', None) - self.host_type = kwargs.get('host_type', None) -class HybridConnection(ProxyOnlyResource): - """Hybrid Connection contract. This is used to configure a Hybrid Connection. +class ReissueCertificateOrderRequest(ProxyOnlyResource): + """Class representing certificate reissue request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1335,26 +1017,16 @@ class HybridConnection(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param service_bus_namespace: The name of the Service Bus namespace. - :type service_bus_namespace: str - :param relay_name: The name of the Service Bus relay. - :type relay_name: str - :param relay_arm_uri: The ARM URI to the Service Bus relay. - :type relay_arm_uri: str - :param hostname: The hostname of the endpoint. - :type hostname: str - :param port: The port of the endpoint. - :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. - :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned - normally, use the POST /listKeys API instead. - :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net - :type service_bus_suffix: str + :param key_size: Certificate Key Size. + :type key_size: int + :param delay_existing_revoke_in_hours: Delay in hours to revoke existing certificate after the + new certificate is issued. + :type delay_existing_revoke_in_hours: int + :param csr: Csr to be used for re-key operation. + :type csr: str + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). + :type is_private_key_external: bool """ _validation = { @@ -1368,34 +1040,27 @@ class HybridConnection(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'service_bus_namespace': {'key': 'properties.serviceBusNamespace', 'type': 'str'}, - 'relay_name': {'key': 'properties.relayName', 'type': 'str'}, - 'relay_arm_uri': {'key': 'properties.relayArmUri', 'type': 'str'}, - 'hostname': {'key': 'properties.hostname', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'delay_existing_revoke_in_hours': {'key': 'properties.delayExistingRevokeInHours', 'type': 'int'}, + 'csr': {'key': 'properties.csr', 'type': 'str'}, + 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, **kwargs): - super(HybridConnection, self).__init__(**kwargs) - self.service_bus_namespace = kwargs.get('service_bus_namespace', None) - self.relay_name = kwargs.get('relay_name', None) - self.relay_arm_uri = kwargs.get('relay_arm_uri', None) - self.hostname = kwargs.get('hostname', None) - self.port = kwargs.get('port', None) - self.send_key_name = kwargs.get('send_key_name', None) - self.send_key_value = kwargs.get('send_key_value', None) - self.service_bus_suffix = kwargs.get('service_bus_suffix', None) + def __init__( + self, + **kwargs + ): + super(ReissueCertificateOrderRequest, self).__init__(**kwargs) + self.key_size = kwargs.get('key_size', None) + self.delay_existing_revoke_in_hours = kwargs.get('delay_existing_revoke_in_hours', None) + self.csr = kwargs.get('csr', None) + self.is_private_key_external = kwargs.get('is_private_key_external', None) -class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. +class RenewCertificateOrderRequest(ProxyOnlyResource): + """Class representing certificate renew request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1405,18 +1070,19 @@ class HybridConnectionKey(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar send_key_name: The name of the send key. - :vartype send_key_name: str - :ivar send_key_value: The value of the send key. - :vartype send_key_value: str + :param key_size: Certificate Key Size. + :type key_size: int + :param csr: Csr to be used for re-key operation. + :type csr: str + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). + :type is_private_key_external: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'send_key_name': {'readonly': True}, - 'send_key_value': {'readonly': True}, } _attribute_map = { @@ -1424,1143 +1090,46 @@ class HybridConnectionKey(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'csr': {'key': 'properties.csr', 'type': 'str'}, + 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, **kwargs): - super(HybridConnectionKey, self).__init__(**kwargs) - self.send_key_name = None - self.send_key_value = None - - -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) - - -class IpSecurityRestriction(Model): - """IP security restriction on an app. - - All required parameters must be populated in order to send to Azure. - - :param ip_address: Required. IP address the security restriction is valid - for. - :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. - :type subnet_mask: str - """ - - _validation = { - 'ip_address': {'required': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = kwargs.get('ip_address', None) - self.subnet_mask = kwargs.get('subnet_mask', None) - - -class ManagedServiceIdentity(Model): - """Managed service identity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2015_08_01.models.ManagedServiceIdentityType - :ivar tenant_id: Tenant of managed service identity. - :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. - :vartype principal_id: str - """ - - _validation = { - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.tenant_id = None - self.principal_id = None - - -class MetricAvailability(Model): - """Retention policy of a resource metric. - - :param time_grain: - :type time_grain: str - :param blob_duration: - :type blob_duration: str - """ - - _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(MetricAvailability, self).__init__(**kwargs) - self.time_grain = kwargs.get('time_grain', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class MetricSpecification(Model): - """Definition of a single resource metric. - - :param name: - :type name: str - :param display_name: - :type display_name: str - :param display_description: - :type display_description: str - :param unit: - :type unit: str - :param aggregation_type: - :type aggregation_type: str - :param supports_instance_level_aggregation: - :type supports_instance_level_aggregation: bool - :param enable_regional_mdm_account: - :type enable_regional_mdm_account: bool - :param source_mdm_account: - :type source_mdm_account: str - :param source_mdm_namespace: - :type source_mdm_namespace: str - :param metric_filter_pattern: - :type metric_filter_pattern: str - :param fill_gap_with_zero: - :type fill_gap_with_zero: bool - :param is_internal: - :type is_internal: bool - :param dimensions: - :type dimensions: list[~azure.mgmt.web.v2015_08_01.models.Dimension] - :param category: - :type category: str - :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2015_08_01.models.MetricAvailability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supports_instance_level_aggregation': {'key': 'supportsInstanceLevelAggregation', 'type': 'bool'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'is_internal': {'key': 'isInternal', 'type': 'bool'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'category': {'key': 'category', 'type': 'str'}, - 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, - } - - def __init__(self, **kwargs): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supports_instance_level_aggregation = kwargs.get('supports_instance_level_aggregation', None) - self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) - self.source_mdm_account = kwargs.get('source_mdm_account', None) - self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) - self.metric_filter_pattern = kwargs.get('metric_filter_pattern', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.is_internal = kwargs.get('is_internal', None) - self.dimensions = kwargs.get('dimensions', None) - self.category = kwargs.get('category', None) - self.availabilities = kwargs.get('availabilities', None) - - -class NameIdentifier(Model): - """Identifies an object. - - :param name: Name of the object. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(NameIdentifier, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class NameValuePair(Model): - """Name value pair. - - :param name: Pair name. - :type name: str - :param value: Pair value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(NameValuePair, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class PushSettings(ProxyOnlyResource): - """Push settings for the App. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. - :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. - :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. - Tags can consist of alphanumeric characters and the following: - '_', '@', '#', '.', ':', '-'. - Validation should be performed at the PushRequestHandler. - :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. - :type dynamic_tags_json: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'is_push_enabled': {'key': 'properties.isPushEnabled', 'type': 'bool'}, - 'tag_whitelist_json': {'key': 'properties.tagWhitelistJson', 'type': 'str'}, - 'tags_requiring_auth': {'key': 'properties.tagsRequiringAuth', 'type': 'str'}, - 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PushSettings, self).__init__(**kwargs) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) - self.tags_requiring_auth = kwargs.get('tags_requiring_auth', None) - self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) - - -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. - - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. - :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. - :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. - :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. - :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. - :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. - :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ - :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. - :type name: str - """ - - _attribute_map = { - 'action_host_name': {'key': 'actionHostName', 'type': 'str'}, - 'reroute_percentage': {'key': 'reroutePercentage', 'type': 'float'}, - 'change_step': {'key': 'changeStep', 'type': 'float'}, - 'change_interval_in_minutes': {'key': 'changeIntervalInMinutes', 'type': 'int'}, - 'min_reroute_percentage': {'key': 'minReroutePercentage', 'type': 'float'}, - 'max_reroute_percentage': {'key': 'maxReroutePercentage', 'type': 'float'}, - 'change_decision_callback_url': {'key': 'changeDecisionCallbackUrl', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(RampUpRule, self).__init__(**kwargs) - self.action_host_name = kwargs.get('action_host_name', None) - self.reroute_percentage = kwargs.get('reroute_percentage', None) - self.change_step = kwargs.get('change_step', None) - self.change_interval_in_minutes = kwargs.get('change_interval_in_minutes', None) - self.min_reroute_percentage = kwargs.get('min_reroute_percentage', None) - self.max_reroute_percentage = kwargs.get('max_reroute_percentage', None) - self.change_decision_callback_url = kwargs.get('change_decision_callback_url', None) - self.name = kwargs.get('name', None) - - -class ReissueCertificateOrderRequest(ProxyOnlyResource): - """Class representing certificate reissue request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param key_size: Certificate Key Size. - :type key_size: int - :param delay_existing_revoke_in_hours: Delay in hours to revoke existing - certificate after the new certificate is issued. - :type delay_existing_revoke_in_hours: int - :param csr: Csr to be used for re-key operation. - :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). - :type is_private_key_external: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'delay_existing_revoke_in_hours': {'key': 'properties.delayExistingRevokeInHours', 'type': 'int'}, - 'csr': {'key': 'properties.csr', 'type': 'str'}, - 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(ReissueCertificateOrderRequest, self).__init__(**kwargs) - self.key_size = kwargs.get('key_size', None) - self.delay_existing_revoke_in_hours = kwargs.get('delay_existing_revoke_in_hours', None) - self.csr = kwargs.get('csr', None) - self.is_private_key_external = kwargs.get('is_private_key_external', None) - - -class RenewCertificateOrderRequest(ProxyOnlyResource): - """Class representing certificate renew request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param key_size: Certificate Key Size. - :type key_size: int - :param csr: Csr to be used for re-key operation. - :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). - :type is_private_key_external: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'csr': {'key': 'properties.csr', 'type': 'str'}, - 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(RenewCertificateOrderRequest, self).__init__(**kwargs) - self.key_size = kwargs.get('key_size', None) - self.csr = kwargs.get('csr', None) - self.is_private_key_external = kwargs.get('is_private_key_external', None) - - -class RequestsBasedTrigger(Model): - """Trigger based on total requests. - - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(RequestsBasedTrigger, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class ResourceMetricAvailability(Model): - """Metrics availability and retention. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar time_grain: Time grain . - :vartype time_grain: str - :ivar retention: Retention period for the current time grain. - :vartype retention: str - """ - - _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, - } - - _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ResourceMetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None - - -class ResourceMetricDefinition(ProxyOnlyResource): - """Metadata for the metrics. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2015_08_01.models.ResourceMetricName - :ivar unit: Unit of the metric. - :vartype unit: str - :ivar primary_aggregation_type: Primary aggregation type. - :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2015_08_01.models.ResourceMetricAvailability] - :ivar resource_uri: Resource URI. - :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str - :ivar properties: Resource metric definition properties. - :vartype properties: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, - 'unit': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'metric_availabilities': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, - 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, - 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, - 'properties': {'key': 'properties.properties', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(ResourceMetricDefinition, self).__init__(**kwargs) - self.resource_metric_definition_name = None - self.unit = None - self.primary_aggregation_type = None - self.metric_availabilities = None - self.resource_uri = None - self.resource_metric_definition_id = None - self.properties = None - - -class ResourceMetricName(Model): - """Name of a metric for any resource . - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: metric name value. - :vartype value: str - :ivar localized_value: Localized metric name value. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ResourceMetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class ServiceSpecification(Model): - """Resource metrics service provided by Microsoft.Insights resource provider. - - :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2015_08_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__(self, **kwargs): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Site(Resource): - """A web app, a mobile app backend, or an API app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :ivar state: Current state of the app. - :vartype state: str - :ivar host_names: Hostnames associated with the app. - :vartype host_names: list[str] - :ivar repository_site_name: Name of the repository site. - :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' - :vartype usage_state: str or ~azure.mgmt.web.v2015_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). - :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, - the app is not served on those hostnames. - :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2015_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2015_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: - "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". - :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . - :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime - :param site_config: Configuration of the app. - :type site_config: ~azure.mgmt.web.v2015_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. - :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . - :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. - :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. - :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. - :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. - :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. - :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. - :vartype possible_outbound_ip_addresses: str - :param container_size: Size of the function container. - :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). - :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime - :ivar max_number_of_workers: Maximum number of workers. - This only applies to Functions container. - :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. - :type cloning_info: ~azure.mgmt.web.v2015_08_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2015_08_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. - :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. - :vartype is_default_container: bool - :ivar default_host_name: Default hostname of the app. Read-only. - :vartype default_host_name: str - :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2015_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests - :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2015_08_01.models.ManagedServiceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'host_names': {'readonly': True}, - 'repository_site_name': {'readonly': True}, - 'usage_state': {'readonly': True}, - 'enabled_host_names': {'readonly': True}, - 'availability_state': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'traffic_manager_host_names': {'readonly': True}, - 'target_swap_slot': {'readonly': True}, - 'outbound_ip_addresses': {'readonly': True}, - 'possible_outbound_ip_addresses': {'readonly': True}, - 'suspended_till': {'readonly': True}, - 'max_number_of_workers': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'is_default_container': {'readonly': True}, - 'default_host_name': {'readonly': True}, - 'slot_swap_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, - 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, - 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, - 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, - 'site_config': {'key': 'properties.siteConfig', 'type': 'SiteConfig'}, - 'traffic_manager_host_names': {'key': 'properties.trafficManagerHostNames', 'type': '[str]'}, - 'scm_site_also_stopped': {'key': 'properties.scmSiteAlsoStopped', 'type': 'bool'}, - 'target_swap_slot': {'key': 'properties.targetSwapSlot', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'client_affinity_enabled': {'key': 'properties.clientAffinityEnabled', 'type': 'bool'}, - 'client_cert_enabled': {'key': 'properties.clientCertEnabled', 'type': 'bool'}, - 'host_names_disabled': {'key': 'properties.hostNamesDisabled', 'type': 'bool'}, - 'outbound_ip_addresses': {'key': 'properties.outboundIpAddresses', 'type': 'str'}, - 'possible_outbound_ip_addresses': {'key': 'properties.possibleOutboundIpAddresses', 'type': 'str'}, - 'container_size': {'key': 'properties.containerSize', 'type': 'int'}, - 'daily_memory_time_quota': {'key': 'properties.dailyMemoryTimeQuota', 'type': 'int'}, - 'suspended_till': {'key': 'properties.suspendedTill', 'type': 'iso-8601'}, - 'max_number_of_workers': {'key': 'properties.maxNumberOfWorkers', 'type': 'int'}, - 'cloning_info': {'key': 'properties.cloningInfo', 'type': 'CloningInfo'}, - 'snapshot_info': {'key': 'properties.snapshotInfo', 'type': 'SnapshotRecoveryRequest'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'is_default_container': {'key': 'properties.isDefaultContainer', 'type': 'bool'}, - 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, - 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, - 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - } - - def __init__(self, **kwargs): - super(Site, self).__init__(**kwargs) - self.state = None - self.host_names = None - self.repository_site_name = None - self.usage_state = None - self.enabled = kwargs.get('enabled', None) - self.enabled_host_names = None - self.availability_state = None - self.host_name_ssl_states = kwargs.get('host_name_ssl_states', None) - self.server_farm_id = kwargs.get('server_farm_id', None) - self.reserved = kwargs.get('reserved', False) - self.last_modified_time_utc = None - self.site_config = kwargs.get('site_config', None) - self.traffic_manager_host_names = None - self.scm_site_also_stopped = kwargs.get('scm_site_also_stopped', False) - self.target_swap_slot = None - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.client_affinity_enabled = kwargs.get('client_affinity_enabled', None) - self.client_cert_enabled = kwargs.get('client_cert_enabled', None) - self.host_names_disabled = kwargs.get('host_names_disabled', None) - self.outbound_ip_addresses = None - self.possible_outbound_ip_addresses = None - self.container_size = kwargs.get('container_size', None) - self.daily_memory_time_quota = kwargs.get('daily_memory_time_quota', None) - self.suspended_till = None - self.max_number_of_workers = None - self.cloning_info = kwargs.get('cloning_info', None) - self.snapshot_info = kwargs.get('snapshot_info', None) - self.resource_group = None - self.is_default_container = None - self.default_host_name = None - self.slot_swap_status = None - self.https_only = kwargs.get('https_only', None) - self.identity = kwargs.get('identity', None) - - -class SiteConfig(Model): - """Configuration of an App Service app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param number_of_workers: Number of workers. - :type number_of_workers: int - :param default_documents: Default documents. - :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . - :type net_framework_version: str - :param php_version: Version of PHP. - :type php_version: str - :param python_version: Version of Python. - :type python_version: str - :param node_version: Version of Node.js. - :type node_version: str - :param linux_fx_version: Linux App Framework and version - :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. - :type request_tracing_enabled: bool - :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. - :type remote_debugging_enabled: bool - :param remote_debugging_version: Remote debugging version. - :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. - :type http_logging_enabled: bool - :param logs_directory_size_limit: HTTP logs directory size limit. - :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. - :type detailed_error_logging_enabled: bool - :param publishing_username: Publishing user name. - :type publishing_username: str - :param app_settings: Application settings. - :type app_settings: list[~azure.mgmt.web.v2015_08_01.models.NameValuePair] - :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2015_08_01.models.ConnStringInfo] - :ivar machine_key: Site MachineKey. - :vartype machine_key: ~azure.mgmt.web.v2015_08_01.models.SiteMachineKey - :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2015_08_01.models.HandlerMapping] - :param document_root: Document root. - :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' - :type scm_type: str or ~azure.mgmt.web.v2015_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. - :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. - :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. - :type always_on: bool - :param java_version: Java version. - :type java_version: str - :param java_container: Java container. - :type java_container: str - :param java_container_version: Java container version. - :type java_container_version: str - :param app_command_line: App command line to launch. - :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2015_08_01.models.ManagedPipelineMode - :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2015_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2015_08_01.models.SiteLoadBalancing - :param experiments: This is work around for polymorphic types. - :type experiments: ~azure.mgmt.web.v2015_08_01.models.Experiments - :param limits: Site limits. - :type limits: ~azure.mgmt.web.v2015_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. - :type auto_heal_enabled: bool - :param auto_heal_rules: Auto Heal rules. - :type auto_heal_rules: ~azure.mgmt.web.v2015_08_01.models.AutoHealRules - :param tracing_options: Tracing options. - :type tracing_options: str - :param vnet_name: Virtual Network name. - :type vnet_name: str - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.web.v2015_08_01.models.CorsSettings - :param push: Push endpoint settings. - :type push: ~azure.mgmt.web.v2015_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. - :type api_definition: ~azure.mgmt.web.v2015_08_01.models.ApiDefinitionInfo - :param auto_swap_slot_name: Auto-swap slot name. - :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . - :type local_my_sql_enabled: bool - :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2015_08_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . - :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2015_08_01.models.SupportedTlsVersions - """ - - _validation = { - 'machine_key': {'readonly': True}, - } - - _attribute_map = { - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'default_documents': {'key': 'defaultDocuments', 'type': '[str]'}, - 'net_framework_version': {'key': 'netFrameworkVersion', 'type': 'str'}, - 'php_version': {'key': 'phpVersion', 'type': 'str'}, - 'python_version': {'key': 'pythonVersion', 'type': 'str'}, - 'node_version': {'key': 'nodeVersion', 'type': 'str'}, - 'linux_fx_version': {'key': 'linuxFxVersion', 'type': 'str'}, - 'request_tracing_enabled': {'key': 'requestTracingEnabled', 'type': 'bool'}, - 'request_tracing_expiration_time': {'key': 'requestTracingExpirationTime', 'type': 'iso-8601'}, - 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, - 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, - 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, - 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, - 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, - 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, - 'app_settings': {'key': 'appSettings', 'type': '[NameValuePair]'}, - 'connection_strings': {'key': 'connectionStrings', 'type': '[ConnStringInfo]'}, - 'machine_key': {'key': 'machineKey', 'type': 'SiteMachineKey'}, - 'handler_mappings': {'key': 'handlerMappings', 'type': '[HandlerMapping]'}, - 'document_root': {'key': 'documentRoot', 'type': 'str'}, - 'scm_type': {'key': 'scmType', 'type': 'str'}, - 'use32_bit_worker_process': {'key': 'use32BitWorkerProcess', 'type': 'bool'}, - 'web_sockets_enabled': {'key': 'webSocketsEnabled', 'type': 'bool'}, - 'always_on': {'key': 'alwaysOn', 'type': 'bool'}, - 'java_version': {'key': 'javaVersion', 'type': 'str'}, - 'java_container': {'key': 'javaContainer', 'type': 'str'}, - 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, - 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, - 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, - 'experiments': {'key': 'experiments', 'type': 'Experiments'}, - 'limits': {'key': 'limits', 'type': 'SiteLimits'}, - 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, - 'auto_heal_rules': {'key': 'autoHealRules', 'type': 'AutoHealRules'}, - 'tracing_options': {'key': 'tracingOptions', 'type': 'str'}, - 'vnet_name': {'key': 'vnetName', 'type': 'str'}, - 'cors': {'key': 'cors', 'type': 'CorsSettings'}, - 'push': {'key': 'push', 'type': 'PushSettings'}, - 'api_definition': {'key': 'apiDefinition', 'type': 'ApiDefinitionInfo'}, - 'auto_swap_slot_name': {'key': 'autoSwapSlotName', 'type': 'str'}, - 'local_my_sql_enabled': {'key': 'localMySqlEnabled', 'type': 'bool'}, - 'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'http20_enabled': {'key': 'http20Enabled', 'type': 'bool'}, - 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SiteConfig, self).__init__(**kwargs) - self.number_of_workers = kwargs.get('number_of_workers', None) - self.default_documents = kwargs.get('default_documents', None) - self.net_framework_version = kwargs.get('net_framework_version', "v4.6") - self.php_version = kwargs.get('php_version', None) - self.python_version = kwargs.get('python_version', None) - self.node_version = kwargs.get('node_version', None) - self.linux_fx_version = kwargs.get('linux_fx_version', None) - self.request_tracing_enabled = kwargs.get('request_tracing_enabled', None) - self.request_tracing_expiration_time = kwargs.get('request_tracing_expiration_time', None) - self.remote_debugging_enabled = kwargs.get('remote_debugging_enabled', None) - self.remote_debugging_version = kwargs.get('remote_debugging_version', None) - self.http_logging_enabled = kwargs.get('http_logging_enabled', None) - self.logs_directory_size_limit = kwargs.get('logs_directory_size_limit', None) - self.detailed_error_logging_enabled = kwargs.get('detailed_error_logging_enabled', None) - self.publishing_username = kwargs.get('publishing_username', None) - self.app_settings = kwargs.get('app_settings', None) - self.connection_strings = kwargs.get('connection_strings', None) - self.machine_key = None - self.handler_mappings = kwargs.get('handler_mappings', None) - self.document_root = kwargs.get('document_root', None) - self.scm_type = kwargs.get('scm_type', None) - self.use32_bit_worker_process = kwargs.get('use32_bit_worker_process', None) - self.web_sockets_enabled = kwargs.get('web_sockets_enabled', None) - self.always_on = kwargs.get('always_on', None) - self.java_version = kwargs.get('java_version', None) - self.java_container = kwargs.get('java_container', None) - self.java_container_version = kwargs.get('java_container_version', None) - self.app_command_line = kwargs.get('app_command_line', None) - self.managed_pipeline_mode = kwargs.get('managed_pipeline_mode', None) - self.virtual_applications = kwargs.get('virtual_applications', None) - self.load_balancing = kwargs.get('load_balancing', None) - self.experiments = kwargs.get('experiments', None) - self.limits = kwargs.get('limits', None) - self.auto_heal_enabled = kwargs.get('auto_heal_enabled', None) - self.auto_heal_rules = kwargs.get('auto_heal_rules', None) - self.tracing_options = kwargs.get('tracing_options', None) - self.vnet_name = kwargs.get('vnet_name', None) - self.cors = kwargs.get('cors', None) - self.push = kwargs.get('push', None) - self.api_definition = kwargs.get('api_definition', None) - self.auto_swap_slot_name = kwargs.get('auto_swap_slot_name', None) - self.local_my_sql_enabled = kwargs.get('local_my_sql_enabled', False) - self.ip_security_restrictions = kwargs.get('ip_security_restrictions', None) - self.http20_enabled = kwargs.get('http20_enabled', True) - self.min_tls_version = kwargs.get('min_tls_version', None) - - -class SiteLimits(Model): - """Metric limits set on an app. - - :param max_percentage_cpu: Maximum allowed CPU usage percentage. - :type max_percentage_cpu: float - :param max_memory_in_mb: Maximum allowed memory usage in MB. - :type max_memory_in_mb: long - :param max_disk_size_in_mb: Maximum allowed disk size usage in MB. - :type max_disk_size_in_mb: long - """ - - _attribute_map = { - 'max_percentage_cpu': {'key': 'maxPercentageCpu', 'type': 'float'}, - 'max_memory_in_mb': {'key': 'maxMemoryInMb', 'type': 'long'}, - 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, - } - - def __init__(self, **kwargs): - super(SiteLimits, self).__init__(**kwargs) - self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) - self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) - self.max_disk_size_in_mb = kwargs.get('max_disk_size_in_mb', None) + def __init__( + self, + **kwargs + ): + super(RenewCertificateOrderRequest, self).__init__(**kwargs) + self.key_size = kwargs.get('key_size', None) + self.csr = kwargs.get('csr', None) + self.is_private_key_external = kwargs.get('is_private_key_external', None) -class SiteMachineKey(Model): - """MachineKey of an app. +class ServiceSpecification(msrest.serialization.Model): + """Resource metrics service provided by Microsoft.Insights resource provider. - :param validation: MachineKey validation. - :type validation: str - :param validation_key: Validation key. - :type validation_key: str - :param decryption: Algorithm used for decryption. - :type decryption: str - :param decryption_key: Decryption key. - :type decryption_key: str + :param metric_specifications: + :type metric_specifications: list[~azure.mgmt.web.v2015_08_01.models.MetricSpecification] """ _attribute_map = { - 'validation': {'key': 'validation', 'type': 'str'}, - 'validation_key': {'key': 'validationKey', 'type': 'str'}, - 'decryption': {'key': 'decryption', 'type': 'str'}, - 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): - super(SiteMachineKey, self).__init__(**kwargs) - self.validation = kwargs.get('validation', None) - self.validation_key = kwargs.get('validation_key', None) - self.decryption = kwargs.get('decryption', None) - self.decryption_key = kwargs.get('decryption_key', None) + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) -class SiteSeal(Model): +class SiteSeal(msrest.serialization.Model): """Site seal. All required parameters must be populated in order to send to Azure. - :param html: Required. HTML snippet + :param html: Required. HTML snippet. :type html: str """ @@ -2572,16 +1141,19 @@ class SiteSeal(Model): 'html': {'key': 'html', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSeal, self).__init__(**kwargs) - self.html = kwargs.get('html', None) + self.html = kwargs['html'] -class SiteSealRequest(Model): +class SiteSealRequest(msrest.serialization.Model): """Site seal request. - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. + :param light_theme: If :code:`true` use the light color theme for site seal; + otherwise, use the default color theme. :type light_theme: bool :param locale: Locale of site seal. :type locale: str @@ -2592,535 +1164,10 @@ class SiteSealRequest(Model): 'locale': {'key': 'locale', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSealRequest, self).__init__(**kwargs) self.light_theme = kwargs.get('light_theme', None) self.locale = kwargs.get('locale', None) - - -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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, **kwargs): - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) - self.maximum = kwargs.get('maximum', None) - self.default = kwargs.get('default', None) - self.scale_type = kwargs.get('scale_type', None) - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2015_08_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2015_08_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, **kwargs): - super(SkuDescription, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - self.sku_capacity = kwargs.get('sku_capacity', None) - self.locations = kwargs.get('locations', None) - self.capabilities = kwargs.get('capabilities', None) - - -class SlotSwapStatus(Model): - """The status of the last successful slot swap operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime - :ivar source_slot_name: The source slot of the last swap operation. - :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. - :vartype destination_slot_name: str - """ - - _validation = { - 'timestamp_utc': {'readonly': True}, - 'source_slot_name': {'readonly': True}, - 'destination_slot_name': {'readonly': True}, - } - - _attribute_map = { - 'timestamp_utc': {'key': 'timestampUtc', 'type': 'iso-8601'}, - 'source_slot_name': {'key': 'sourceSlotName', 'type': 'str'}, - 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SlotSwapStatus, self).__init__(**kwargs) - self.timestamp_utc = None - self.source_slot_name = None - self.destination_slot_name = None - - -class SlowRequestsBasedTrigger(Model): - """Trigger based on request execution time. - - :param time_taken: Time taken. - :type time_taken: str - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'time_taken': {'key': 'timeTaken', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SlowRequestsBasedTrigger, self).__init__(**kwargs) - self.time_taken = kwargs.get('time_taken', None) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class SnapshotRecoveryRequest(ProxyOnlyResource): - """Details about app recovery operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. - :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2015_08_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. - :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. - :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. - This setting is only necessary when RecoverConfiguration is enabled. - :type ignore_conflicting_host_names: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'overwrite': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'str'}, - 'recovery_target': {'key': 'properties.recoveryTarget', 'type': 'SnapshotRecoveryTarget'}, - 'overwrite': {'key': 'properties.overwrite', 'type': 'bool'}, - 'recover_configuration': {'key': 'properties.recoverConfiguration', 'type': 'bool'}, - 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(SnapshotRecoveryRequest, self).__init__(**kwargs) - self.snapshot_time = kwargs.get('snapshot_time', None) - self.recovery_target = kwargs.get('recovery_target', None) - self.overwrite = kwargs.get('overwrite', None) - self.recover_configuration = kwargs.get('recover_configuration', None) - self.ignore_conflicting_host_names = kwargs.get('ignore_conflicting_host_names', None) - - -class SnapshotRecoveryTarget(Model): - """Specifies the web app that snapshot contents will be written to. - - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS - :type location: str - :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type id: str - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SnapshotRecoveryTarget, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = kwargs.get('id', None) - - -class StatusCodesBasedTrigger(Model): - """Trigger based on status code. - - :param status: HTTP status code. - :type status: int - :param sub_status: Request Sub Status. - :type sub_status: int - :param win32_status: Win32 error code. - :type win32_status: int - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'int'}, - 'sub_status': {'key': 'subStatus', 'type': 'int'}, - 'win32_status': {'key': 'win32Status', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(StatusCodesBasedTrigger, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.sub_status = kwargs.get('sub_status', None) - self.win32_status = kwargs.get('win32_status', None) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class User(ProxyOnlyResource): - """User credentials used for publishing activity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param user_name: Username - :type user_name: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.name', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(User, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.publishing_user_name = kwargs.get('publishing_user_name', None) - self.publishing_password = kwargs.get('publishing_password', None) - self.publishing_password_hash = kwargs.get('publishing_password_hash', None) - self.publishing_password_hash_salt = kwargs.get('publishing_password_hash_salt', None) - - -class VirtualApplication(Model): - """Virtual application in an app. - - :param virtual_path: Virtual path. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. - :type preload_enabled: bool - :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2015_08_01.models.VirtualDirectory] - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - 'preload_enabled': {'key': 'preloadEnabled', 'type': 'bool'}, - 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, - } - - def __init__(self, **kwargs): - super(VirtualApplication, self).__init__(**kwargs) - self.virtual_path = kwargs.get('virtual_path', None) - self.physical_path = kwargs.get('physical_path', None) - self.preload_enabled = kwargs.get('preload_enabled', None) - self.virtual_directories = kwargs.get('virtual_directories', None) - - -class VirtualDirectory(Model): - """Directory for virtual application. - - :param virtual_path: Path to virtual application. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VirtualDirectory, self).__init__(**kwargs) - self.virtual_path = kwargs.get('virtual_path', None) - self.physical_path = kwargs.get('physical_path', None) - - -class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_name: The Virtual Network name. - :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. - :type vpn_package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, - 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetGateway, self).__init__(**kwargs) - self.vnet_name = kwargs.get('vnet_name', None) - self.vpn_package_uri = kwargs.get('vpn_package_uri', None) - - -class VnetInfo(ProxyOnlyResource): - """Virtual Network information contract. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_resource_id: The Virtual Network's resource ID. - :type vnet_resource_id: str - :ivar cert_thumbprint: The client certificate thumbprint. - :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a - Point-To-Site VPN connection. - :type cert_blob: bytearray - :ivar routes: The routes that this Virtual Network connection uses. - :vartype routes: list[~azure.mgmt.web.v2015_08_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. - :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. - :type dns_servers: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'cert_thumbprint': {'readonly': True}, - 'routes': {'readonly': True}, - 'resync_required': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_resource_id': {'key': 'properties.vnetResourceId', 'type': 'str'}, - 'cert_thumbprint': {'key': 'properties.certThumbprint', 'type': 'str'}, - 'cert_blob': {'key': 'properties.certBlob', 'type': 'bytearray'}, - 'routes': {'key': 'properties.routes', 'type': '[VnetRoute]'}, - 'resync_required': {'key': 'properties.resyncRequired', 'type': 'bool'}, - 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetInfo, self).__init__(**kwargs) - self.vnet_resource_id = kwargs.get('vnet_resource_id', None) - self.cert_thumbprint = None - self.cert_blob = kwargs.get('cert_blob', None) - self.routes = None - self.resync_required = None - self.dns_servers = kwargs.get('dns_servers', None) - - -class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. - :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. - :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. - :type end_address: str - :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 - INHERITED - Routes inherited from the real Virtual Network routes - STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' - :type route_type: str or ~azure.mgmt.web.v2015_08_01.models.RouteType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_route_name': {'key': 'properties.name', 'type': 'str'}, - 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, - 'end_address': {'key': 'properties.endAddress', 'type': 'str'}, - 'route_type': {'key': 'properties.routeType', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetRoute, self).__init__(**kwargs) - self.vnet_route_name = kwargs.get('vnet_route_name', None) - self.start_address = kwargs.get('start_address', None) - self.end_address = kwargs.get('end_address', None) - self.route_type = kwargs.get('route_type', None) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models_py3.py index 72f7a806ea27..5563ed10db26 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_models_py3.py @@ -1,51 +1,34 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import datetime +from typing import Dict, List, Optional, Union +import msrest.serialization -class ApiDefinitionInfo(Model): - """Information about the formal API definition for the app. +from ._web_site_management_client_enums import * - :param url: The URL of the API definition. - :type url: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - def __init__(self, *, url: str=None, **kwargs) -> None: - super(ApiDefinitionInfo, self).__init__(**kwargs) - self.url = url - - -class AppServiceCertificate(Model): +class AppServiceCertificate(msrest.serialization.Model): """Key Vault container for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -55,21 +38,60 @@ class AppServiceCertificate(Model): _attribute_map = { 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } - def __init__(self, *, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificate, self).__init__(**kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name self.provisioning_state = None -class Resource(Model): +class AppServiceCertificateCollection(msrest.serialization.Model): + """Collection of certificate order certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceCertificateResource"], + **kwargs + ): + super(AppServiceCertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -83,7 +105,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -103,7 +125,14 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -116,8 +145,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> Non class AppServiceCertificateOrder(Resource): """SSL certificate purchase order. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -131,63 +159,54 @@ class AppServiceCertificateOrder(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2015_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -197,7 +216,6 @@ class AppServiceCertificateOrder(Resource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -223,10 +241,10 @@ class AppServiceCertificateOrder(Resource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -239,7 +257,21 @@ class AppServiceCertificateOrder(Resource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, product_type, kind: str=None, tags=None, certificates=None, distinguished_name: str=None, validity_in_years: int=1, key_size: int=2048, auto_renew: bool=True, csr: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + certificates: Optional[Dict[str, "AppServiceCertificate"]] = None, + distinguished_name: Optional[str] = None, + validity_in_years: Optional[int] = 1, + key_size: Optional[int] = 2048, + product_type: Optional[Union[str, "CertificateProductType"]] = None, + auto_renew: Optional[bool] = True, + csr: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateOrder, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.certificates = certificates self.distinguished_name = distinguished_name @@ -262,12 +294,44 @@ def __init__(self, *, location: str, product_type, kind: str=None, tags=None, ce self.next_auto_renewal_time_stamp = None -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class AppServiceCertificateOrderCollection(msrest.serialization.Model): + """Collection of certificate orders. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateOrder]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceCertificateOrder"], + **kwargs + ): + super(AppServiceCertificateOrderCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -292,7 +356,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -303,10 +372,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): """ARM resource for a certificate order that is purchased through Azure. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -317,60 +383,51 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2015_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2015_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2015_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2015_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -379,7 +436,6 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -403,10 +459,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -419,7 +475,19 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, product_type, kind: str=None, certificates=None, distinguished_name: str=None, validity_in_years: int=1, key_size: int=2048, auto_renew: bool=True, csr: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + certificates: Optional[Dict[str, "AppServiceCertificate"]] = None, + distinguished_name: Optional[str] = None, + validity_in_years: Optional[int] = 1, + key_size: Optional[int] = 2048, + product_type: Optional[Union[str, "CertificateProductType"]] = None, + auto_renew: Optional[bool] = True, + csr: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateOrderPatchResource, self).__init__(kind=kind, **kwargs) self.certificates = certificates self.distinguished_name = distinguished_name @@ -443,11 +511,9 @@ def __init__(self, *, product_type, kind: str=None, certificates=None, distingui class AppServiceCertificatePatchResource(ProxyOnlyResource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -461,14 +527,12 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -485,10 +549,17 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, kind: str=None, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificatePatchResource, self).__init__(kind=kind, **kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name @@ -496,11 +567,9 @@ def __init__(self, *, kind: str=None, key_vault_id: str=None, key_vault_secret_n class AppServiceCertificateResource(Resource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -514,20 +583,18 @@ class AppServiceCertificateResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2015_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -547,281 +614,29 @@ class AppServiceCertificateResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name self.provisioning_state = None -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2015_08_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param admin_site_name: App Service plan administration site. - :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2015_08_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2015_08_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, tags=None, worker_tier_name: str=None, admin_site_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, is_spot: bool=None, spot_expiration_time=None, reserved: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: - super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_plan_name = app_service_plan_name - self.worker_tier_name = worker_tier_name - self.status = None - self.subscription = None - self.admin_site_name = admin_site_name - self.hosting_environment_profile = hosting_environment_profile - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = per_site_scaling - self.number_of_sites = None - self.is_spot = is_spot - self.spot_expiration_time = spot_expiration_time - self.resource_group = None - self.reserved = reserved - self.target_worker_count = target_worker_count - self.target_worker_size_id = target_worker_size_id - self.provisioning_state = None - self.sku = sku - - -class AutoHealActions(Model): - """Actions which to take by the auto-heal module when a rule is triggered. - - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2015_08_01.models.AutoHealActionType - :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2015_08_01.models.AutoHealCustomAction - :param min_process_execution_time: Minimum time the process must execute - before taking the action - :type min_process_execution_time: str - """ - - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, - 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, - 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, - } - - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: - super(AutoHealActions, self).__init__(**kwargs) - self.action_type = action_type - self.custom_action = custom_action - self.min_process_execution_time = min_process_execution_time - - -class AutoHealCustomAction(Model): - """Custom action to be executed - when an auto heal rule is triggered. - - :param exe: Executable to be run. - :type exe: str - :param parameters: Parameters for the executable. - :type parameters: str - """ - - _attribute_map = { - 'exe': {'key': 'exe', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: - super(AutoHealCustomAction, self).__init__(**kwargs) - self.exe = exe - self.parameters = parameters - - -class AutoHealRules(Model): - """Rules that can be defined for auto-heal. - - :param triggers: Conditions that describe when to execute the auto-heal - actions. - :type triggers: ~azure.mgmt.web.v2015_08_01.models.AutoHealTriggers - :param actions: Actions to be executed when a rule is triggered. - :type actions: ~azure.mgmt.web.v2015_08_01.models.AutoHealActions - """ - - _attribute_map = { - 'triggers': {'key': 'triggers', 'type': 'AutoHealTriggers'}, - 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, - } - - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: - super(AutoHealRules, self).__init__(**kwargs) - self.triggers = triggers - self.actions = actions - - -class AutoHealTriggers(Model): - """Triggers for auto-heal. - - :param requests: A rule based on total requests. - :type requests: ~azure.mgmt.web.v2015_08_01.models.RequestsBasedTrigger - :param private_bytes_in_kb: A rule based on private bytes. - :type private_bytes_in_kb: int - :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2015_08_01.models.StatusCodesBasedTrigger] - :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2015_08_01.models.SlowRequestsBasedTrigger - """ - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'RequestsBasedTrigger'}, - 'private_bytes_in_kb': {'key': 'privateBytesInKB', 'type': 'int'}, - 'status_codes': {'key': 'statusCodes', 'type': '[StatusCodesBasedTrigger]'}, - 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, - } - - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: - super(AutoHealTriggers, self).__init__(**kwargs) - self.requests = requests - self.private_bytes_in_kb = private_bytes_in_kb - self.status_codes = status_codes - self.slow_requests = slow_requests - - -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: - super(Capability, self).__init__(**kwargs) - self.name = name - self.value = value - self.reason = reason - - -class CertificateDetails(Model): +class CertificateDetails(msrest.serialization.Model): """SSL certificate details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar version: Certificate Version. :vartype version: int @@ -832,9 +647,9 @@ class CertificateDetails(Model): :ivar subject: Certificate Subject. :vartype subject: str :ivar not_before: Date Certificate is valid from. - :vartype not_before: datetime + :vartype not_before: ~datetime.datetime :ivar not_after: Date Certificate is valid to. - :vartype not_after: datetime + :vartype not_after: ~datetime.datetime :ivar signature_algorithm: Certificate Signature algorithm. :vartype signature_algorithm: str :ivar issuer: Certificate Issuer. @@ -867,7 +682,10 @@ class CertificateDetails(Model): 'raw_data': {'key': 'rawData', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateDetails, self).__init__(**kwargs) self.version = None self.serial_number = None @@ -883,8 +701,7 @@ def __init__(self, **kwargs) -> None: class CertificateEmail(ProxyOnlyResource): """SSL certificate email. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -897,7 +714,7 @@ class CertificateEmail(ProxyOnlyResource): :param email_id: Email id. :type email_id: str :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime """ _validation = { @@ -915,7 +732,14 @@ class CertificateEmail(ProxyOnlyResource): 'time_stamp': {'key': 'properties.timeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, email_id: str=None, time_stamp=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + email_id: Optional[str] = None, + time_stamp: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateEmail, self).__init__(kind=kind, **kwargs) self.email_id = email_id self.time_stamp = time_stamp @@ -924,8 +748,7 @@ def __init__(self, *, kind: str=None, email_id: str=None, time_stamp=None, **kwa class CertificateOrderAction(ProxyOnlyResource): """Certificate order action. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -935,16 +758,15 @@ class CertificateOrderAction(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param certificate_order_action_type: Action type. Possible values - include: 'CertificateIssued', 'CertificateOrderCanceled', - 'CertificateOrderCreated', 'CertificateRevoked', - 'DomainValidationComplete', 'FraudDetected', 'OrgNameChange', - 'OrgValidationComplete', 'SanDrop', 'FraudCleared', 'CertificateExpired', - 'CertificateExpirationWarning', 'FraudDocumentationRequired', 'Unknown' - :type certificate_order_action_type: str or + :param type_properties_type: Action type. Possible values include: "CertificateIssued", + "CertificateOrderCanceled", "CertificateOrderCreated", "CertificateRevoked", + "DomainValidationComplete", "FraudDetected", "OrgNameChange", "OrgValidationComplete", + "SanDrop", "FraudCleared", "CertificateExpired", "CertificateExpirationWarning", + "FraudDocumentationRequired", "Unknown". + :type type_properties_type: str or ~azure.mgmt.web.v2015_08_01.models.CertificateOrderActionType :param created_at: Time at which the certificate action was performed. - :type created_at: datetime + :type created_at: ~datetime.datetime """ _validation = { @@ -958,161 +780,68 @@ class CertificateOrderAction(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'certificate_order_action_type': {'key': 'properties.type', 'type': 'CertificateOrderActionType'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, certificate_order_action_type=None, created_at=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + type_properties_type: Optional[Union[str, "CertificateOrderActionType"]] = None, + created_at: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateOrderAction, self).__init__(kind=kind, **kwargs) - self.certificate_order_action_type = certificate_order_action_type + self.type_properties_type = type_properties_type self.created_at = created_at -class CloningInfo(Model): - """Information needed for cloning operation. +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations - together to use the same snapshot. - :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. - :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. - :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. - :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type source_web_app_id: str - :param hosting_environment: App Service Environment. - :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. - :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. - :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. - :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. - :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. - :type ignore_quotas: bool + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2015_08_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'source_web_app_id': {'required': True}, - } - - _attribute_map = { - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'overwrite': {'key': 'overwrite', 'type': 'bool'}, - 'clone_custom_host_names': {'key': 'cloneCustomHostNames', 'type': 'bool'}, - 'clone_source_control': {'key': 'cloneSourceControl', 'type': 'bool'}, - 'source_web_app_id': {'key': 'sourceWebAppId', 'type': 'str'}, - 'hosting_environment': {'key': 'hostingEnvironment', 'type': 'str'}, - 'app_settings_overrides': {'key': 'appSettingsOverrides', 'type': '{str}'}, - 'configure_load_balancing': {'key': 'configureLoadBalancing', 'type': 'bool'}, - 'traffic_manager_profile_id': {'key': 'trafficManagerProfileId', 'type': 'str'}, - 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, - 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, - } - - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, ignore_quotas: bool=None, **kwargs) -> None: - super(CloningInfo, self).__init__(**kwargs) - self.correlation_id = correlation_id - self.overwrite = overwrite - self.clone_custom_host_names = clone_custom_host_names - self.clone_source_control = clone_source_control - self.source_web_app_id = source_web_app_id - self.hosting_environment = hosting_environment - self.app_settings_overrides = app_settings_overrides - self.configure_load_balancing = configure_load_balancing - self.traffic_manager_profile_id = traffic_manager_profile_id - self.traffic_manager_profile_name = traffic_manager_profile_name - self.ignore_quotas = ignore_quotas - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): - """Database connection string information. - - :param name: Name of connection string. - :type name: str - :param connection_string: Connection string value. - :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' - :type type: str or ~azure.mgmt.web.v2015_08_01.models.ConnectionStringType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: - super(ConnStringInfo, self).__init__(**kwargs) - self.name = name - self.connection_string = connection_string - self.type = type - - -class CorsSettings(Model): - """Cross-Origin Resource Sharing (CORS) settings for the app. - - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin - calls (for example: http://example.com:12345). Use "*" to allow all. - :type allowed_origins: list[str] - """ - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, allowed_origins=None, **kwargs) -> None: - super(CorsSettings, self).__init__(**kwargs) - self.allowed_origins = allowed_origins + def __init__( + self, + *, + value: List["CsmOperationDescription"], + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class CsmOperationDescription(Model): +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2015_08_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2015_08_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2015_08_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -1122,7 +851,15 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["CsmOperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["CsmOperationDescriptionProperties"] = None, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = name self.display = display @@ -1130,24 +867,29 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties self.properties = properties -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2015_08_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2015_08_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = service_specification -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -1167,7 +909,15 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1175,10 +925,9 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -1197,7 +946,15 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, internal_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1205,127 +962,148 @@ def __init__(self, *, name: str=None, display_name: str=None, internal_name: str self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class Experiments(Model): - """Routing rules in production experiments. - - :param ramp_up_rules: List of ramp-up rules. - :type ramp_up_rules: list[~azure.mgmt.web.v2015_08_01.models.RampUpRule] - """ - - _attribute_map = { - 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, - } +class MetricAvailability(msrest.serialization.Model): + """Retention policy of a resource metric. - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: - super(Experiments, self).__init__(**kwargs) - self.ramp_up_rules = ramp_up_rules - - -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. - - :param extension: Requests with this extension will be handled using the - specified FastCGI application. - :type extension: str - :param script_processor: The absolute path to the FastCGI application. - :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. - :type arguments: str + :param time_grain: + :type time_grain: str + :param blob_duration: + :type blob_duration: str """ _attribute_map = { - 'extension': {'key': 'extension', 'type': 'str'}, - 'script_processor': {'key': 'scriptProcessor', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': 'str'}, + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: - super(HandlerMapping, self).__init__(**kwargs) - self.extension = extension - self.script_processor = script_processor - self.arguments = arguments - + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.blob_duration = blob_duration -class HostingEnvironmentProfile(Model): - """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. +class MetricSpecification(msrest.serialization.Model): + """Definition of a single resource metric. - :param id: Resource ID of the App Service Environment. - :type id: str - :ivar name: Name of the App Service Environment. - :vartype name: str - :ivar type: Resource type of the App Service Environment. - :vartype type: str + :param name: + :type name: str + :param display_name: + :type display_name: str + :param display_description: + :type display_description: str + :param unit: + :type unit: str + :param aggregation_type: + :type aggregation_type: str + :param supports_instance_level_aggregation: + :type supports_instance_level_aggregation: bool + :param enable_regional_mdm_account: + :type enable_regional_mdm_account: bool + :param source_mdm_account: + :type source_mdm_account: str + :param source_mdm_namespace: + :type source_mdm_namespace: str + :param metric_filter_pattern: + :type metric_filter_pattern: str + :param fill_gap_with_zero: + :type fill_gap_with_zero: bool + :param is_internal: + :type is_internal: bool + :param dimensions: + :type dimensions: list[~azure.mgmt.web.v2015_08_01.models.Dimension] + :param category: + :type category: str + :param availabilities: + :type availabilities: list[~azure.mgmt.web.v2015_08_01.models.MetricAvailability] """ - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supports_instance_level_aggregation': {'key': 'supportsInstanceLevelAggregation', 'type': 'bool'}, + 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'is_internal': {'key': 'isInternal', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'category': {'key': 'category', 'type': 'str'}, + 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: - super(HostingEnvironmentProfile, self).__init__(**kwargs) - self.id = id - self.name = None - self.type = None + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supports_instance_level_aggregation: Optional[bool] = None, + enable_regional_mdm_account: Optional[bool] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + metric_filter_pattern: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + is_internal: Optional[bool] = None, + dimensions: Optional[List["Dimension"]] = None, + category: Optional[str] = None, + availabilities: Optional[List["MetricAvailability"]] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.supports_instance_level_aggregation = supports_instance_level_aggregation + self.enable_regional_mdm_account = enable_regional_mdm_account + self.source_mdm_account = source_mdm_account + self.source_mdm_namespace = source_mdm_namespace + self.metric_filter_pattern = metric_filter_pattern + self.fill_gap_with_zero = fill_gap_with_zero + self.is_internal = is_internal + self.dimensions = dimensions + self.category = category + self.availabilities = availabilities -class HostNameSslState(Model): - """SSL-enabled hostname. +class NameIdentifier(msrest.serialization.Model): + """Identifies an object. - :param name: Hostname. + :param name: Name of the object. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' - :type ssl_state: str or ~azure.mgmt.web.v2015_08_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. - :type virtual_ip: str - :param thumbprint: SSL certificate thumbprint. - :type thumbprint: str - :param to_update: Set to true to update existing hostname. - :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' - :type host_type: str or ~azure.mgmt.web.v2015_08_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, - 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, } - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: - super(HostNameSslState, self).__init__(**kwargs) + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(NameIdentifier, self).__init__(**kwargs) self.name = name - self.ssl_state = ssl_state - self.virtual_ip = virtual_ip - self.thumbprint = thumbprint - self.to_update = to_update - self.host_type = host_type -class HybridConnection(ProxyOnlyResource): - """Hybrid Connection contract. This is used to configure a Hybrid Connection. +class ReissueCertificateOrderRequest(ProxyOnlyResource): + """Class representing certificate reissue request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1335,26 +1113,16 @@ class HybridConnection(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param service_bus_namespace: The name of the Service Bus namespace. - :type service_bus_namespace: str - :param relay_name: The name of the Service Bus relay. - :type relay_name: str - :param relay_arm_uri: The ARM URI to the Service Bus relay. - :type relay_arm_uri: str - :param hostname: The hostname of the endpoint. - :type hostname: str - :param port: The port of the endpoint. - :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. - :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned - normally, use the POST /listKeys API instead. - :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net - :type service_bus_suffix: str + :param key_size: Certificate Key Size. + :type key_size: int + :param delay_existing_revoke_in_hours: Delay in hours to revoke existing certificate after the + new certificate is issued. + :type delay_existing_revoke_in_hours: int + :param csr: Csr to be used for re-key operation. + :type csr: str + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). + :type is_private_key_external: bool """ _validation = { @@ -1368,34 +1136,33 @@ class HybridConnection(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'service_bus_namespace': {'key': 'properties.serviceBusNamespace', 'type': 'str'}, - 'relay_name': {'key': 'properties.relayName', 'type': 'str'}, - 'relay_arm_uri': {'key': 'properties.relayArmUri', 'type': 'str'}, - 'hostname': {'key': 'properties.hostname', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'delay_existing_revoke_in_hours': {'key': 'properties.delayExistingRevokeInHours', 'type': 'int'}, + 'csr': {'key': 'properties.csr', 'type': 'str'}, + 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: - super(HybridConnection, self).__init__(kind=kind, **kwargs) - self.service_bus_namespace = service_bus_namespace - self.relay_name = relay_name - self.relay_arm_uri = relay_arm_uri - self.hostname = hostname - self.port = port - self.send_key_name = send_key_name - self.send_key_value = send_key_value - self.service_bus_suffix = service_bus_suffix + def __init__( + self, + *, + kind: Optional[str] = None, + key_size: Optional[int] = None, + delay_existing_revoke_in_hours: Optional[int] = None, + csr: Optional[str] = None, + is_private_key_external: Optional[bool] = None, + **kwargs + ): + super(ReissueCertificateOrderRequest, self).__init__(kind=kind, **kwargs) + self.key_size = key_size + self.delay_existing_revoke_in_hours = delay_existing_revoke_in_hours + self.csr = csr + self.is_private_key_external = is_private_key_external -class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. +class RenewCertificateOrderRequest(ProxyOnlyResource): + """Class representing certificate renew request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1405,1162 +1172,73 @@ class HybridConnectionKey(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar send_key_name: The name of the send key. - :vartype send_key_name: str - :ivar send_key_value: The value of the send key. - :vartype send_key_value: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'send_key_name': {'readonly': True}, - 'send_key_value': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) - self.send_key_name = None - self.send_key_value = None - - -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: - super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id - - -class IpSecurityRestriction(Model): - """IP security restriction on an app. - - All required parameters must be populated in order to send to Azure. - - :param ip_address: Required. IP address the security restriction is valid - for. - :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. - :type subnet_mask: str - """ - - _validation = { - 'ip_address': {'required': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, - } - - def __init__(self, *, ip_address: str, subnet_mask: str=None, **kwargs) -> None: - super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = ip_address - self.subnet_mask = subnet_mask - - -class ManagedServiceIdentity(Model): - """Managed service identity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2015_08_01.models.ManagedServiceIdentityType - :ivar tenant_id: Tenant of managed service identity. - :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. - :vartype principal_id: str - """ - - _validation = { - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__(self, *, type=None, **kwargs) -> None: - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.type = type - self.tenant_id = None - self.principal_id = None - - -class MetricAvailability(Model): - """Retention policy of a resource metric. - - :param time_grain: - :type time_grain: str - :param blob_duration: - :type blob_duration: str - """ - - _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__(self, *, time_grain: str=None, blob_duration: str=None, **kwargs) -> None: - super(MetricAvailability, self).__init__(**kwargs) - self.time_grain = time_grain - self.blob_duration = blob_duration - - -class MetricSpecification(Model): - """Definition of a single resource metric. - - :param name: - :type name: str - :param display_name: - :type display_name: str - :param display_description: - :type display_description: str - :param unit: - :type unit: str - :param aggregation_type: - :type aggregation_type: str - :param supports_instance_level_aggregation: - :type supports_instance_level_aggregation: bool - :param enable_regional_mdm_account: - :type enable_regional_mdm_account: bool - :param source_mdm_account: - :type source_mdm_account: str - :param source_mdm_namespace: - :type source_mdm_namespace: str - :param metric_filter_pattern: - :type metric_filter_pattern: str - :param fill_gap_with_zero: - :type fill_gap_with_zero: bool - :param is_internal: - :type is_internal: bool - :param dimensions: - :type dimensions: list[~azure.mgmt.web.v2015_08_01.models.Dimension] - :param category: - :type category: str - :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2015_08_01.models.MetricAvailability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supports_instance_level_aggregation': {'key': 'supportsInstanceLevelAggregation', 'type': 'bool'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'is_internal': {'key': 'isInternal', 'type': 'bool'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'category': {'key': 'category', 'type': 'str'}, - 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, - } - - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, supports_instance_level_aggregation: bool=None, enable_regional_mdm_account: bool=None, source_mdm_account: str=None, source_mdm_namespace: str=None, metric_filter_pattern: str=None, fill_gap_with_zero: bool=None, is_internal: bool=None, dimensions=None, category: str=None, availabilities=None, **kwargs) -> None: - super(MetricSpecification, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.aggregation_type = aggregation_type - self.supports_instance_level_aggregation = supports_instance_level_aggregation - self.enable_regional_mdm_account = enable_regional_mdm_account - self.source_mdm_account = source_mdm_account - self.source_mdm_namespace = source_mdm_namespace - self.metric_filter_pattern = metric_filter_pattern - self.fill_gap_with_zero = fill_gap_with_zero - self.is_internal = is_internal - self.dimensions = dimensions - self.category = category - self.availabilities = availabilities - - -class NameIdentifier(Model): - """Identifies an object. - - :param name: Name of the object. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, **kwargs) -> None: - super(NameIdentifier, self).__init__(**kwargs) - self.name = name - - -class NameValuePair(Model): - """Name value pair. - - :param name: Pair name. - :type name: str - :param value: Pair value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: - super(NameValuePair, self).__init__(**kwargs) - self.name = name - self.value = value - - -class PushSettings(ProxyOnlyResource): - """Push settings for the App. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. - :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. - :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. - Tags can consist of alphanumeric characters and the following: - '_', '@', '#', '.', ':', '-'. - Validation should be performed at the PushRequestHandler. - :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. - :type dynamic_tags_json: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'is_push_enabled': {'key': 'properties.isPushEnabled', 'type': 'bool'}, - 'tag_whitelist_json': {'key': 'properties.tagWhitelistJson', 'type': 'str'}, - 'tags_requiring_auth': {'key': 'properties.tagsRequiringAuth', 'type': 'str'}, - 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, - } - - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: - super(PushSettings, self).__init__(kind=kind, **kwargs) - self.is_push_enabled = is_push_enabled - self.tag_whitelist_json = tag_whitelist_json - self.tags_requiring_auth = tags_requiring_auth - self.dynamic_tags_json = dynamic_tags_json - - -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. - - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. - :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. - :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. - :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. - :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. - :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. - :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ - :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. - :type name: str - """ - - _attribute_map = { - 'action_host_name': {'key': 'actionHostName', 'type': 'str'}, - 'reroute_percentage': {'key': 'reroutePercentage', 'type': 'float'}, - 'change_step': {'key': 'changeStep', 'type': 'float'}, - 'change_interval_in_minutes': {'key': 'changeIntervalInMinutes', 'type': 'int'}, - 'min_reroute_percentage': {'key': 'minReroutePercentage', 'type': 'float'}, - 'max_reroute_percentage': {'key': 'maxReroutePercentage', 'type': 'float'}, - 'change_decision_callback_url': {'key': 'changeDecisionCallbackUrl', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: - super(RampUpRule, self).__init__(**kwargs) - self.action_host_name = action_host_name - self.reroute_percentage = reroute_percentage - self.change_step = change_step - self.change_interval_in_minutes = change_interval_in_minutes - self.min_reroute_percentage = min_reroute_percentage - self.max_reroute_percentage = max_reroute_percentage - self.change_decision_callback_url = change_decision_callback_url - self.name = name - - -class ReissueCertificateOrderRequest(ProxyOnlyResource): - """Class representing certificate reissue request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param key_size: Certificate Key Size. - :type key_size: int - :param delay_existing_revoke_in_hours: Delay in hours to revoke existing - certificate after the new certificate is issued. - :type delay_existing_revoke_in_hours: int - :param csr: Csr to be used for re-key operation. - :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). - :type is_private_key_external: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'delay_existing_revoke_in_hours': {'key': 'properties.delayExistingRevokeInHours', 'type': 'int'}, - 'csr': {'key': 'properties.csr', 'type': 'str'}, - 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, - } - - def __init__(self, *, kind: str=None, key_size: int=None, delay_existing_revoke_in_hours: int=None, csr: str=None, is_private_key_external: bool=None, **kwargs) -> None: - super(ReissueCertificateOrderRequest, self).__init__(kind=kind, **kwargs) - self.key_size = key_size - self.delay_existing_revoke_in_hours = delay_existing_revoke_in_hours - self.csr = csr - self.is_private_key_external = is_private_key_external - - -class RenewCertificateOrderRequest(ProxyOnlyResource): - """Class representing certificate renew request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param key_size: Certificate Key Size. - :type key_size: int - :param csr: Csr to be used for re-key operation. - :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). - :type is_private_key_external: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'csr': {'key': 'properties.csr', 'type': 'str'}, - 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, - } - - def __init__(self, *, kind: str=None, key_size: int=None, csr: str=None, is_private_key_external: bool=None, **kwargs) -> None: - super(RenewCertificateOrderRequest, self).__init__(kind=kind, **kwargs) - self.key_size = key_size - self.csr = csr - self.is_private_key_external = is_private_key_external - - -class RequestsBasedTrigger(Model): - """Trigger based on total requests. - - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: - super(RequestsBasedTrigger, self).__init__(**kwargs) - self.count = count - self.time_interval = time_interval - - -class ResourceMetricAvailability(Model): - """Metrics availability and retention. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar time_grain: Time grain . - :vartype time_grain: str - :ivar retention: Retention period for the current time grain. - :vartype retention: str - """ - - _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, - } - - _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(ResourceMetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None - - -class ResourceMetricDefinition(ProxyOnlyResource): - """Metadata for the metrics. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2015_08_01.models.ResourceMetricName - :ivar unit: Unit of the metric. - :vartype unit: str - :ivar primary_aggregation_type: Primary aggregation type. - :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2015_08_01.models.ResourceMetricAvailability] - :ivar resource_uri: Resource URI. - :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str - :ivar properties: Resource metric definition properties. - :vartype properties: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, - 'unit': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'metric_availabilities': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, - 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, - 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, - 'properties': {'key': 'properties.properties', 'type': '{str}'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) - self.resource_metric_definition_name = None - self.unit = None - self.primary_aggregation_type = None - self.metric_availabilities = None - self.resource_uri = None - self.resource_metric_definition_id = None - self.properties = None - - -class ResourceMetricName(Model): - """Name of a metric for any resource . - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: metric name value. - :vartype value: str - :ivar localized_value: Localized metric name value. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(ResourceMetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class ServiceSpecification(Model): - """Resource metrics service provided by Microsoft.Insights resource provider. - - :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2015_08_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__(self, *, metric_specifications=None, **kwargs) -> None: - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = metric_specifications - - -class Site(Resource): - """A web app, a mobile app backend, or an API app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :ivar state: Current state of the app. - :vartype state: str - :ivar host_names: Hostnames associated with the app. - :vartype host_names: list[str] - :ivar repository_site_name: Name of the repository site. - :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' - :vartype usage_state: str or ~azure.mgmt.web.v2015_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). - :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, - the app is not served on those hostnames. - :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2015_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2015_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: - "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". - :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . - :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime - :param site_config: Configuration of the app. - :type site_config: ~azure.mgmt.web.v2015_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. - :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . - :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. - :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2015_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. - :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. - :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. - :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. - :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. - :vartype possible_outbound_ip_addresses: str - :param container_size: Size of the function container. - :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). - :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime - :ivar max_number_of_workers: Maximum number of workers. - This only applies to Functions container. - :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. - :type cloning_info: ~azure.mgmt.web.v2015_08_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2015_08_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. - :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. - :vartype is_default_container: bool - :ivar default_host_name: Default hostname of the app. Read-only. - :vartype default_host_name: str - :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2015_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests - :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2015_08_01.models.ManagedServiceIdentity + :param key_size: Certificate Key Size. + :type key_size: int + :param csr: Csr to be used for re-key operation. + :type csr: str + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). + :type is_private_key_external: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, - 'location': {'required': True}, 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'host_names': {'readonly': True}, - 'repository_site_name': {'readonly': True}, - 'usage_state': {'readonly': True}, - 'enabled_host_names': {'readonly': True}, - 'availability_state': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'traffic_manager_host_names': {'readonly': True}, - 'target_swap_slot': {'readonly': True}, - 'outbound_ip_addresses': {'readonly': True}, - 'possible_outbound_ip_addresses': {'readonly': True}, - 'suspended_till': {'readonly': True}, - 'max_number_of_workers': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'is_default_container': {'readonly': True}, - 'default_host_name': {'readonly': True}, - 'slot_swap_status': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, - 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, - 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, - 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, - 'site_config': {'key': 'properties.siteConfig', 'type': 'SiteConfig'}, - 'traffic_manager_host_names': {'key': 'properties.trafficManagerHostNames', 'type': '[str]'}, - 'scm_site_also_stopped': {'key': 'properties.scmSiteAlsoStopped', 'type': 'bool'}, - 'target_swap_slot': {'key': 'properties.targetSwapSlot', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'client_affinity_enabled': {'key': 'properties.clientAffinityEnabled', 'type': 'bool'}, - 'client_cert_enabled': {'key': 'properties.clientCertEnabled', 'type': 'bool'}, - 'host_names_disabled': {'key': 'properties.hostNamesDisabled', 'type': 'bool'}, - 'outbound_ip_addresses': {'key': 'properties.outboundIpAddresses', 'type': 'str'}, - 'possible_outbound_ip_addresses': {'key': 'properties.possibleOutboundIpAddresses', 'type': 'str'}, - 'container_size': {'key': 'properties.containerSize', 'type': 'int'}, - 'daily_memory_time_quota': {'key': 'properties.dailyMemoryTimeQuota', 'type': 'int'}, - 'suspended_till': {'key': 'properties.suspendedTill', 'type': 'iso-8601'}, - 'max_number_of_workers': {'key': 'properties.maxNumberOfWorkers', 'type': 'int'}, - 'cloning_info': {'key': 'properties.cloningInfo', 'type': 'CloningInfo'}, - 'snapshot_info': {'key': 'properties.snapshotInfo', 'type': 'SnapshotRecoveryRequest'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'is_default_container': {'key': 'properties.isDefaultContainer', 'type': 'bool'}, - 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, - 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, - 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, snapshot_info=None, https_only: bool=None, identity=None, **kwargs) -> None: - super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.state = None - self.host_names = None - self.repository_site_name = None - self.usage_state = None - self.enabled = enabled - self.enabled_host_names = None - self.availability_state = None - self.host_name_ssl_states = host_name_ssl_states - self.server_farm_id = server_farm_id - self.reserved = reserved - self.last_modified_time_utc = None - self.site_config = site_config - self.traffic_manager_host_names = None - self.scm_site_also_stopped = scm_site_also_stopped - self.target_swap_slot = None - self.hosting_environment_profile = hosting_environment_profile - self.client_affinity_enabled = client_affinity_enabled - self.client_cert_enabled = client_cert_enabled - self.host_names_disabled = host_names_disabled - self.outbound_ip_addresses = None - self.possible_outbound_ip_addresses = None - self.container_size = container_size - self.daily_memory_time_quota = daily_memory_time_quota - self.suspended_till = None - self.max_number_of_workers = None - self.cloning_info = cloning_info - self.snapshot_info = snapshot_info - self.resource_group = None - self.is_default_container = None - self.default_host_name = None - self.slot_swap_status = None - self.https_only = https_only - self.identity = identity - - -class SiteConfig(Model): - """Configuration of an App Service app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param number_of_workers: Number of workers. - :type number_of_workers: int - :param default_documents: Default documents. - :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . - :type net_framework_version: str - :param php_version: Version of PHP. - :type php_version: str - :param python_version: Version of Python. - :type python_version: str - :param node_version: Version of Node.js. - :type node_version: str - :param linux_fx_version: Linux App Framework and version - :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. - :type request_tracing_enabled: bool - :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. - :type remote_debugging_enabled: bool - :param remote_debugging_version: Remote debugging version. - :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. - :type http_logging_enabled: bool - :param logs_directory_size_limit: HTTP logs directory size limit. - :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. - :type detailed_error_logging_enabled: bool - :param publishing_username: Publishing user name. - :type publishing_username: str - :param app_settings: Application settings. - :type app_settings: list[~azure.mgmt.web.v2015_08_01.models.NameValuePair] - :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2015_08_01.models.ConnStringInfo] - :ivar machine_key: Site MachineKey. - :vartype machine_key: ~azure.mgmt.web.v2015_08_01.models.SiteMachineKey - :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2015_08_01.models.HandlerMapping] - :param document_root: Document root. - :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' - :type scm_type: str or ~azure.mgmt.web.v2015_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. - :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. - :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. - :type always_on: bool - :param java_version: Java version. - :type java_version: str - :param java_container: Java container. - :type java_container: str - :param java_container_version: Java container version. - :type java_container_version: str - :param app_command_line: App command line to launch. - :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2015_08_01.models.ManagedPipelineMode - :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2015_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2015_08_01.models.SiteLoadBalancing - :param experiments: This is work around for polymorphic types. - :type experiments: ~azure.mgmt.web.v2015_08_01.models.Experiments - :param limits: Site limits. - :type limits: ~azure.mgmt.web.v2015_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. - :type auto_heal_enabled: bool - :param auto_heal_rules: Auto Heal rules. - :type auto_heal_rules: ~azure.mgmt.web.v2015_08_01.models.AutoHealRules - :param tracing_options: Tracing options. - :type tracing_options: str - :param vnet_name: Virtual Network name. - :type vnet_name: str - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.web.v2015_08_01.models.CorsSettings - :param push: Push endpoint settings. - :type push: ~azure.mgmt.web.v2015_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. - :type api_definition: ~azure.mgmt.web.v2015_08_01.models.ApiDefinitionInfo - :param auto_swap_slot_name: Auto-swap slot name. - :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . - :type local_my_sql_enabled: bool - :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2015_08_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . - :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2015_08_01.models.SupportedTlsVersions - """ - - _validation = { - 'machine_key': {'readonly': True}, - } - - _attribute_map = { - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'default_documents': {'key': 'defaultDocuments', 'type': '[str]'}, - 'net_framework_version': {'key': 'netFrameworkVersion', 'type': 'str'}, - 'php_version': {'key': 'phpVersion', 'type': 'str'}, - 'python_version': {'key': 'pythonVersion', 'type': 'str'}, - 'node_version': {'key': 'nodeVersion', 'type': 'str'}, - 'linux_fx_version': {'key': 'linuxFxVersion', 'type': 'str'}, - 'request_tracing_enabled': {'key': 'requestTracingEnabled', 'type': 'bool'}, - 'request_tracing_expiration_time': {'key': 'requestTracingExpirationTime', 'type': 'iso-8601'}, - 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, - 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, - 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, - 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, - 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, - 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, - 'app_settings': {'key': 'appSettings', 'type': '[NameValuePair]'}, - 'connection_strings': {'key': 'connectionStrings', 'type': '[ConnStringInfo]'}, - 'machine_key': {'key': 'machineKey', 'type': 'SiteMachineKey'}, - 'handler_mappings': {'key': 'handlerMappings', 'type': '[HandlerMapping]'}, - 'document_root': {'key': 'documentRoot', 'type': 'str'}, - 'scm_type': {'key': 'scmType', 'type': 'str'}, - 'use32_bit_worker_process': {'key': 'use32BitWorkerProcess', 'type': 'bool'}, - 'web_sockets_enabled': {'key': 'webSocketsEnabled', 'type': 'bool'}, - 'always_on': {'key': 'alwaysOn', 'type': 'bool'}, - 'java_version': {'key': 'javaVersion', 'type': 'str'}, - 'java_container': {'key': 'javaContainer', 'type': 'str'}, - 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, - 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, - 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, - 'experiments': {'key': 'experiments', 'type': 'Experiments'}, - 'limits': {'key': 'limits', 'type': 'SiteLimits'}, - 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, - 'auto_heal_rules': {'key': 'autoHealRules', 'type': 'AutoHealRules'}, - 'tracing_options': {'key': 'tracingOptions', 'type': 'str'}, - 'vnet_name': {'key': 'vnetName', 'type': 'str'}, - 'cors': {'key': 'cors', 'type': 'CorsSettings'}, - 'push': {'key': 'push', 'type': 'PushSettings'}, - 'api_definition': {'key': 'apiDefinition', 'type': 'ApiDefinitionInfo'}, - 'auto_swap_slot_name': {'key': 'autoSwapSlotName', 'type': 'str'}, - 'local_my_sql_enabled': {'key': 'localMySqlEnabled', 'type': 'bool'}, - 'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'http20_enabled': {'key': 'http20Enabled', 'type': 'bool'}, - 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, - } - - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, ip_security_restrictions=None, http20_enabled: bool=True, min_tls_version=None, **kwargs) -> None: - super(SiteConfig, self).__init__(**kwargs) - self.number_of_workers = number_of_workers - self.default_documents = default_documents - self.net_framework_version = net_framework_version - self.php_version = php_version - self.python_version = python_version - self.node_version = node_version - self.linux_fx_version = linux_fx_version - self.request_tracing_enabled = request_tracing_enabled - self.request_tracing_expiration_time = request_tracing_expiration_time - self.remote_debugging_enabled = remote_debugging_enabled - self.remote_debugging_version = remote_debugging_version - self.http_logging_enabled = http_logging_enabled - self.logs_directory_size_limit = logs_directory_size_limit - self.detailed_error_logging_enabled = detailed_error_logging_enabled - self.publishing_username = publishing_username - self.app_settings = app_settings - self.connection_strings = connection_strings - self.machine_key = None - self.handler_mappings = handler_mappings - self.document_root = document_root - self.scm_type = scm_type - self.use32_bit_worker_process = use32_bit_worker_process - self.web_sockets_enabled = web_sockets_enabled - self.always_on = always_on - self.java_version = java_version - self.java_container = java_container - self.java_container_version = java_container_version - self.app_command_line = app_command_line - self.managed_pipeline_mode = managed_pipeline_mode - self.virtual_applications = virtual_applications - self.load_balancing = load_balancing - self.experiments = experiments - self.limits = limits - self.auto_heal_enabled = auto_heal_enabled - self.auto_heal_rules = auto_heal_rules - self.tracing_options = tracing_options - self.vnet_name = vnet_name - self.cors = cors - self.push = push - self.api_definition = api_definition - self.auto_swap_slot_name = auto_swap_slot_name - self.local_my_sql_enabled = local_my_sql_enabled - self.ip_security_restrictions = ip_security_restrictions - self.http20_enabled = http20_enabled - self.min_tls_version = min_tls_version - - -class SiteLimits(Model): - """Metric limits set on an app. - - :param max_percentage_cpu: Maximum allowed CPU usage percentage. - :type max_percentage_cpu: float - :param max_memory_in_mb: Maximum allowed memory usage in MB. - :type max_memory_in_mb: long - :param max_disk_size_in_mb: Maximum allowed disk size usage in MB. - :type max_disk_size_in_mb: long - """ - - _attribute_map = { - 'max_percentage_cpu': {'key': 'maxPercentageCpu', 'type': 'float'}, - 'max_memory_in_mb': {'key': 'maxMemoryInMb', 'type': 'long'}, - 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'csr': {'key': 'properties.csr', 'type': 'str'}, + 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: - super(SiteLimits, self).__init__(**kwargs) - self.max_percentage_cpu = max_percentage_cpu - self.max_memory_in_mb = max_memory_in_mb - self.max_disk_size_in_mb = max_disk_size_in_mb + def __init__( + self, + *, + kind: Optional[str] = None, + key_size: Optional[int] = None, + csr: Optional[str] = None, + is_private_key_external: Optional[bool] = None, + **kwargs + ): + super(RenewCertificateOrderRequest, self).__init__(kind=kind, **kwargs) + self.key_size = key_size + self.csr = csr + self.is_private_key_external = is_private_key_external -class SiteMachineKey(Model): - """MachineKey of an app. +class ServiceSpecification(msrest.serialization.Model): + """Resource metrics service provided by Microsoft.Insights resource provider. - :param validation: MachineKey validation. - :type validation: str - :param validation_key: Validation key. - :type validation_key: str - :param decryption: Algorithm used for decryption. - :type decryption: str - :param decryption_key: Decryption key. - :type decryption_key: str + :param metric_specifications: + :type metric_specifications: list[~azure.mgmt.web.v2015_08_01.models.MetricSpecification] """ _attribute_map = { - 'validation': {'key': 'validation', 'type': 'str'}, - 'validation_key': {'key': 'validationKey', 'type': 'str'}, - 'decryption': {'key': 'decryption', 'type': 'str'}, - 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: - super(SiteMachineKey, self).__init__(**kwargs) - self.validation = validation - self.validation_key = validation_key - self.decryption = decryption - self.decryption_key = decryption_key + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications -class SiteSeal(Model): +class SiteSeal(msrest.serialization.Model): """Site seal. All required parameters must be populated in order to send to Azure. - :param html: Required. HTML snippet + :param html: Required. HTML snippet. :type html: str """ @@ -2572,16 +1250,21 @@ class SiteSeal(Model): 'html': {'key': 'html', 'type': 'str'}, } - def __init__(self, *, html: str, **kwargs) -> None: + def __init__( + self, + *, + html: str, + **kwargs + ): super(SiteSeal, self).__init__(**kwargs) self.html = html -class SiteSealRequest(Model): +class SiteSealRequest(msrest.serialization.Model): """Site seal request. - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. + :param light_theme: If :code:`true` use the light color theme for site seal; + otherwise, use the default color theme. :type light_theme: bool :param locale: Locale of site seal. :type locale: str @@ -2592,535 +1275,13 @@ class SiteSealRequest(Model): 'locale': {'key': 'locale', 'type': 'str'}, } - def __init__(self, *, light_theme: bool=None, locale: str=None, **kwargs) -> None: + def __init__( + self, + *, + light_theme: Optional[bool] = None, + locale: Optional[str] = None, + **kwargs + ): super(SiteSealRequest, self).__init__(**kwargs) self.light_theme = light_theme self.locale = locale - - -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2015_08_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2015_08_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: - super(SkuDescription, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - self.sku_capacity = sku_capacity - self.locations = locations - self.capabilities = capabilities - - -class SlotSwapStatus(Model): - """The status of the last successful slot swap operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime - :ivar source_slot_name: The source slot of the last swap operation. - :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. - :vartype destination_slot_name: str - """ - - _validation = { - 'timestamp_utc': {'readonly': True}, - 'source_slot_name': {'readonly': True}, - 'destination_slot_name': {'readonly': True}, - } - - _attribute_map = { - 'timestamp_utc': {'key': 'timestampUtc', 'type': 'iso-8601'}, - 'source_slot_name': {'key': 'sourceSlotName', 'type': 'str'}, - 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(SlotSwapStatus, self).__init__(**kwargs) - self.timestamp_utc = None - self.source_slot_name = None - self.destination_slot_name = None - - -class SlowRequestsBasedTrigger(Model): - """Trigger based on request execution time. - - :param time_taken: Time taken. - :type time_taken: str - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'time_taken': {'key': 'timeTaken', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: - super(SlowRequestsBasedTrigger, self).__init__(**kwargs) - self.time_taken = time_taken - self.count = count - self.time_interval = time_interval - - -class SnapshotRecoveryRequest(ProxyOnlyResource): - """Details about app recovery operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. - :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2015_08_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. - :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. - :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. - This setting is only necessary when RecoverConfiguration is enabled. - :type ignore_conflicting_host_names: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'overwrite': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'str'}, - 'recovery_target': {'key': 'properties.recoveryTarget', 'type': 'SnapshotRecoveryTarget'}, - 'overwrite': {'key': 'properties.overwrite', 'type': 'bool'}, - 'recover_configuration': {'key': 'properties.recoverConfiguration', 'type': 'bool'}, - 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, - } - - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_target=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, **kwargs) -> None: - super(SnapshotRecoveryRequest, self).__init__(kind=kind, **kwargs) - self.snapshot_time = snapshot_time - self.recovery_target = recovery_target - self.overwrite = overwrite - self.recover_configuration = recover_configuration - self.ignore_conflicting_host_names = ignore_conflicting_host_names - - -class SnapshotRecoveryTarget(Model): - """Specifies the web app that snapshot contents will be written to. - - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS - :type location: str - :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type id: str - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: - super(SnapshotRecoveryTarget, self).__init__(**kwargs) - self.location = location - self.id = id - - -class StatusCodesBasedTrigger(Model): - """Trigger based on status code. - - :param status: HTTP status code. - :type status: int - :param sub_status: Request Sub Status. - :type sub_status: int - :param win32_status: Win32 error code. - :type win32_status: int - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'int'}, - 'sub_status': {'key': 'subStatus', 'type': 'int'}, - 'win32_status': {'key': 'win32Status', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: - super(StatusCodesBasedTrigger, self).__init__(**kwargs) - self.status = status - self.sub_status = sub_status - self.win32_status = win32_status - self.count = count - self.time_interval = time_interval - - -class User(ProxyOnlyResource): - """User credentials used for publishing activity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param user_name: Username - :type user_name: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.name', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, - } - - def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, **kwargs) -> None: - super(User, self).__init__(kind=kind, **kwargs) - self.user_name = user_name - self.publishing_user_name = publishing_user_name - self.publishing_password = publishing_password - self.publishing_password_hash = publishing_password_hash - self.publishing_password_hash_salt = publishing_password_hash_salt - - -class VirtualApplication(Model): - """Virtual application in an app. - - :param virtual_path: Virtual path. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. - :type preload_enabled: bool - :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2015_08_01.models.VirtualDirectory] - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - 'preload_enabled': {'key': 'preloadEnabled', 'type': 'bool'}, - 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, - } - - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: - super(VirtualApplication, self).__init__(**kwargs) - self.virtual_path = virtual_path - self.physical_path = physical_path - self.preload_enabled = preload_enabled - self.virtual_directories = virtual_directories - - -class VirtualDirectory(Model): - """Directory for virtual application. - - :param virtual_path: Path to virtual application. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - } - - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: - super(VirtualDirectory, self).__init__(**kwargs) - self.virtual_path = virtual_path - self.physical_path = physical_path - - -class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_name: The Virtual Network name. - :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. - :type vpn_package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, - 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, - } - - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: - super(VnetGateway, self).__init__(kind=kind, **kwargs) - self.vnet_name = vnet_name - self.vpn_package_uri = vpn_package_uri - - -class VnetInfo(ProxyOnlyResource): - """Virtual Network information contract. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_resource_id: The Virtual Network's resource ID. - :type vnet_resource_id: str - :ivar cert_thumbprint: The client certificate thumbprint. - :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a - Point-To-Site VPN connection. - :type cert_blob: bytearray - :ivar routes: The routes that this Virtual Network connection uses. - :vartype routes: list[~azure.mgmt.web.v2015_08_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. - :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. - :type dns_servers: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'cert_thumbprint': {'readonly': True}, - 'routes': {'readonly': True}, - 'resync_required': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_resource_id': {'key': 'properties.vnetResourceId', 'type': 'str'}, - 'cert_thumbprint': {'key': 'properties.certThumbprint', 'type': 'str'}, - 'cert_blob': {'key': 'properties.certBlob', 'type': 'bytearray'}, - 'routes': {'key': 'properties.routes', 'type': '[VnetRoute]'}, - 'resync_required': {'key': 'properties.resyncRequired', 'type': 'bool'}, - 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: bytearray=None, dns_servers: str=None, **kwargs) -> None: - super(VnetInfo, self).__init__(kind=kind, **kwargs) - self.vnet_resource_id = vnet_resource_id - self.cert_thumbprint = None - self.cert_blob = cert_blob - self.routes = None - self.resync_required = None - self.dns_servers = dns_servers - - -class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. - :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. - :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. - :type end_address: str - :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 - INHERITED - Routes inherited from the real Virtual Network routes - STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' - :type route_type: str or ~azure.mgmt.web.v2015_08_01.models.RouteType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_route_name': {'key': 'properties.name', 'type': 'str'}, - 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, - 'end_address': {'key': 'properties.endAddress', 'type': 'str'}, - 'route_type': {'key': 'properties.routeType', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: - super(VnetRoute, self).__init__(kind=kind, **kwargs) - self.vnet_route_name = vnet_route_name - self.start_address = start_address - self.end_address = end_address - self.route_type = route_type diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_web_site_management_client_enums.py index facff8cc4f71..e1347ea34da5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_web_site_management_client_enums.py @@ -1,180 +1,106 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class KeyVaultSecretStatus(str, Enum): - - initialized = "Initialized" - waiting_on_certificate_order = "WaitingOnCertificateOrder" - succeeded = "Succeeded" - certificate_order_failed = "CertificateOrderFailed" - operation_not_permitted_on_key_vault = "OperationNotPermittedOnKeyVault" - azure_service_unauthorized_to_access_key_vault = "AzureServiceUnauthorizedToAccessKeyVault" - key_vault_does_not_exist = "KeyVaultDoesNotExist" - key_vault_secret_does_not_exist = "KeyVaultSecretDoesNotExist" - unknown_error = "UnknownError" - external_private_key = "ExternalPrivateKey" - unknown = "Unknown" - - -class CertificateProductType(str, Enum): - - standard_domain_validated_ssl = "StandardDomainValidatedSsl" - standard_domain_validated_wild_card_ssl = "StandardDomainValidatedWildCardSsl" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" - - -class CertificateOrderStatus(str, Enum): - - pendingissuance = "Pendingissuance" - issued = "Issued" - revoked = "Revoked" - canceled = "Canceled" - denied = "Denied" - pendingrevocation = "Pendingrevocation" - pending_rekey = "PendingRekey" - unused = "Unused" - expired = "Expired" - not_submitted = "NotSubmitted" - - -class CertificateOrderActionType(str, Enum): - - certificate_issued = "CertificateIssued" - certificate_order_canceled = "CertificateOrderCanceled" - certificate_order_created = "CertificateOrderCreated" - certificate_revoked = "CertificateRevoked" - domain_validation_complete = "DomainValidationComplete" - fraud_detected = "FraudDetected" - org_name_change = "OrgNameChange" - org_validation_complete = "OrgValidationComplete" - san_drop = "SanDrop" - fraud_cleared = "FraudCleared" - certificate_expired = "CertificateExpired" - certificate_expiration_warning = "CertificateExpirationWarning" - fraud_documentation_required = "FraudDocumentationRequired" - unknown = "Unknown" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class CertificateOrderActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action type. + """ + + CERTIFICATE_ISSUED = "CertificateIssued" + CERTIFICATE_ORDER_CANCELED = "CertificateOrderCanceled" + CERTIFICATE_ORDER_CREATED = "CertificateOrderCreated" + CERTIFICATE_REVOKED = "CertificateRevoked" + DOMAIN_VALIDATION_COMPLETE = "DomainValidationComplete" + FRAUD_DETECTED = "FraudDetected" + ORG_NAME_CHANGE = "OrgNameChange" + ORG_VALIDATION_COMPLETE = "OrgValidationComplete" + SAN_DROP = "SanDrop" + FRAUD_CLEARED = "FraudCleared" + CERTIFICATE_EXPIRED = "CertificateExpired" + CERTIFICATE_EXPIRATION_WARNING = "CertificateExpirationWarning" + FRAUD_DOCUMENTATION_REQUIRED = "FraudDocumentationRequired" + UNKNOWN = "Unknown" + +class CertificateOrderStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current order status. + """ + + PENDINGISSUANCE = "Pendingissuance" + ISSUED = "Issued" + REVOKED = "Revoked" + CANCELED = "Canceled" + DENIED = "Denied" + PENDINGREVOCATION = "Pendingrevocation" + PENDING_REKEY = "PendingRekey" + UNUSED = "Unused" + EXPIRED = "Expired" + NOT_SUBMITTED = "NotSubmitted" + +class CertificateProductType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Certificate product type. + """ + + STANDARD_DOMAIN_VALIDATED_SSL = "StandardDomainValidatedSsl" + STANDARD_DOMAIN_VALIDATED_WILD_CARD_SSL = "StandardDomainValidatedWildCardSsl" + +class KeyVaultSecretStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Key Vault secret. + """ + + INITIALIZED = "Initialized" + WAITING_ON_CERTIFICATE_ORDER = "WaitingOnCertificateOrder" + SUCCEEDED = "Succeeded" + CERTIFICATE_ORDER_FAILED = "CertificateOrderFailed" + OPERATION_NOT_PERMITTED_ON_KEY_VAULT = "OperationNotPermittedOnKeyVault" + AZURE_SERVICE_UNAUTHORIZED_TO_ACCESS_KEY_VAULT = "AzureServiceUnauthorizedToAccessKeyVault" + KEY_VAULT_DOES_NOT_EXIST = "KeyVaultDoesNotExist" + KEY_VAULT_SECRET_DOES_NOT_EXIST = "KeyVaultSecretDoesNotExist" + UNKNOWN_ERROR = "UnknownError" + EXTERNAL_PRIVATE_KEY = "ExternalPrivateKey" + UNKNOWN = "Unknown" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of certificate order. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/__init__.py index 075b7482c6a6..e2bcdf59c15b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._app_service_certificate_orders_operations import AppServiceCertificateOrdersOperations diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py index df4d5fd75677..25edf6ae7bf9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py @@ -1,1439 +1,1425 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServiceCertificateOrdersOperations(object): """AppServiceCertificateOrdersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2015_08_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. - :ivar api_version: API Version. Constant value: "2015-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateOrderCollection"] """List all certificate orders in a subscription. List all certificate orders in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateOrder - :rtype: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrderCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateOrderPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore def validate_purchase_information( - self, app_service_certificate_order, custom_headers=None, raw=False, **operation_config): + self, + app_service_certificate_order, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> None """Validate information for a certificate order. Validate information for a certificate order. - :param app_service_certificate_order: Information for a certificate - order. - :type app_service_certificate_order: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param app_service_certificate_order: Information for a certificate order. + :type app_service_certificate_order: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate_purchase_information.metadata['url'] + url = self.validate_purchase_information.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} + if cls: + return cls(pipeline_response, None, {}) + + validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateOrderCollection"] """Get certificate orders in a resource group. Get certificate orders in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateOrder - :rtype: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrderCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateOrderPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore def get( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" """Get a certificate order. Get a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order.. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateOrder or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceCertificateOrder"] """Create or update a certificate purchase order. Create or update a certificate purchase order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param certificate_distinguished_name: Distinguished name to use for - the certificate order. - :type certificate_distinguished_name: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceCertificateOrder or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceCertificateOrder or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - certificate_order_name=certificate_order_name, - certificate_distinguished_name=certificate_distinguished_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceCertificateOrder', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + certificate_order_name=certificate_order_name, + certificate_distinguished_name=certificate_distinguished_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + 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 + ) + 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.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def delete( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an existing certificate order. Delete an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def update( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrderPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" """Create or update a certificate purchase order. Create or update a certificate purchase order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param certificate_distinguished_name: Distinguished name to use for - the certificate order. - :type certificate_distinguished_name: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateOrder or ClientRawResponse if raw=true + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrderPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateOrder - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def list_certificates( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateCollection"] """List all certificates associated with a certificate order. List all certificates associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateResource - :rtype: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResourcePaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_certificates.metadata['url'] + url = self.list_certificates.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} # type: ignore def get_certificate( - self, resource_group_name, certificate_order_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" """Get the certificate associated with a certificate order. Get the certificate associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} - + get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def _create_or_update_certificate_initial( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_certificate.metadata['url'] + url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_certificate( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + def begin_create_or_update_certificate( + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceCertificateResource"] """Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str :param key_vault_certificate: Key vault certificate resource Id. - :type key_vault_certificate: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type key_vault_certificate: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceCertificateResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceCertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_certificate_initial( - resource_group_name=resource_group_name, - certificate_order_name=certificate_order_name, - name=name, - key_vault_certificate=key_vault_certificate, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceCertificateResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_certificate_initial( + resource_group_name=resource_group_name, + certificate_order_name=certificate_order_name, + name=name, + key_vault_certificate=key_vault_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def delete_certificate( - self, resource_group_name, certificate_order_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete the certificate associated with a certificate order. Delete the certificate associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def update_certificate( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" """Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str :param key_vault_certificate: Key vault certificate resource Id. - :type key_vault_certificate: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type key_vault_certificate: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def reissue( - self, resource_group_name, certificate_order_name, reissue_certificate_order_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + reissue_certificate_order_request, # type: "models.ReissueCertificateOrderRequest" + **kwargs # type: Any + ): + # type: (...) -> None """Reissue an existing certificate order. Reissue an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param reissue_certificate_order_request: Parameters for the reissue. - :type reissue_certificate_order_request: - ~azure.mgmt.web.v2015_08_01.models.ReissueCertificateOrderRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type reissue_certificate_order_request: ~azure.mgmt.web.v2015_08_01.models.ReissueCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.reissue.metadata['url'] + url = self.reissue.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} + if cls: + return cls(pipeline_response, None, {}) + + reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} # type: ignore def renew( - self, resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + renew_certificate_order_request, # type: "models.RenewCertificateOrderRequest" + **kwargs # type: Any + ): + # type: (...) -> None """Renew an existing certificate order. Renew an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param renew_certificate_order_request: Renew parameters - :type renew_certificate_order_request: - ~azure.mgmt.web.v2015_08_01.models.RenewCertificateOrderRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param renew_certificate_order_request: Renew parameters. + :type renew_certificate_order_request: ~azure.mgmt.web.v2015_08_01.models.RenewCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.renew.metadata['url'] + url = self.renew.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} + if cls: + return cls(pipeline_response, None, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} # type: ignore def resend_email( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Resend certificate email. Resend certificate email. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.resend_email.metadata['url'] + url = self.resend_email.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} + if cls: + return cls(pipeline_response, None, {}) + + resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} # type: ignore def resend_request_emails( - self, resource_group_name, certificate_order_name, name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> None """Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param name_identifier: Email address. + :type name_identifier: ~azure.mgmt.web.v2015_08_01.models.NameIdentifier + :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 """ - name_identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.resend_request_emails.metadata['url'] + url = self.resend_request_emails.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} + if cls: + return cls(pipeline_response, None, {}) + + resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} # type: ignore def retrieve_site_seal( - self, resource_group_name, certificate_order_name, light_theme=None, locale=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + site_seal_request, # type: "models.SiteSealRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSeal" """Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. - :type light_theme: bool - :param locale: Locale of site seal. - :type locale: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSeal or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2015_08_01.models.SiteSeal or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_seal_request: Site seal request. + :type site_seal_request: ~azure.mgmt.web.v2015_08_01.models.SiteSealRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSeal, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2015_08_01.models.SiteSeal + :raises: ~azure.core.exceptions.HttpResponseError """ - site_seal_request = models.SiteSealRequest(light_theme=light_theme, locale=locale) + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.retrieve_site_seal.metadata['url'] + url = self.retrieve_site_seal.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteSeal', response) + deserialized = self._deserialize('SiteSeal', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} + retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} # type: ignore def verify_domain_ownership( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.verify_domain_ownership.metadata['url'] + url = self.verify_domain_ownership.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} + verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} # type: ignore def retrieve_certificate_actions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.CertificateOrderAction"] """Retrieve the list of certificate actions. Retrieve the list of certificate actions. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate order. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.mgmt.web.v2015_08_01.models.CertificateOrderAction] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateOrderAction, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2015_08_01.models.CertificateOrderAction] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.retrieve_certificate_actions.metadata['url'] + url = self.retrieve_certificate_actions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[CertificateOrderAction]', response) + deserialized = self._deserialize('[CertificateOrderAction]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} + retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} # type: ignore def retrieve_certificate_email_history( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.CertificateEmail"] """Retrieve email history. Retrieve email history. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate order. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2015_08_01.models.CertificateEmail] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateEmail, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2015_08_01.models.CertificateEmail] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + # Construct URL - url = self.retrieve_certificate_email_history.metadata['url'] + url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[CertificateEmail]', response) + deserialized = self._deserialize('[CertificateEmail]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} + retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py index a4d40b237ed4..46417c5d85dc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py @@ -1,106 +1,109 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificateRegistrationProviderOperations(object): """CertificateRegistrationProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2015_08_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. - :ivar api_version: API Version. Constant value: "2015-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-08-01" - - self.config = config + self._config = config def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2015_08_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2015_08_01.models.CsmOperationDescription] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2015_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py index b96e0933169e..07123d6a065d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2016-03-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json new file mode 100644 index 000000000000..af6b14917c95 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json @@ -0,0 +1,244 @@ +{ + "chosen_version": "2016-03-01", + "total_api_version_list": ["2016-03-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "certificates": "CertificatesOperations", + "deleted_web_apps": "DeletedWebAppsOperations", + "diagnostics": "DiagnosticsOperations", + "provider": "ProviderOperations", + "recommendations": "RecommendationsOperations", + "resource_health_metadata": "ResourceHealthMetadataOperations", + "billing_meters": "BillingMetersOperations" + }, + "operation_mixins": { + "get_publishing_user" : { + "sync": { + "signature": "def get_publishing_user(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets publishing user.\n\nGets publishing user.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_publishing_user(\n self,\n **kwargs\n) -\u003e \"models.User\":\n", + "doc": "\"\"\"Gets publishing user.\n\nGets publishing user.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "update_publishing_user" : { + "sync": { + "signature": "def update_publishing_user(\n self,\n user_details, # type: \"models.User\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates publishing user.\n\nUpdates publishing user.\n\n:param user_details: Details of publishing user.\n:type user_details: ~azure.mgmt.web.v2016_03_01.models.User\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_publishing_user(\n self,\n user_details: \"models.User\",\n **kwargs\n) -\u003e \"models.User\":\n", + "doc": "\"\"\"Updates publishing user.\n\nUpdates publishing user.\n\n:param user_details: Details of publishing user.\n:type user_details: ~azure.mgmt.web.v2016_03_01.models.User\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "user_details" + }, + "list_source_controls" : { + "sync": { + "signature": "def list_source_controls(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the source controls available for Azure websites.\n\nGets the source controls available for Azure websites.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SourceControlCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.SourceControlCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_source_controls(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SourceControlCollection\"]:\n", + "doc": "\"\"\"Gets the source controls available for Azure websites.\n\nGets the source controls available for Azure websites.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SourceControlCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.SourceControlCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "get_source_control" : { + "sync": { + "signature": "def get_source_control(\n self,\n source_control_type, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets source control token.\n\nGets source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_source_control(\n self,\n source_control_type: str,\n **kwargs\n) -\u003e \"models.SourceControl\":\n", + "doc": "\"\"\"Gets source control token.\n\nGets source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "source_control_type" + }, + "update_source_control" : { + "sync": { + "signature": "def update_source_control(\n self,\n source_control_type, # type: str\n request_message, # type: \"models.SourceControl\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates source control token.\n\nUpdates source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:param request_message: Source control token information.\n:type request_message: ~azure.mgmt.web.v2016_03_01.models.SourceControl\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_source_control(\n self,\n source_control_type: str,\n request_message: \"models.SourceControl\",\n **kwargs\n) -\u003e \"models.SourceControl\":\n", + "doc": "\"\"\"Updates source control token.\n\nUpdates source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:param request_message: Source control token information.\n:type request_message: ~azure.mgmt.web.v2016_03_01.models.SourceControl\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "source_control_type, request_message" + }, + "check_name_availability" : { + "sync": { + "signature": "def check_name_availability(\n self,\n name, # type: str\n type, # type: Union[str, \"models.CheckNameResourceTypes\"]\n is_fqdn=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Check if a resource name is available.\n\nCheck if a resource name is available.\n\n:param name: Resource name to verify.\n:type name: str\n:param type: Resource type used for verification.\n:type type: str or ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes\n:param is_fqdn: Is fully qualified domain name.\n:type is_fqdn: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceNameAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceNameAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_name_availability(\n self,\n name: str,\n type: Union[str, \"models.CheckNameResourceTypes\"],\n is_fqdn: Optional[bool] = None,\n **kwargs\n) -\u003e \"models.ResourceNameAvailability\":\n", + "doc": "\"\"\"Check if a resource name is available.\n\nCheck if a resource name is available.\n\n:param name: Resource name to verify.\n:type name: str\n:param type: Resource type used for verification.\n:type type: str or ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes\n:param is_fqdn: Is fully qualified domain name.\n:type is_fqdn: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceNameAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceNameAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "name, type, is_fqdn" + }, + "get_subscription_deployment_locations" : { + "sync": { + "signature": "def get_subscription_deployment_locations(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets list of available geo regions plus ministamps.\n\nGets list of available geo regions plus ministamps.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeploymentLocations, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.DeploymentLocations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_subscription_deployment_locations(\n self,\n **kwargs\n) -\u003e \"models.DeploymentLocations\":\n", + "doc": "\"\"\"Gets list of available geo regions plus ministamps.\n\nGets list of available geo regions plus ministamps.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeploymentLocations, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.DeploymentLocations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "list_geo_regions" : { + "sync": { + "signature": "def list_geo_regions(\n self,\n sku=None, # type: Optional[Union[str, \"models.SkuName\"]]\n linux_workers_enabled=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get a list of available geographical regions.\n\nGet a list of available geographical regions.\n\n:param sku: Name of SKU used to filter the regions.\n:type sku: str or ~azure.mgmt.web.v2016_03_01.models.SkuName\n:param linux_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Linux workers.\n:type linux_workers_enabled: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either GeoRegionCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.GeoRegionCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_geo_regions(\n self,\n sku: Optional[Union[str, \"models.SkuName\"]] = None,\n linux_workers_enabled: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.GeoRegionCollection\"]:\n", + "doc": "\"\"\"Get a list of available geographical regions.\n\nGet a list of available geographical regions.\n\n:param sku: Name of SKU used to filter the regions.\n:type sku: str or ~azure.mgmt.web.v2016_03_01.models.SkuName\n:param linux_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Linux workers.\n:type linux_workers_enabled: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either GeoRegionCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.GeoRegionCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "sku, linux_workers_enabled" + }, + "list_site_identifiers_assigned_to_host_name" : { + "sync": { + "signature": "def list_site_identifiers_assigned_to_host_name(\n self,\n name_identifier, # type: \"models.NameIdentifier\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all apps that are assigned to a hostname.\n\nList all apps that are assigned to a hostname.\n\n:param name_identifier: Hostname information.\n:type name_identifier: ~azure.mgmt.web.v2016_03_01.models.NameIdentifier\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either IdentifierCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.IdentifierCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_site_identifiers_assigned_to_host_name(\n self,\n name_identifier: \"models.NameIdentifier\",\n **kwargs\n) -\u003e AsyncItemPaged[\"models.IdentifierCollection\"]:\n", + "doc": "\"\"\"List all apps that are assigned to a hostname.\n\nList all apps that are assigned to a hostname.\n\n:param name_identifier: Hostname information.\n:type name_identifier: ~azure.mgmt.web.v2016_03_01.models.NameIdentifier\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either IdentifierCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.IdentifierCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "name_identifier" + }, + "list_premier_add_on_offers" : { + "sync": { + "signature": "def list_premier_add_on_offers(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all premier add-on offers.\n\nList all premier add-on offers.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOfferCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_premier_add_on_offers(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PremierAddOnOfferCollection\"]:\n", + "doc": "\"\"\"List all premier add-on offers.\n\nList all premier add-on offers.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOfferCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "list_skus" : { + "sync": { + "signature": "def list_skus(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all SKUs.\n\nList all SKUs.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuInfos, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.SkuInfos\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def list_skus(\n self,\n **kwargs\n) -\u003e \"models.SkuInfos\":\n", + "doc": "\"\"\"List all SKUs.\n\nList all SKUs.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuInfos, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.SkuInfos\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "verify_hosting_environment_vnet" : { + "sync": { + "signature": "def verify_hosting_environment_vnet(\n self,\n parameters, # type: \"models.VnetParameters\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.\n\nVerifies if this VNET is compatible with an App Service Environment by analyzing the Network\nSecurity Group rules.\n\n:param parameters: VNET information.\n:type parameters: ~azure.mgmt.web.v2016_03_01.models.VnetParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VnetValidationFailureDetails, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.VnetValidationFailureDetails\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def verify_hosting_environment_vnet(\n self,\n parameters: \"models.VnetParameters\",\n **kwargs\n) -\u003e \"models.VnetValidationFailureDetails\":\n", + "doc": "\"\"\"Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.\n\nVerifies if this VNET is compatible with an App Service Environment by analyzing the Network\nSecurity Group rules.\n\n:param parameters: VNET information.\n:type parameters: ~azure.mgmt.web.v2016_03_01.models.VnetParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VnetValidationFailureDetails, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.VnetValidationFailureDetails\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "parameters" + }, + "move" : { + "sync": { + "signature": "def move(\n self,\n resource_group_name, # type: str\n move_resource_envelope, # type: \"models.CsmMoveResourceEnvelope\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Move resources between resource groups.\n\nMove resources between resource groups.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def move(\n self,\n resource_group_name: str,\n move_resource_envelope: \"models.CsmMoveResourceEnvelope\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Move resources between resource groups.\n\nMove resources between resource groups.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, move_resource_envelope" + }, + "validate" : { + "sync": { + "signature": "def validate(\n self,\n resource_group_name, # type: str\n validate_request, # type: \"models.ValidateRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate if a resource can be created.\n\nValidate if a resource can be created.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_request: Request with the resources to validate.\n:type validate_request: ~azure.mgmt.web.v2016_03_01.models.ValidateRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.ValidateResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate(\n self,\n resource_group_name: str,\n validate_request: \"models.ValidateRequest\",\n **kwargs\n) -\u003e \"models.ValidateResponse\":\n", + "doc": "\"\"\"Validate if a resource can be created.\n\nValidate if a resource can be created.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_request: Request with the resources to validate.\n:type validate_request: ~azure.mgmt.web.v2016_03_01.models.ValidateRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2016_03_01.models.ValidateResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, validate_request" + }, + "validate_move" : { + "sync": { + "signature": "def validate_move(\n self,\n resource_group_name, # type: str\n move_resource_envelope, # type: \"models.CsmMoveResourceEnvelope\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate whether a resource can be moved.\n\nValidate whether a resource can be moved.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate_move(\n self,\n resource_group_name: str,\n move_resource_envelope: \"models.CsmMoveResourceEnvelope\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Validate whether a resource can be moved.\n\nValidate whether a resource can be moved.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, move_resource_envelope" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py index b514a5c2e716..1c09432d5467 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py @@ -1,81 +1,100 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration -from .operations import WebSiteManagementClientOperationsMixin from .operations import CertificatesOperations from .operations import DeletedWebAppsOperations from .operations import DiagnosticsOperations from .operations import ProviderOperations from .operations import RecommendationsOperations from .operations import ResourceHealthMetadataOperations +from .operations import WebSiteManagementClientOperationsMixin from .operations import BillingMetersOperations from . import models -class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, SDKClient): - """WebSite Management Client - - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): + """WebSite Management Client. - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.web.v2016_03_01.operations.CertificatesOperations - :ivar deleted_web_apps: DeletedWebApps operations + :ivar deleted_web_apps: DeletedWebAppsOperations operations :vartype deleted_web_apps: azure.mgmt.web.v2016_03_01.operations.DeletedWebAppsOperations - :ivar diagnostics: Diagnostics operations + :ivar diagnostics: DiagnosticsOperations operations :vartype diagnostics: azure.mgmt.web.v2016_03_01.operations.DiagnosticsOperations - :ivar provider: Provider operations + :ivar provider: ProviderOperations operations :vartype provider: azure.mgmt.web.v2016_03_01.operations.ProviderOperations - :ivar recommendations: Recommendations operations + :ivar recommendations: RecommendationsOperations operations :vartype recommendations: azure.mgmt.web.v2016_03_01.operations.RecommendationsOperations - :ivar resource_health_metadata: ResourceHealthMetadata operations + :ivar resource_health_metadata: ResourceHealthMetadataOperations operations :vartype resource_health_metadata: azure.mgmt.web.v2016_03_01.operations.ResourceHealthMetadataOperations - :ivar billing_meters: BillingMeters operations + :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.web.v2016_03_01.operations.BillingMetersOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2016-03-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deleted_web_apps = DeletedWebAppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.diagnostics = DiagnosticsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.provider = ProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.recommendations = RecommendationsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.resource_health_metadata = ResourceHealthMetadataOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.billing_meters = BillingMetersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py new file mode 100644 index 000000000000..09db47eb5785 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2016-03-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..f9e020d49719 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import CertificatesOperations +from .operations_async import DeletedWebAppsOperations +from .operations_async import DiagnosticsOperations +from .operations_async import ProviderOperations +from .operations_async import RecommendationsOperations +from .operations_async import ResourceHealthMetadataOperations +from .operations_async import WebSiteManagementClientOperationsMixin +from .operations_async import BillingMetersOperations +from .. import models + + +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): + """WebSite Management Client. + + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.web.v2016_03_01.aio.operations_async.CertificatesOperations + :ivar deleted_web_apps: DeletedWebAppsOperations operations + :vartype deleted_web_apps: azure.mgmt.web.v2016_03_01.aio.operations_async.DeletedWebAppsOperations + :ivar diagnostics: DiagnosticsOperations operations + :vartype diagnostics: azure.mgmt.web.v2016_03_01.aio.operations_async.DiagnosticsOperations + :ivar provider: ProviderOperations operations + :vartype provider: azure.mgmt.web.v2016_03_01.aio.operations_async.ProviderOperations + :ivar recommendations: RecommendationsOperations operations + :vartype recommendations: azure.mgmt.web.v2016_03_01.aio.operations_async.RecommendationsOperations + :ivar resource_health_metadata: ResourceHealthMetadataOperations operations + :vartype resource_health_metadata: azure.mgmt.web.v2016_03_01.aio.operations_async.ResourceHealthMetadataOperations + :ivar billing_meters: BillingMetersOperations operations + :vartype billing_meters: azure.mgmt.web.v2016_03_01.aio.operations_async.BillingMetersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deleted_web_apps = DeletedWebAppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostics = DiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.provider = ProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.recommendations = RecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_health_metadata = ResourceHealthMetadataOperations( + self._client, self._config, self._serialize, self._deserialize) + self.billing_meters = BillingMetersOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..89f3db21535c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._certificates_operations_async import CertificatesOperations +from ._deleted_web_apps_operations_async import DeletedWebAppsOperations +from ._diagnostics_operations_async import DiagnosticsOperations +from ._provider_operations_async import ProviderOperations +from ._recommendations_operations_async import RecommendationsOperations +from ._resource_health_metadata_operations_async import ResourceHealthMetadataOperations +from ._web_site_management_client_operations_async import WebSiteManagementClientOperationsMixin +from ._billing_meters_operations_async import BillingMetersOperations + +__all__ = [ + 'CertificatesOperations', + 'DeletedWebAppsOperations', + 'DiagnosticsOperations', + 'ProviderOperations', + 'RecommendationsOperations', + 'ResourceHealthMetadataOperations', + 'WebSiteManagementClientOperationsMixin', + 'BillingMetersOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py new file mode 100644 index 000000000000..7596ee8db723 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BillingMetersOperations: + """BillingMetersOperations 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.web.v2016_03_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 + + def list( + self, + billing_location: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.BillingMeterCollection"]: + """Gets a list of meters for a given location. + + Gets a list of meters for a given location. + + :param billing_location: Azure Location of billable resource. + :type billing_location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if billing_location is not None: + query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BillingMeterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/billingMeters'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py new file mode 100644 index 000000000000..cba0d93325c7 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py @@ -0,0 +1,418 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +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.web.v2016_03_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates for a subscription. + + Get all certificates for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/certificates'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates in a resource group. + + Get all certificates in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.Certificate": + """Get a certificate. + + Get a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.Certificate", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2016_03_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'Certificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete a certificate. + + Delete a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.CertificatePatchResource", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2016_03_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py new file mode 100644 index 000000000000..3017d6dd5027 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeletedWebAppsOperations: + """DeletedWebAppsOperations 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.web.v2016_03_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DeletedWebAppCollection"]: + """Get all deleted apps for a subscription. + + Get all deleted apps for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('DeletedWebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/deletedSites'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py new file mode 100644 index 000000000000..6da046b8e32e --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py @@ -0,0 +1,1718 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticsOperations: + """DiagnosticsOperations 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.web.v2016_03_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 + + def list_hosting_environment_detector_responses( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Hosting Environment Detector Responses. + + List Hosting Environment Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_hosting_environment_detector_responses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} # type: ignore + + async def get_hosting_environment_detector_response( + self, + resource_group_name: str, + name: str, + detector_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get Hosting Environment Detector Response. + + Get Hosting Environment Detector Response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: App Service Environment Name. + :type name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} # type: ignore + + def list_site_detector_responses( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Site Detector Responses. + + List Site Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detector_responses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} # type: ignore + + async def get_site_detector_response( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get site detector response. + + Get site detector response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_site_detector_response.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} # type: ignore + + def list_site_diagnostic_categories( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticCategoryCollection"]: + """Get Diagnostics Categories. + + Get Diagnostics Categories. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_diagnostic_categories.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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: + 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('DiagnosticCategoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} # type: ignore + + async def get_site_diagnostic_category( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> "models.DiagnosticCategory": + """Get Diagnostics Category. + + Get Diagnostics Category. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_site_diagnostic_category.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} # type: ignore + + def list_site_analyses( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticAnalysisCollection"]: + """Get Site Analyses. + + Get Site Analyses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_analyses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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: + 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('DiagnosticAnalysisCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore + + async def get_site_analysis( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Get Site Analysis. + + Get Site Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param analysis_name: Analysis Name. + :type analysis_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_site_analysis.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore + + async def execute_site_analysis( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Execute Analysis. + + Execute Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param analysis_name: Analysis Resource Name. + :type analysis_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.execute_site_analysis.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore + + def list_site_detectors( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detectors. + + Get Detectors. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detectors.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore + + def get_site_detector( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + detector_name: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detector. + + Get Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param detector_name: Detector Name. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_site_detector.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + ) + get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore + + async def execute_site_detector( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + diagnostic_category: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticDetectorResponse": + """Execute Detector. + + Execute Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.execute_site_detector.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore + + def list_site_detector_responses_slot( + self, + resource_group_name: str, + site_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Site Detector Responses. + + List Site Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detector_responses_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} # type: ignore + + async def get_site_detector_response_slot( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get site detector response. + + Get site detector response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_site_detector_response_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} # type: ignore + + def list_site_diagnostic_categories_slot( + self, + resource_group_name: str, + site_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticCategoryCollection"]: + """Get Diagnostics Categories. + + Get Diagnostics Categories. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_diagnostic_categories_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticCategoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} # type: ignore + + async def get_site_diagnostic_category_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> "models.DiagnosticCategory": + """Get Diagnostics Category. + + Get Diagnostics Category. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} # type: ignore + + def list_site_analyses_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticAnalysisCollection"]: + """Get Site Analyses. + + Get Site Analyses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_analyses_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticAnalysisCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore + + async def get_site_analysis_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + slot: str, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Get Site Analysis. + + Get Site Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param analysis_name: Analysis Name. + :type analysis_name: str + :param slot: Slot - optional. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_site_analysis_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore + + async def execute_site_analysis_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Execute Analysis. + + Execute Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param analysis_name: Analysis Resource Name. + :type analysis_name: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.execute_site_analysis_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore + + def list_site_detectors_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detectors. + + Get Detectors. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detectors_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore + + def get_site_detector_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + detector_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detector. + + Get Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param detector_name: Detector Name. + :type detector_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_site_detector_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + ) + get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore + + async def execute_site_detector_slot( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + diagnostic_category: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticDetectorResponse": + """Execute Detector. + + Execute Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.execute_site_detector_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py new file mode 100644 index 000000000000..fd786c8a95d0 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py @@ -0,0 +1,240 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProviderOperations: + """ProviderOperations 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.web.v2016_03_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 + + def get_available_stacks( + self, + os_type_selected: Optional[Union[str, "models.Enum0"]] = None, + **kwargs + ) -> AsyncIterable["models.ApplicationStackCollection"]: + """Get available application frameworks and their versions. + + Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2016_03_01.models.Enum0 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_available_stacks.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if os_type_selected is not None: + query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + ) + get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} # type: ignore + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions. + + Gets all available operations for the Microsoft.Web resource provider. Also exposes resource + metric definitions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} # type: ignore + + def get_available_stacks_on_prem( + self, + os_type_selected: Optional[Union[str, "models.Enum1"]] = None, + **kwargs + ) -> AsyncIterable["models.ApplicationStackCollection"]: + """Get available application frameworks and their versions. + + Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2016_03_01.models.Enum1 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_available_stacks_on_prem.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] + if os_type_selected is not None: + query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + ) + get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py new file mode 100644 index 000000000000..a2d50d1d83cd --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py @@ -0,0 +1,615 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RecommendationsOperations: + """RecommendationsOperations 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.web.v2016_03_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 + + def list( + self, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """List all recommendations for a subscription. + + List all recommendations for a subscription. + + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or + channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/recommendations'} # type: ignore + + async def reset_all_filters( + self, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for a subscription. + + Reset all recommendation opt-out settings for a subscription. + + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.reset_all_filters.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} # type: ignore + + async def disable_recommendation_for_subscription( + self, + name: str, + **kwargs + ) -> None: + """Disables the specified rule so it will not apply to a subscription in the future. + + Disables the specified rule so it will not apply to a subscription in the future. + + :param name: Rule name. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} # type: ignore + + def list_history_for_web_app( + self, + resource_group_name: str, + site_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get past recommendations for an app, optionally specified by the time range. + + Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param filter: Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or + channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_history_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} # type: ignore + + def list_recommended_rules_for_web_app( + self, + resource_group_name: str, + site_name: str, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get all recommendations for an app. + + Get all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommended_rules_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} # type: ignore + + async def disable_all_for_web_app( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> None: + """Disable all recommendations for an app. + + Disable all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.disable_all_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} # type: ignore + + async def reset_all_filters_for_web_app( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for an app. + + Reset all recommendation opt-out settings for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} # type: ignore + + async def get_rule_details_by_web_app( + self, + resource_group_name: str, + site_name: str, + name: str, + update_seen: Optional[bool] = None, + recommendation_id: Optional[str] = None, + **kwargs + ) -> "models.RecommendationRule": + """Get a recommendation rule for an app. + + Get a recommendation rule for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param name: Name of the recommendation. + :type name: str + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. + :type update_seen: bool + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if update_seen is not None: + query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') + if recommendation_id is not None: + query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecommendationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} # type: ignore + + async def disable_recommendation_for_site( + self, + resource_group_name: str, + site_name: str, + name: str, + **kwargs + ) -> None: + """Disables the specific rule for a web site permanently. + + Disables the specific rule for a web site permanently. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site name. + :type site_name: str + :param name: Rule name. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.disable_recommendation_for_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py new file mode 100644 index 000000000000..7f6bdb379c40 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py @@ -0,0 +1,450 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceHealthMetadataOperations: + """ResourceHealthMetadataOperations 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.web.v2016_03_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """List all ResourceHealthMetadata for all sites in the subscription. + + List all ResourceHealthMetadata for all sites in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """List all ResourceHealthMetadata for all sites in the resource group in the subscription. + + List all ResourceHealthMetadata for all sites in the resource group in the subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore + + def list_by_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} # type: ignore + + async def get_by_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.ResourceHealthMetadata": + """Gets the category of ResourceHealthMetadata to use for the given site. + + Gets the category of ResourceHealthMetadata to use for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_by_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} # type: ignore + + def list_by_site_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_site_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} # type: ignore + + async def get_by_site_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.ResourceHealthMetadata": + """Gets the category of ResourceHealthMetadata to use for the given site. + + Gets the category of ResourceHealthMetadata to use for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_by_site_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py new file mode 100644 index 000000000000..5226c0052afe --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py @@ -0,0 +1,915 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebSiteManagementClientOperationsMixin: + + async def get_publishing_user( + self, + **kwargs + ) -> "models.User": + """Gets publishing user. + + Gets publishing user. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_publishing_user.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'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore + + async def update_publishing_user( + self, + user_details: "models.User", + **kwargs + ) -> "models.User": + """Updates publishing user. + + Updates publishing user. + + :param user_details: Details of publishing user. + :type user_details: ~azure.mgmt.web.v2016_03_01.models.User + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_publishing_user.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_details, 'User') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore + + def list_source_controls( + self, + **kwargs + ) -> AsyncIterable["models.SourceControlCollection"]: + """Gets the source controls available for Azure websites. + + Gets the source controls available for Azure websites. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_source_controls.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: + 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('SourceControlCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} # type: ignore + + async def get_source_control( + self, + source_control_type: str, + **kwargs + ) -> "models.SourceControl": + """Gets source control token. + + Gets source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore + + async def update_source_control( + self, + source_control_type: str, + request_message: "models.SourceControl", + **kwargs + ) -> "models.SourceControl": + """Updates source control token. + + Updates source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2016_03_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request_message, 'SourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore + + async def check_name_availability( + self, + name: str, + type: Union[str, "models.CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ) -> "models.ResourceNameAvailability": + """Check if a resource name is available. + + Check if a resource name is available. + + :param name: Resource name to verify. + :type name: str + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes + :param is_fqdn: Is fully qualified domain name. + :type is_fqdn: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceNameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} # type: ignore + + async def get_subscription_deployment_locations( + self, + **kwargs + ) -> "models.DeploymentLocations": + """Gets list of available geo regions plus ministamps. + + Gets list of available geo regions plus ministamps. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.get_subscription_deployment_locations.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentLocations', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} # type: ignore + + def list_geo_regions( + self, + sku: Optional[Union[str, "models.SkuName"]] = None, + linux_workers_enabled: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.GeoRegionCollection"]: + """Get a list of available geographical regions. + + Get a list of available geographical regions. + + :param sku: Name of SKU used to filter the regions. + :type sku: str or ~azure.mgmt.web.v2016_03_01.models.SkuName + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. + :type linux_workers_enabled: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_geo_regions.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] + if sku is not None: + query_parameters['sku'] = self._serialize.query("sku", sku, 'str') + if linux_workers_enabled is not None: + query_parameters['linuxWorkersEnabled'] = self._serialize.query("linux_workers_enabled", linux_workers_enabled, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GeoRegionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} # type: ignore + + def list_site_identifiers_assigned_to_host_name( + self, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """List all apps that are assigned to a hostname. + + List all apps that are assigned to a hostname. + + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2016_03_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_identifiers_assigned_to_host_name.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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} # type: ignore + + def list_premier_add_on_offers( + self, + **kwargs + ) -> AsyncIterable["models.PremierAddOnOfferCollection"]: + """List all premier add-on offers. + + List all premier add-on offers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_premier_add_on_offers.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: + 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('PremierAddOnOfferCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} # type: ignore + + async def list_skus( + self, + **kwargs + ) -> "models.SkuInfos": + """List all SKUs. + + List all SKUs. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + + # Construct URL + url = self.list_skus.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SkuInfos', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} # type: ignore + + async def verify_hosting_environment_vnet( + self, + parameters: "models.VnetParameters", + **kwargs + ) -> "models.VnetValidationFailureDetails": + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + + Verifies if this VNET is compatible with an App Service Environment by analyzing the Network + Security Group rules. + + :param parameters: VNET information. + :type parameters: ~azure.mgmt.web.v2016_03_01.models.VnetParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.verify_hosting_environment_vnet.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VnetParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetValidationFailureDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} # type: ignore + + async def move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Move resources between resource groups. + + Move resources between resource groups. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.move.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + 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 [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, {}) + + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} # type: ignore + + async def validate( + self, + resource_group_name: str, + validate_request: "models.ValidateRequest", + **kwargs + ) -> "models.ValidateResponse": + """Validate if a resource can be created. + + Validate if a resource can be created. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param validate_request: Request with the resources to validate. + :type validate_request: ~azure.mgmt.web.v2016_03_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_request, 'ValidateRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ValidateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} # type: ignore + + async def validate_move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Validate whether a resource can be moved. + + Validate whether a resource can be moved. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_move.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + 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 [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, {}) + + validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/__init__.py index 9ba7d02fc421..079293503ef1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: @@ -14,22 +11,26 @@ from ._models_py3 import AnalysisData from ._models_py3 import AnalysisDefinition from ._models_py3 import ApiDefinitionInfo - from ._models_py3 import ApplicationStack from ._models_py3 import AppServiceEnvironment from ._models_py3 import AppServicePlan from ._models_py3 import AppServicePlanCollection + from ._models_py3 import ApplicationStack + from ._models_py3 import ApplicationStackCollection from ._models_py3 import AutoHealActions from ._models_py3 import AutoHealCustomAction from ._models_py3 import AutoHealRules from ._models_py3 import AutoHealTriggers from ._models_py3 import BillingMeter + from ._models_py3 import BillingMeterCollection from ._models_py3 import Capability from ._models_py3 import Certificate + from ._models_py3 import CertificateCollection from ._models_py3 import CertificatePatchResource from ._models_py3 import CloningInfo from ._models_py3 import ConnStringInfo from ._models_py3 import CorsSettings from ._models_py3 import CsmMoveResourceEnvelope + from ._models_py3 import CsmOperationCollection from ._models_py3 import CsmOperationDescription from ._models_py3 import CsmOperationDescriptionProperties from ._models_py3 import CsmOperationDisplay @@ -38,18 +39,23 @@ from ._models_py3 import DataSource from ._models_py3 import DataTableResponseColumn from ._models_py3 import DataTableResponseObject - from ._models_py3 import DefaultErrorResponse, DefaultErrorResponseException + from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem from ._models_py3 import DeletedSite + from ._models_py3 import DeletedWebAppCollection from ._models_py3 import DeploymentLocations from ._models_py3 import DetectorAbnormalTimePeriod from ._models_py3 import DetectorDefinition from ._models_py3 import DetectorInfo from ._models_py3 import DetectorResponse + from ._models_py3 import DetectorResponseCollection from ._models_py3 import DiagnosticAnalysis + from ._models_py3 import DiagnosticAnalysisCollection from ._models_py3 import DiagnosticCategory + from ._models_py3 import DiagnosticCategoryCollection from ._models_py3 import DiagnosticData + from ._models_py3 import DiagnosticDetectorCollection from ._models_py3 import DiagnosticDetectorResponse from ._models_py3 import DiagnosticMetricSample from ._models_py3 import DiagnosticMetricSet @@ -57,14 +63,16 @@ from ._models_py3 import ErrorEntity from ._models_py3 import Experiments from ._models_py3 import GeoRegion + from ._models_py3 import GeoRegionCollection from ._models_py3 import GlobalCsmSkuDescription from ._models_py3 import HandlerMapping + from ._models_py3 import HostNameSslState from ._models_py3 import HostingEnvironmentDeploymentInfo from ._models_py3 import HostingEnvironmentProfile - from ._models_py3 import HostNameSslState from ._models_py3 import HybridConnection from ._models_py3 import HybridConnectionKey from ._models_py3 import Identifier + from ._models_py3 import IdentifierCollection from ._models_py3 import IpSecurityRestriction from ._models_py3 import LocalizableString from ._models_py3 import ManagedServiceIdentity @@ -75,15 +83,18 @@ from ._models_py3 import NetworkAccessControlEntry from ._models_py3 import Operation from ._models_py3 import PremierAddOnOffer + from ._models_py3 import PremierAddOnOfferCollection from ._models_py3 import ProxyOnlyResource from ._models_py3 import PushSettings from ._models_py3 import RampUpRule from ._models_py3 import Recommendation + from ._models_py3 import RecommendationCollection from ._models_py3 import RecommendationRule from ._models_py3 import Rendering from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource from ._models_py3 import ResourceHealthMetadata + from ._models_py3 import ResourceHealthMetadataCollection from ._models_py3 import ResourceMetric from ._models_py3 import ResourceMetricAvailability from ._models_py3 import ResourceMetricCollection @@ -109,6 +120,7 @@ from ._models_py3 import SnapshotRecoveryTarget from ._models_py3 import Solution from ._models_py3 import SourceControl + from ._models_py3 import SourceControlCollection from ._models_py3 import StackMajorVersion from ._models_py3 import StackMinorVersion from ._models_py3 import StampCapacity @@ -130,173 +142,176 @@ from ._models_py3 import WebAppCollection from ._models_py3 import WorkerPool except (SyntaxError, ImportError): - from ._models import AbnormalTimePeriod - from ._models import AnalysisData - from ._models import AnalysisDefinition - from ._models import ApiDefinitionInfo - from ._models import ApplicationStack - from ._models import AppServiceEnvironment - from ._models import AppServicePlan - from ._models import AppServicePlanCollection - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import BillingMeter - from ._models import Capability - from ._models import Certificate - from ._models import CertificatePatchResource - from ._models import CloningInfo - from ._models import ConnStringInfo - from ._models import CorsSettings - from ._models import CsmMoveResourceEnvelope - from ._models import CsmOperationDescription - from ._models import CsmOperationDescriptionProperties - from ._models import CsmOperationDisplay - from ._models import CsmUsageQuota - from ._models import CsmUsageQuotaCollection - from ._models import DataSource - from ._models import DataTableResponseColumn - from ._models import DataTableResponseObject - from ._models import DefaultErrorResponse, DefaultErrorResponseException - from ._models import DefaultErrorResponseError - from ._models import DefaultErrorResponseErrorDetailsItem - from ._models import DeletedSite - from ._models import DeploymentLocations - from ._models import DetectorAbnormalTimePeriod - from ._models import DetectorDefinition - from ._models import DetectorInfo - from ._models import DetectorResponse - from ._models import DiagnosticAnalysis - from ._models import DiagnosticCategory - from ._models import DiagnosticData - from ._models import DiagnosticDetectorResponse - from ._models import DiagnosticMetricSample - from ._models import DiagnosticMetricSet - from ._models import Dimension - from ._models import ErrorEntity - from ._models import Experiments - from ._models import GeoRegion - from ._models import GlobalCsmSkuDescription - from ._models import HandlerMapping - from ._models import HostingEnvironmentDeploymentInfo - from ._models import HostingEnvironmentProfile - from ._models import HostNameSslState - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import Identifier - from ._models import IpSecurityRestriction - from ._models import LocalizableString - from ._models import ManagedServiceIdentity - from ._models import MetricAvailability - from ._models import MetricSpecification - from ._models import NameIdentifier - from ._models import NameValuePair - from ._models import NetworkAccessControlEntry - from ._models import Operation - from ._models import PremierAddOnOffer - from ._models import ProxyOnlyResource - from ._models import PushSettings - from ._models import RampUpRule - from ._models import Recommendation - from ._models import RecommendationRule - from ._models import Rendering - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceHealthMetadata - from ._models import ResourceMetric - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricCollection - from ._models import ResourceMetricDefinition - from ._models import ResourceMetricDefinitionCollection - from ._models import ResourceMetricName - from ._models import ResourceMetricProperty - from ._models import ResourceMetricValue - from ._models import ResourceNameAvailability - from ._models import ResourceNameAvailabilityRequest - from ._models import ResponseMetaData - from ._models import ServiceSpecification - from ._models import Site - from ._models import SiteConfig - from ._models import SiteLimits - from ._models import SiteMachineKey - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SkuInfos - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import SnapshotRecoveryRequest - from ._models import SnapshotRecoveryTarget - from ._models import Solution - from ._models import SourceControl - from ._models import StackMajorVersion - from ._models import StackMinorVersion - from ._models import StampCapacity - from ._models import StatusCodesBasedTrigger - from ._models import User - from ._models import ValidateRequest - from ._models import ValidateResponse - from ._models import ValidateResponseError - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VirtualIPMapping - from ._models import VirtualNetworkProfile - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetParameters - from ._models import VnetRoute - from ._models import VnetValidationFailureDetails - from ._models import VnetValidationTestFailure - from ._models import WebAppCollection - from ._models import WorkerPool -from ._paged_models import AnalysisDefinitionPaged -from ._paged_models import ApplicationStackPaged -from ._paged_models import BillingMeterPaged -from ._paged_models import CertificatePaged -from ._paged_models import CsmOperationDescriptionPaged -from ._paged_models import DeletedSitePaged -from ._paged_models import DetectorDefinitionPaged -from ._paged_models import DetectorResponsePaged -from ._paged_models import DiagnosticCategoryPaged -from ._paged_models import GeoRegionPaged -from ._paged_models import IdentifierPaged -from ._paged_models import PremierAddOnOfferPaged -from ._paged_models import RecommendationPaged -from ._paged_models import ResourceHealthMetadataPaged -from ._paged_models import SourceControlPaged + from ._models import AbnormalTimePeriod # type: ignore + from ._models import AnalysisData # type: ignore + from ._models import AnalysisDefinition # type: ignore + from ._models import ApiDefinitionInfo # type: ignore + from ._models import AppServiceEnvironment # type: ignore + from ._models import AppServicePlan # type: ignore + from ._models import AppServicePlanCollection # type: ignore + from ._models import ApplicationStack # type: ignore + from ._models import ApplicationStackCollection # type: ignore + from ._models import AutoHealActions # type: ignore + from ._models import AutoHealCustomAction # type: ignore + from ._models import AutoHealRules # type: ignore + from ._models import AutoHealTriggers # type: ignore + from ._models import BillingMeter # type: ignore + from ._models import BillingMeterCollection # type: ignore + from ._models import Capability # type: ignore + from ._models import Certificate # type: ignore + from ._models import CertificateCollection # type: ignore + from ._models import CertificatePatchResource # type: ignore + from ._models import CloningInfo # type: ignore + from ._models import ConnStringInfo # type: ignore + from ._models import CorsSettings # type: ignore + from ._models import CsmMoveResourceEnvelope # type: ignore + from ._models import CsmOperationCollection # type: ignore + from ._models import CsmOperationDescription # type: ignore + from ._models import CsmOperationDescriptionProperties # type: ignore + from ._models import CsmOperationDisplay # type: ignore + from ._models import CsmUsageQuota # type: ignore + from ._models import CsmUsageQuotaCollection # type: ignore + from ._models import DataSource # type: ignore + from ._models import DataTableResponseColumn # type: ignore + from ._models import DataTableResponseObject # type: ignore + from ._models import DefaultErrorResponse # type: ignore + from ._models import DefaultErrorResponseError # type: ignore + from ._models import DefaultErrorResponseErrorDetailsItem # type: ignore + from ._models import DeletedSite # type: ignore + from ._models import DeletedWebAppCollection # type: ignore + from ._models import DeploymentLocations # type: ignore + from ._models import DetectorAbnormalTimePeriod # type: ignore + from ._models import DetectorDefinition # type: ignore + from ._models import DetectorInfo # type: ignore + from ._models import DetectorResponse # type: ignore + from ._models import DetectorResponseCollection # type: ignore + from ._models import DiagnosticAnalysis # type: ignore + from ._models import DiagnosticAnalysisCollection # type: ignore + from ._models import DiagnosticCategory # type: ignore + from ._models import DiagnosticCategoryCollection # type: ignore + from ._models import DiagnosticData # type: ignore + from ._models import DiagnosticDetectorCollection # type: ignore + from ._models import DiagnosticDetectorResponse # type: ignore + from ._models import DiagnosticMetricSample # type: ignore + from ._models import DiagnosticMetricSet # type: ignore + from ._models import Dimension # type: ignore + from ._models import ErrorEntity # type: ignore + from ._models import Experiments # type: ignore + from ._models import GeoRegion # type: ignore + from ._models import GeoRegionCollection # type: ignore + from ._models import GlobalCsmSkuDescription # type: ignore + from ._models import HandlerMapping # type: ignore + from ._models import HostNameSslState # type: ignore + from ._models import HostingEnvironmentDeploymentInfo # type: ignore + from ._models import HostingEnvironmentProfile # type: ignore + from ._models import HybridConnection # type: ignore + from ._models import HybridConnectionKey # type: ignore + from ._models import Identifier # type: ignore + from ._models import IdentifierCollection # type: ignore + from ._models import IpSecurityRestriction # type: ignore + from ._models import LocalizableString # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import MetricAvailability # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NameIdentifier # type: ignore + from ._models import NameValuePair # type: ignore + from ._models import NetworkAccessControlEntry # type: ignore + from ._models import Operation # type: ignore + from ._models import PremierAddOnOffer # type: ignore + from ._models import PremierAddOnOfferCollection # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import PushSettings # type: ignore + from ._models import RampUpRule # type: ignore + from ._models import Recommendation # type: ignore + from ._models import RecommendationCollection # type: ignore + from ._models import RecommendationRule # type: ignore + from ._models import Rendering # type: ignore + from ._models import RequestsBasedTrigger # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceHealthMetadata # type: ignore + from ._models import ResourceHealthMetadataCollection # type: ignore + from ._models import ResourceMetric # type: ignore + from ._models import ResourceMetricAvailability # type: ignore + from ._models import ResourceMetricCollection # type: ignore + from ._models import ResourceMetricDefinition # type: ignore + from ._models import ResourceMetricDefinitionCollection # type: ignore + from ._models import ResourceMetricName # type: ignore + from ._models import ResourceMetricProperty # type: ignore + from ._models import ResourceMetricValue # type: ignore + from ._models import ResourceNameAvailability # type: ignore + from ._models import ResourceNameAvailabilityRequest # type: ignore + from ._models import ResponseMetaData # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Site # type: ignore + from ._models import SiteConfig # type: ignore + from ._models import SiteLimits # type: ignore + from ._models import SiteMachineKey # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import SkuInfos # type: ignore + from ._models import SlotSwapStatus # type: ignore + from ._models import SlowRequestsBasedTrigger # type: ignore + from ._models import SnapshotRecoveryRequest # type: ignore + from ._models import SnapshotRecoveryTarget # type: ignore + from ._models import Solution # type: ignore + from ._models import SourceControl # type: ignore + from ._models import SourceControlCollection # type: ignore + from ._models import StackMajorVersion # type: ignore + from ._models import StackMinorVersion # type: ignore + from ._models import StampCapacity # type: ignore + from ._models import StatusCodesBasedTrigger # type: ignore + from ._models import User # type: ignore + from ._models import ValidateRequest # type: ignore + from ._models import ValidateResponse # type: ignore + from ._models import ValidateResponseError # type: ignore + from ._models import VirtualApplication # type: ignore + from ._models import VirtualDirectory # type: ignore + from ._models import VirtualIPMapping # type: ignore + from ._models import VirtualNetworkProfile # type: ignore + from ._models import VnetGateway # type: ignore + from ._models import VnetInfo # type: ignore + from ._models import VnetParameters # type: ignore + from ._models import VnetRoute # type: ignore + from ._models import VnetValidationFailureDetails # type: ignore + from ._models import VnetValidationTestFailure # type: ignore + from ._models import WebAppCollection # type: ignore + from ._models import WorkerPool # type: ignore + from ._web_site_management_client_enums import ( - KeyVaultSecretStatus, - RouteType, - ManagedServiceIdentityType, + AccessControlEntryAction, + AppServicePlanRestrictions, AutoHealActionType, + Channels, + CheckNameResourceTypes, + ComputeModeOptions, ConnectionStringType, - ScmType, - ManagedPipelineMode, - SiteLoadBalancing, - SupportedTlsVersions, - SslState, + Enum0, + Enum1, HostType, - UsageState, - SiteAvailabilityState, - StatusOptions, - ProvisioningState, HostingEnvironmentStatus, + InAvailabilityReasonType, InternalLoadBalancingMode, - ComputeModeOptions, - WorkerSizeOptions, - AccessControlEntryAction, - OperationStatus, IssueType, - SolutionType, + KeyVaultSecretStatus, + ManagedPipelineMode, + ManagedServiceIdentityType, + NotificationLevel, + OperationStatus, + ProvisioningState, RenderingType, ResourceScopeType, - NotificationLevel, - Channels, - AppServicePlanRestrictions, - InAvailabilityReasonType, - CheckNameResourceTypes, - ValidateResourceTypes, + RouteType, + ScmType, + SiteAvailabilityState, + SiteLoadBalancing, SkuName, + SolutionType, + SslState, + StatusOptions, + SupportedTlsVersions, + UsageState, + ValidateResourceTypes, + WorkerSizeOptions, ) __all__ = [ @@ -304,22 +319,26 @@ 'AnalysisData', 'AnalysisDefinition', 'ApiDefinitionInfo', - 'ApplicationStack', 'AppServiceEnvironment', 'AppServicePlan', 'AppServicePlanCollection', + 'ApplicationStack', + 'ApplicationStackCollection', 'AutoHealActions', 'AutoHealCustomAction', 'AutoHealRules', 'AutoHealTriggers', 'BillingMeter', + 'BillingMeterCollection', 'Capability', 'Certificate', + 'CertificateCollection', 'CertificatePatchResource', 'CloningInfo', 'ConnStringInfo', 'CorsSettings', 'CsmMoveResourceEnvelope', + 'CsmOperationCollection', 'CsmOperationDescription', 'CsmOperationDescriptionProperties', 'CsmOperationDisplay', @@ -328,18 +347,23 @@ 'DataSource', 'DataTableResponseColumn', 'DataTableResponseObject', - 'DefaultErrorResponse', 'DefaultErrorResponseException', + 'DefaultErrorResponse', 'DefaultErrorResponseError', 'DefaultErrorResponseErrorDetailsItem', 'DeletedSite', + 'DeletedWebAppCollection', 'DeploymentLocations', 'DetectorAbnormalTimePeriod', 'DetectorDefinition', 'DetectorInfo', 'DetectorResponse', + 'DetectorResponseCollection', 'DiagnosticAnalysis', + 'DiagnosticAnalysisCollection', 'DiagnosticCategory', + 'DiagnosticCategoryCollection', 'DiagnosticData', + 'DiagnosticDetectorCollection', 'DiagnosticDetectorResponse', 'DiagnosticMetricSample', 'DiagnosticMetricSet', @@ -347,14 +371,16 @@ 'ErrorEntity', 'Experiments', 'GeoRegion', + 'GeoRegionCollection', 'GlobalCsmSkuDescription', 'HandlerMapping', + 'HostNameSslState', 'HostingEnvironmentDeploymentInfo', 'HostingEnvironmentProfile', - 'HostNameSslState', 'HybridConnection', 'HybridConnectionKey', 'Identifier', + 'IdentifierCollection', 'IpSecurityRestriction', 'LocalizableString', 'ManagedServiceIdentity', @@ -365,15 +391,18 @@ 'NetworkAccessControlEntry', 'Operation', 'PremierAddOnOffer', + 'PremierAddOnOfferCollection', 'ProxyOnlyResource', 'PushSettings', 'RampUpRule', 'Recommendation', + 'RecommendationCollection', 'RecommendationRule', 'Rendering', 'RequestsBasedTrigger', 'Resource', 'ResourceHealthMetadata', + 'ResourceHealthMetadataCollection', 'ResourceMetric', 'ResourceMetricAvailability', 'ResourceMetricCollection', @@ -399,6 +428,7 @@ 'SnapshotRecoveryTarget', 'Solution', 'SourceControl', + 'SourceControlCollection', 'StackMajorVersion', 'StackMinorVersion', 'StampCapacity', @@ -419,51 +449,38 @@ 'VnetValidationTestFailure', 'WebAppCollection', 'WorkerPool', - 'CertificatePaged', - 'DeletedSitePaged', - 'DetectorResponsePaged', - 'DiagnosticCategoryPaged', - 'AnalysisDefinitionPaged', - 'DetectorDefinitionPaged', - 'ApplicationStackPaged', - 'CsmOperationDescriptionPaged', - 'RecommendationPaged', - 'ResourceHealthMetadataPaged', - 'SourceControlPaged', - 'GeoRegionPaged', - 'IdentifierPaged', - 'PremierAddOnOfferPaged', - 'BillingMeterPaged', - 'KeyVaultSecretStatus', - 'RouteType', - 'ManagedServiceIdentityType', + 'AccessControlEntryAction', + 'AppServicePlanRestrictions', 'AutoHealActionType', + 'Channels', + 'CheckNameResourceTypes', + 'ComputeModeOptions', 'ConnectionStringType', - 'ScmType', - 'ManagedPipelineMode', - 'SiteLoadBalancing', - 'SupportedTlsVersions', - 'SslState', + 'Enum0', + 'Enum1', 'HostType', - 'UsageState', - 'SiteAvailabilityState', - 'StatusOptions', - 'ProvisioningState', 'HostingEnvironmentStatus', + 'InAvailabilityReasonType', 'InternalLoadBalancingMode', - 'ComputeModeOptions', - 'WorkerSizeOptions', - 'AccessControlEntryAction', - 'OperationStatus', 'IssueType', - 'SolutionType', + 'KeyVaultSecretStatus', + 'ManagedPipelineMode', + 'ManagedServiceIdentityType', + 'NotificationLevel', + 'OperationStatus', + 'ProvisioningState', 'RenderingType', 'ResourceScopeType', - 'NotificationLevel', - 'Channels', - 'AppServicePlanRestrictions', - 'InAvailabilityReasonType', - 'CheckNameResourceTypes', - 'ValidateResourceTypes', + 'RouteType', + 'ScmType', + 'SiteAvailabilityState', + 'SiteLoadBalancing', 'SkuName', + 'SolutionType', + 'SslState', + 'StatusOptions', + 'SupportedTlsVersions', + 'UsageState', + 'ValidateResourceTypes', + 'WorkerSizeOptions', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models.py index a73b194762c5..31fb52e61567 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models.py @@ -1,29 +1,25 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AbnormalTimePeriod(Model): +class AbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period identified in diagnosis. - :param start_time: Start time of the downtime - :type start_time: datetime - :param end_time: End time of the downtime - :type end_time: datetime - :param events: List of Possible Cause of downtime - :type events: - list[~azure.mgmt.web.v2016_03_01.models.DetectorAbnormalTimePeriod] - :param solutions: List of proposed solutions + :param start_time: Start time of the downtime. + :type start_time: ~datetime.datetime + :param end_time: End time of the downtime. + :type end_time: ~datetime.datetime + :param events: List of Possible Cause of downtime. + :type events: list[~azure.mgmt.web.v2016_03_01.models.DetectorAbnormalTimePeriod] + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2016_03_01.models.Solution] """ @@ -34,7 +30,10 @@ class AbnormalTimePeriod(Model): 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AbnormalTimePeriod, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -42,22 +41,19 @@ def __init__(self, **kwargs): self.solutions = kwargs.get('solutions', None) -class AnalysisData(Model): +class AnalysisData(msrest.serialization.Model): """Class Representing Detector Evidence used for analysis. - :param source: Name of the Detector + :param source: Name of the Detector. :type source: str - :param detector_definition: Detector Definition - :type detector_definition: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition - :param metrics: Source Metrics - :type metrics: - list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] - :param data: Additional Source Data + :param detector_definition: Detector Definition. + :type detector_definition: ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition + :param metrics: Source Metrics. + :type metrics: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] + :param data: Additional Source Data. :type data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] - :param detector_meta_data: Detector Meta Data - :type detector_meta_data: - ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData + :param detector_meta_data: Detector Meta Data. + :type detector_meta_data: ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData """ _attribute_map = { @@ -68,7 +64,10 @@ class AnalysisData(Model): 'detector_meta_data': {'key': 'detectorMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnalysisData, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.detector_definition = kwargs.get('detector_definition', None) @@ -77,12 +76,10 @@ def __init__(self, **kwargs): self.detector_meta_data = kwargs.get('detector_meta_data', None) -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -107,7 +104,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -118,8 +118,7 @@ def __init__(self, **kwargs): class AnalysisDefinition(ProxyOnlyResource): """Definition of Analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -129,7 +128,7 @@ class AnalysisDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the Analysis + :ivar description: Description of the Analysis. :vartype description: str """ @@ -148,12 +147,15 @@ class AnalysisDefinition(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnalysisDefinition, self).__init__(**kwargs) self.description = None -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -164,12 +166,15 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = kwargs.get('url', None) -class ApplicationStack(Model): +class ApplicationStack(msrest.serialization.Model): """Application stack. :param name: Application stack name. @@ -179,11 +184,9 @@ class ApplicationStack(Model): :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2016_03_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2016_03_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] """ _attribute_map = { @@ -194,7 +197,10 @@ class ApplicationStack(Model): 'frameworks': {'key': 'frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationStack, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -203,61 +209,85 @@ def __init__(self, **kwargs): self.frameworks = kwargs.get('frameworks', None) -class AppServiceEnvironment(Model): +class ApplicationStackCollection(msrest.serialization.Model): + """Collection of Application Stacks. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationStack]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationStackCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class AppServiceEnvironment(msrest.serialization.Model): """Description of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param name: Required. Name of the App Service Environment. :type name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param location: Required. Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_03_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_03_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2016_03_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :type virtual_network: ~azure.mgmt.web.v2016_03_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2016_03_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Required. Description of worker pools with worker size IDs, VM sizes, and + number of workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2016_03_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -265,35 +295,29 @@ class AppServiceEnvironment(Model): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2016_03_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2016_03_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2016_03_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2016_03_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2016_03_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -301,25 +325,23 @@ class AppServiceEnvironment(Model): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] """ @@ -350,13 +372,13 @@ class AppServiceEnvironment(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, 'vnet_name': {'key': 'vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'workerPools', 'type': '[WorkerPool]'}, @@ -386,20 +408,23 @@ class AppServiceEnvironment(Model): 'user_whitelisted_ip_ranges': {'key': 'userWhitelistedIpRanges', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironment, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.location = kwargs.get('location', None) + self.name = kwargs['name'] + self.location = kwargs['location'] self.provisioning_state = None self.status = None self.vnet_name = kwargs.get('vnet_name', None) self.vnet_resource_group_name = kwargs.get('vnet_resource_group_name', None) self.vnet_subnet_name = kwargs.get('vnet_subnet_name', None) - self.virtual_network = kwargs.get('virtual_network', None) + self.virtual_network = kwargs['virtual_network'] self.internal_load_balancing_mode = kwargs.get('internal_load_balancing_mode', None) self.multi_size = kwargs.get('multi_size', None) self.multi_role_count = kwargs.get('multi_role_count', None) - self.worker_pools = kwargs.get('worker_pools', None) + self.worker_pools = kwargs['worker_pools'] self.ipssl_address_count = kwargs.get('ipssl_address_count', None) self.database_edition = None self.database_service_objective = None @@ -426,11 +451,10 @@ def __init__(self, **kwargs): self.user_whitelisted_ip_ranges = kwargs.get('user_whitelisted_ip_ranges', None) -class Resource(Model): +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -444,7 +468,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -464,12 +488,15 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.type = None self.tags = kwargs.get('tags', None) @@ -477,8 +504,7 @@ def __init__(self, **kwargs): class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -492,58 +518,52 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2016_03_01.models.SkuDescription + :param name_properties_name: Name for the App Service plan. + :type name_properties_name: str + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2016_03_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str :param admin_site_name: App Service plan administration site. :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_03_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2016_03_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_03_01.models.ProvisioningState """ _validation = { @@ -551,7 +571,6 @@ class AppServicePlan(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, 'status': {'readonly': True}, 'subscription': {'readonly': True}, 'maximum_number_of_workers': {'readonly': True}, @@ -568,9 +587,10 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, @@ -584,13 +604,16 @@ class AppServicePlan(Resource): 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlan, self).__init__(**kwargs) - self.app_service_plan_name = kwargs.get('app_service_plan_name', None) + self.sku = kwargs.get('sku', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None self.subscription = None @@ -607,10 +630,9 @@ def __init__(self, **kwargs): self.target_worker_count = kwargs.get('target_worker_count', None) self.target_worker_size_id = kwargs.get('target_worker_size_id', None) self.provisioning_state = None - self.sku = kwargs.get('sku', None) -class AppServicePlanCollection(Model): +class AppServicePlanCollection(msrest.serialization.Model): """Collection of App Service plans. All required parameters must be populated in order to send to Azure. @@ -630,43 +652,47 @@ class AppServicePlanCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlanCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.next_link = kwargs.get('next_link', None) -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2016_03_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2016_03_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2016_03_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2016_03_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) self.custom_action = kwargs.get('custom_action', None) self.min_process_execution_time = kwargs.get('min_process_execution_time', None) -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -679,17 +705,19 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = kwargs.get('exe', None) self.parameters = kwargs.get('parameters', None) -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2016_03_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2016_03_01.models.AutoHealActions @@ -700,13 +728,16 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = kwargs.get('triggers', None) self.actions = kwargs.get('actions', None) -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -714,11 +745,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2016_03_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2016_03_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2016_03_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2016_03_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -728,7 +757,10 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = kwargs.get('requests', None) self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) @@ -737,11 +769,9 @@ def __init__(self, **kwargs): class BillingMeter(ProxyOnlyResource): - """App Service billing entity that contains information about meter which the - Azure billing system utilizes to charge users for services. + """App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -751,15 +781,15 @@ class BillingMeter(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param meter_id: Meter GUID onboarded in Commerce + :param meter_id: Meter GUID onboarded in Commerce. :type meter_id: str - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param short_name: Short Name from App Service Azure pricing Page + :param short_name: Short Name from App Service Azure pricing Page. :type short_name: str - :param friendly_name: Friendly name of the meter + :param friendly_name: Friendly name of the meter. :type friendly_name: str - :param resource_type: App Service resource type meter used for + :param resource_type: App Service resource type meter used for. :type resource_type: str """ @@ -781,7 +811,10 @@ class BillingMeter(ProxyOnlyResource): 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BillingMeter, self).__init__(**kwargs) self.meter_id = kwargs.get('meter_id', None) self.billing_location = kwargs.get('billing_location', None) @@ -790,7 +823,39 @@ def __init__(self, **kwargs): self.resource_type = kwargs.get('resource_type', None) -class Capability(Model): +class BillingMeterCollection(msrest.serialization.Model): + """Collection of Billing Meters. + + 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. + + :param value: Required. Collection of Billing Meters. + :type value: list[~azure.mgmt.web.v2016_03_01.models.BillingMeter] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingMeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BillingMeterCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -807,7 +872,10 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -817,8 +885,7 @@ def __init__(self, **kwargs): class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -832,7 +899,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -849,39 +916,37 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2016_03_01.models.KeyVaultSecretStatus :ivar geo_region: Region of the certificate. :vartype geo_region: str - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -898,7 +963,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -932,12 +996,15 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Certificate, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -961,14 +1028,43 @@ def __init__(self, **kwargs): self.server_farm_id = kwargs.get('server_farm_id', None) -class CertificatePatchResource(ProxyOnlyResource): - """ARM resource for a certificate. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CertificatePatchResource(ProxyOnlyResource): + """ARM resource for a certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -992,39 +1088,37 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2016_03_01.models.KeyVaultSecretStatus :ivar geo_region: Region of the certificate. :vartype geo_region: str - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -1040,7 +1134,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -1072,12 +1165,15 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePatchResource, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -1101,51 +1197,49 @@ def __init__(self, **kwargs): self.server_farm_id = kwargs.get('server_farm_id', None) -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. + :param ignore_quotas: :code:`true` if quotas should be ignored; otherwise, + :code:`false`. :type ignore_quotas: bool """ @@ -1167,13 +1261,16 @@ class CloningInfo(Model): 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = kwargs.get('correlation_id', None) self.overwrite = kwargs.get('overwrite', None) self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) + self.source_web_app_id = kwargs['source_web_app_id'] self.hosting_environment = kwargs.get('hosting_environment', None) self.app_settings_overrides = kwargs.get('app_settings_overrides', None) self.configure_load_balancing = kwargs.get('configure_load_balancing', None) @@ -1182,45 +1279,40 @@ def __init__(self, **kwargs): self.ignore_quotas = kwargs.get('ignore_quotas', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_03_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.connection_string = kwargs.get('connection_string', None) self.type = kwargs.get('type', None) -class CorsSettings(Model): +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] """ @@ -1229,14 +1321,16 @@ class CorsSettings(Model): 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = kwargs.get('allowed_origins', None) -class CsmMoveResourceEnvelope(Model): - """Object with a list of the resources that need to be moved and the resource - group they should be moved to. +class CsmMoveResourceEnvelope(msrest.serialization.Model): + """Object with a list of the resources that need to be moved and the resource group they should be moved to. :param target_resource_group: :type target_resource_group: str @@ -1253,24 +1347,58 @@ class CsmMoveResourceEnvelope(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmMoveResourceEnvelope, self).__init__(**kwargs) self.target_resource_group = kwargs.get('target_resource_group', None) self.resources = kwargs.get('resources', None) -class CsmOperationDescription(Model): +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2016_03_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2016_03_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2016_03_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -1280,7 +1408,10 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1288,24 +1419,27 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2016_03_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2016_03_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -1325,7 +1459,10 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1333,13 +1470,13 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -1356,7 +1493,10 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = kwargs.get('unit', None) self.next_reset_time = kwargs.get('next_reset_time', None) @@ -1365,11 +1505,10 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) -class CsmUsageQuotaCollection(Model): +class CsmUsageQuotaCollection(msrest.serialization.Model): """Collection of CSM usage quotas. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1389,20 +1528,22 @@ class CsmUsageQuotaCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmUsageQuotaCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.next_link = None -class DataSource(Model): +class DataSource(msrest.serialization.Model): """Class representing data source used by the detectors. - :param instructions: Instructions if any for the data source + :param instructions: Instructions if any for the data source. :type instructions: list[str] - :param data_source_uri: Datasource Uri Links - :type data_source_uri: - list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] + :param data_source_uri: Datasource Uri Links. + :type data_source_uri: list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] """ _attribute_map = { @@ -1410,20 +1551,23 @@ class DataSource(Model): 'data_source_uri': {'key': 'dataSourceUri', 'type': '[NameValuePair]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataSource, self).__init__(**kwargs) self.instructions = kwargs.get('instructions', None) self.data_source_uri = kwargs.get('data_source_uri', None) -class DataTableResponseColumn(Model): +class DataTableResponseColumn(msrest.serialization.Model): """Column definition. - :param column_name: Name of the column + :param column_name: Name of the column. :type column_name: str :param data_type: Data type which looks like 'String' or 'Int32'. :type data_type: str - :param column_type: Column Type + :param column_type: Column Type. :type column_type: str """ @@ -1433,22 +1577,24 @@ class DataTableResponseColumn(Model): 'column_type': {'key': 'columnType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataTableResponseColumn, self).__init__(**kwargs) self.column_name = kwargs.get('column_name', None) self.data_type = kwargs.get('data_type', None) self.column_type = kwargs.get('column_type', None) -class DataTableResponseObject(Model): +class DataTableResponseObject(msrest.serialization.Model): """Data Table which defines columns and raw row values. - :param table_name: Name of the table + :param table_name: Name of the table. :type table_name: str - :param columns: List of columns with data types - :type columns: - list[~azure.mgmt.web.v2016_03_01.models.DataTableResponseColumn] - :param rows: Raw row values + :param columns: List of columns with data types. + :type columns: list[~azure.mgmt.web.v2016_03_01.models.DataTableResponseColumn] + :param rows: Raw row values. :type rows: list[list[str]] """ @@ -1458,22 +1604,23 @@ class DataTableResponseObject(Model): 'rows': {'key': 'rows', 'type': '[[str]]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataTableResponseObject, self).__init__(**kwargs) self.table_name = kwargs.get('table_name', None) self.columns = kwargs.get('columns', None) self.rows = kwargs.get('rows', None) -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseError """ _validation = { @@ -1484,28 +1631,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -1514,8 +1651,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -1535,7 +1671,10 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -1544,11 +1683,10 @@ def __init__(self, **kwargs): self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -1570,30 +1708,32 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None self.target = None -class DeletedSite(Model): +class DeletedSite(msrest.serialization.Model): """A deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param id: Numeric id for the deleted site + :param id: Numeric id for the deleted site. :type id: int :ivar deleted_timestamp: Time in UTC when the app was deleted. :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site + :ivar subscription: Subscription containing the deleted site. :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site + :ivar resource_group: ResourceGroup that contained the deleted site. :vartype resource_group: str - :ivar name: Name of the deleted site + :ivar name: Name of the deleted site. :vartype name: str - :ivar slot: Slot of the deleted site + :ivar slot: Slot of the deleted site. :vartype slot: str """ @@ -1614,7 +1754,10 @@ class DeletedSite(Model): 'slot': {'key': 'slot', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSite, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.deleted_timestamp = None @@ -1624,18 +1767,49 @@ def __init__(self, **kwargs): self.slot = None -class DeploymentLocations(Model): +class DeletedWebAppCollection(msrest.serialization.Model): + """Collection of deleted apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DeletedSite] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedWebAppCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DeploymentLocations(msrest.serialization.Model): """List of available locations (regions or App Service Environments) for - deployment of App Service resources. +deployment of App Service resources. :param locations: Available regions. :type locations: list[~azure.mgmt.web.v2016_03_01.models.GeoRegion] - :param hosting_environments: Available App Service Environments with full - descriptions of the environments. - :type hosting_environments: - list[~azure.mgmt.web.v2016_03_01.models.AppServiceEnvironment] - :param hosting_environment_deployment_infos: Available App Service - Environments with basic information. + :param hosting_environments: Available App Service Environments with full descriptions of the + environments. + :type hosting_environments: list[~azure.mgmt.web.v2016_03_01.models.AppServiceEnvironment] + :param hosting_environment_deployment_infos: Available App Service Environments with basic + information. :type hosting_environment_deployment_infos: list[~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentDeploymentInfo] """ @@ -1646,34 +1820,36 @@ class DeploymentLocations(Model): 'hosting_environment_deployment_infos': {'key': 'hostingEnvironmentDeploymentInfos', 'type': '[HostingEnvironmentDeploymentInfo]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentLocations, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.hosting_environments = kwargs.get('hosting_environments', None) self.hosting_environment_deployment_infos = kwargs.get('hosting_environment_deployment_infos', None) -class DetectorAbnormalTimePeriod(Model): +class DetectorAbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period detected. - :param start_time: Start time of the correlated event - :type start_time: datetime - :param end_time: End time of the correlated event - :type end_time: datetime - :param message: Message describing the event + :param start_time: Start time of the correlated event. + :type start_time: ~datetime.datetime + :param end_time: End time of the correlated event. + :type end_time: ~datetime.datetime + :param message: Message describing the event. :type message: str - :param source: Represents the name of the Detector + :param source: Represents the name of the Detector. :type source: str - :param priority: Represents the rank of the Detector + :param priority: Represents the rank of the Detector. :type priority: float - :param meta_data: Downtime metadata - :type meta_data: - list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] - :param type: Represents the type of the Detector. Possible values include: - 'ServiceIncident', 'AppDeployment', 'AppCrash', 'RuntimeIssueDetected', - 'AseDeployment', 'UserIssue', 'PlatformIssue', 'Other' + :param meta_data: Downtime metadata. + :type meta_data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] + :param type: Represents the type of the Detector. Possible values include: "ServiceIncident", + "AppDeployment", "AppCrash", "RuntimeIssueDetected", "AseDeployment", "UserIssue", + "PlatformIssue", "Other". :type type: str or ~azure.mgmt.web.v2016_03_01.models.IssueType - :param solutions: List of proposed solutions + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2016_03_01.models.Solution] """ @@ -1684,11 +1860,14 @@ class DetectorAbnormalTimePeriod(Model): 'source': {'key': 'source', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'float'}, 'meta_data': {'key': 'metaData', 'type': '[[NameValuePair]]'}, - 'type': {'key': 'type', 'type': 'IssueType'}, + 'type': {'key': 'type', 'type': 'str'}, 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorAbnormalTimePeriod, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -1703,8 +1882,7 @@ def __init__(self, **kwargs): class DetectorDefinition(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1714,11 +1892,11 @@ class DetectorDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar display_name: Display name of the detector + :ivar display_name: Display name of the detector. :vartype display_name: str - :ivar description: Description of the detector + :ivar description: Description of the detector. :vartype description: str - :ivar rank: Detector Rank + :ivar rank: Detector Rank. :vartype rank: float :ivar is_enabled: Flag representing whether detector is enabled or not. :vartype is_enabled: bool @@ -1745,7 +1923,10 @@ class DetectorDefinition(ProxyOnlyResource): 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorDefinition, self).__init__(**kwargs) self.display_name = None self.description = None @@ -1753,19 +1934,18 @@ def __init__(self, **kwargs): self.is_enabled = None -class DetectorInfo(Model): +class DetectorInfo(msrest.serialization.Model): """Definition of Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Short description of the detector and its purpose + :ivar description: Short description of the detector and its purpose. :vartype description: str - :ivar category: Support Category + :ivar category: Support Category. :vartype category: str - :ivar sub_category: Support Sub Category + :ivar sub_category: Support Sub Category. :vartype sub_category: str - :ivar support_topic_id: Support Topic Id + :ivar support_topic_id: Support Topic Id. :vartype support_topic_id: str """ @@ -1783,7 +1963,10 @@ class DetectorInfo(Model): 'support_topic_id': {'key': 'supportTopicId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorInfo, self).__init__(**kwargs) self.description = None self.category = None @@ -1794,8 +1977,7 @@ def __init__(self, **kwargs): class DetectorResponse(ProxyOnlyResource): """Class representing Response from Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1805,9 +1987,9 @@ class DetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param metadata: metadata for the detector + :param metadata: metadata for the detector. :type metadata: ~azure.mgmt.web.v2016_03_01.models.DetectorInfo - :param dataset: Data Set + :param dataset: Data Set. :type dataset: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticData] """ @@ -1826,17 +2008,51 @@ class DetectorResponse(ProxyOnlyResource): 'dataset': {'key': 'properties.dataset', 'type': '[DiagnosticData]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorResponse, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.dataset = kwargs.get('dataset', None) +class DetectorResponseCollection(msrest.serialization.Model): + """Collection of detector responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DetectorResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DetectorResponseCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticAnalysis(ProxyOnlyResource): """Class representing a diagnostic analysis done on an application. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1846,19 +2062,16 @@ class DiagnosticAnalysis(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param abnormal_time_periods: List of time periods. - :type abnormal_time_periods: - list[~azure.mgmt.web.v2016_03_01.models.AbnormalTimePeriod] - :param payload: Data by each detector + :type abnormal_time_periods: list[~azure.mgmt.web.v2016_03_01.models.AbnormalTimePeriod] + :param payload: Data by each detector. :type payload: list[~azure.mgmt.web.v2016_03_01.models.AnalysisData] - :param non_correlated_detectors: Data by each detector for detectors that - did not corelate - :type non_correlated_detectors: - list[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] + :param non_correlated_detectors: Data by each detector for detectors that did not corelate. + :type non_correlated_detectors: list[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] """ _validation = { @@ -1879,7 +2092,10 @@ class DiagnosticAnalysis(ProxyOnlyResource): 'non_correlated_detectors': {'key': 'properties.nonCorrelatedDetectors', 'type': '[DetectorDefinition]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticAnalysis, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -1888,11 +2104,42 @@ def __init__(self, **kwargs): self.non_correlated_detectors = kwargs.get('non_correlated_detectors', None) +class DiagnosticAnalysisCollection(msrest.serialization.Model): + """Collection of Diagnostic Analyses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.AnalysisDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticAnalysisCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticCategory(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1902,7 +2149,7 @@ class DiagnosticCategory(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the diagnostic category + :ivar description: Description of the diagnostic category. :vartype description: str """ @@ -1921,18 +2168,52 @@ class DiagnosticCategory(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticCategory, self).__init__(**kwargs) self.description = None -class DiagnosticData(Model): +class DiagnosticCategoryCollection(msrest.serialization.Model): + """Collection of Diagnostic Categories. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticCategory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticCategoryCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DiagnosticData(msrest.serialization.Model): """Set of data with rendering instructions. - :param table: Data in table form + :param table: Data in table form. :type table: ~azure.mgmt.web.v2016_03_01.models.DataTableResponseObject - :param rendering_properties: Properties that describe how the table should - be rendered + :param rendering_properties: Properties that describe how the table should be rendered. :type rendering_properties: ~azure.mgmt.web.v2016_03_01.models.Rendering """ @@ -1941,17 +2222,51 @@ class DiagnosticData(Model): 'rendering_properties': {'key': 'renderingProperties', 'type': 'Rendering'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticData, self).__init__(**kwargs) self.table = kwargs.get('table', None) self.rendering_properties = kwargs.get('rendering_properties', None) +class DiagnosticDetectorCollection(msrest.serialization.Model): + """Collection of Diagnostic Detectors. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticDetectorCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticDetectorResponse(ProxyOnlyResource): """Class representing Response from Diagnostic Detectors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1961,27 +2276,23 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param issue_detected: Flag representing Issue was detected. :type issue_detected: bool - :param detector_definition: Detector's definition - :type detector_definition: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition - :param metrics: Metrics provided by the detector - :type metrics: - list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] - :param abnormal_time_periods: List of Correlated events found by the - detector + :param detector_definition: Detector's definition. + :type detector_definition: ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition + :param metrics: Metrics provided by the detector. + :type metrics: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] + :param abnormal_time_periods: List of Correlated events found by the detector. :type abnormal_time_periods: list[~azure.mgmt.web.v2016_03_01.models.DetectorAbnormalTimePeriod] :param data: Additional Data that detector wants to send. :type data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] - :param response_meta_data: Meta Data - :type response_meta_data: - ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData + :param response_meta_data: Meta Data. + :type response_meta_data: ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData """ _validation = { @@ -2005,7 +2316,10 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): 'response_meta_data': {'key': 'properties.responseMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticDetectorResponse, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -2017,28 +2331,24 @@ def __init__(self, **kwargs): self.response_meta_data = kwargs.get('response_meta_data', None) -class DiagnosticMetricSample(Model): +class DiagnosticMetricSample(msrest.serialization.Model): """Class representing Diagnostic Metric. - :param timestamp: Time at which metric is measured - :type timestamp: datetime - :param role_instance: Role Instance. Null if this counter is not per - instance - This is returned and should be whichever instance name we desire to be - returned + :param timestamp: Time at which metric is measured. + :type timestamp: ~datetime.datetime + :param role_instance: Role Instance. Null if this counter is not per instance + This is returned and should be whichever instance name we desire to be returned i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) - where RDWORKERNAME is Machine name below and RoleInstance name in - parenthesis + where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis. :type role_instance: str - :param total: Total value of the metric. If multiple measurements are made - this will have sum of all. + :param total: Total value of the metric. If multiple measurements are made this will have sum + of all. :type total: float - :param maximum: Maximum of the metric sampled during the time period + :param maximum: Maximum of the metric sampled during the time period. :type maximum: float - :param minimum: Minimum of the metric sampled during the time period + :param minimum: Minimum of the metric sampled during the time period. :type minimum: float - :param is_aggregated: Whether the values are aggregates across all workers - or not + :param is_aggregated: Whether the values are aggregates across all workers or not. :type is_aggregated: bool """ @@ -2051,7 +2361,10 @@ class DiagnosticMetricSample(Model): 'is_aggregated': {'key': 'isAggregated', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticMetricSample, self).__init__(**kwargs) self.timestamp = kwargs.get('timestamp', None) self.role_instance = kwargs.get('role_instance', None) @@ -2061,25 +2374,22 @@ def __init__(self, **kwargs): self.is_aggregated = kwargs.get('is_aggregated', None) -class DiagnosticMetricSet(Model): +class DiagnosticMetricSet(msrest.serialization.Model): """Class representing Diagnostic Metric information. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param unit: Metric's unit + :param unit: Metric's unit. :type unit: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime - :param time_grain: Presented time grain. Supported grains at the moment - are PT1M, PT1H, P1D + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime + :param time_grain: Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D. :type time_grain: str - :param values: Collection of metric values for the selected period based - on the - {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} - :type values: - list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSample] + :param values: Collection of metric values for the selected period based on the + {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain}. + :type values: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSample] """ _attribute_map = { @@ -2091,7 +2401,10 @@ class DiagnosticMetricSet(Model): 'values': {'key': 'values', 'type': '[DiagnosticMetricSample]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticMetricSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.unit = kwargs.get('unit', None) @@ -2101,10 +2414,9 @@ def __init__(self, **kwargs): self.values = kwargs.get('values', None) -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -2123,7 +2435,10 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -2131,7 +2446,7 @@ def __init__(self, **kwargs): self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -2157,7 +2472,10 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = kwargs.get('extended_code', None) self.message_template = kwargs.get('message_template', None) @@ -2167,7 +2485,7 @@ def __init__(self, **kwargs): self.message = kwargs.get('message', None) -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -2178,7 +2496,10 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = kwargs.get('ramp_up_rules', None) @@ -2186,8 +2507,7 @@ def __init__(self, **kwargs): class GeoRegion(ProxyOnlyResource): """Geographical region. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2197,8 +2517,8 @@ class GeoRegion(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar geo_region_name: Region name. - :vartype geo_region_name: str + :ivar name_properties_name: Region name. + :vartype name_properties_name: str :ivar description: Region description. :vartype description: str :ivar display_name: Display name for region. @@ -2209,7 +2529,7 @@ class GeoRegion(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'geo_region_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'description': {'readonly': True}, 'display_name': {'readonly': True}, } @@ -2219,19 +2539,54 @@ class GeoRegion(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'geo_region_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GeoRegion, self).__init__(**kwargs) - self.geo_region_name = None + self.name_properties_name = None self.description = None self.display_name = None -class GlobalCsmSkuDescription(Model): +class GeoRegionCollection(msrest.serialization.Model): + """Collection of geographical regions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.GeoRegion] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GeoRegion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoRegionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class GlobalCsmSkuDescription(msrest.serialization.Model): """A Global SKU Description. :param name: Name of the resource SKU. @@ -2246,8 +2601,7 @@ class GlobalCsmSkuDescription(Model): :type capacity: ~azure.mgmt.web.v2016_03_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2016_03_01.models.Capability] """ @@ -2261,7 +2615,10 @@ class GlobalCsmSkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GlobalCsmSkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -2272,19 +2629,16 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -2294,14 +2648,17 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = kwargs.get('extension', None) self.script_processor = kwargs.get('script_processor', None) self.arguments = kwargs.get('arguments', None) -class HostingEnvironmentDeploymentInfo(Model): +class HostingEnvironmentDeploymentInfo(msrest.serialization.Model): """Information needed to create resources on an App Service Environment. :param name: Name of the App Service Environment. @@ -2315,17 +2672,19 @@ class HostingEnvironmentDeploymentInfo(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentDeploymentInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.location = kwargs.get('location', None) -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -2346,43 +2705,48 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None self.type = None -class HostNameSslState(Model): +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_03_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2016_03_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.ssl_state = kwargs.get('ssl_state', None) @@ -2395,8 +2759,7 @@ def __init__(self, **kwargs): class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2416,15 +2779,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -2449,7 +2812,10 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnection, self).__init__(**kwargs) self.service_bus_namespace = kwargs.get('service_bus_namespace', None) self.relay_name = kwargs.get('relay_name', None) @@ -2462,11 +2828,9 @@ def __init__(self, **kwargs): class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2499,7 +2863,10 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionKey, self).__init__(**kwargs) self.send_key_name = None self.send_key_value = None @@ -2508,8 +2875,7 @@ def __init__(self, **kwargs): class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2519,8 +2885,8 @@ class Identifier(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str + :param id_properties_id: String representation of the identity. + :type id_properties_id: str """ _validation = { @@ -2534,24 +2900,57 @@ class Identifier(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) + self.id_properties_id = kwargs.get('id_properties_id', None) + + +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class IpSecurityRestriction(Model): +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP address the security restriction is valid - for. + :param ip_address: Required. IP address the security restriction is valid for. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str """ @@ -2564,13 +2963,16 @@ class IpSecurityRestriction(Model): 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = kwargs.get('ip_address', None) + self.ip_address = kwargs['ip_address'] self.subnet_mask = kwargs.get('subnet_mask', None) -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -2584,22 +2986,22 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned". + :type type: str or ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. @@ -2617,14 +3019,17 @@ class ManagedServiceIdentity(Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.tenant_id = None self.principal_id = None -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -2638,13 +3043,16 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.blob_duration = kwargs.get('blob_duration', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -2676,8 +3084,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2016_03_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2016_03_01.models.MetricAvailability] """ _attribute_map = { @@ -2698,7 +3105,10 @@ class MetricSpecification(Model): 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -2717,7 +3127,7 @@ def __init__(self, **kwargs): self.availabilities = kwargs.get('availabilities', None) -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -2728,12 +3138,15 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -2747,18 +3160,20 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2016_03_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2016_03_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -2768,13 +3183,16 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = kwargs.get('action', None) self.description = kwargs.get('description', None) @@ -2782,24 +3200,24 @@ def __init__(self, **kwargs): self.remote_subnet = kwargs.get('remote_subnet', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2016_03_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2016_03_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -2807,7 +3225,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -2815,7 +3233,10 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -2830,8 +3251,7 @@ def __init__(self, **kwargs): class PremierAddOnOffer(ProxyOnlyResource): """Premier add-on offer. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2847,16 +3267,15 @@ class PremierAddOnOffer(ProxyOnlyResource): :type product: str :param vendor: Premier add on offer Vendor. :type vendor: str - :param premier_add_on_offer_name: Premier add on offer Name. - :type premier_add_on_offer_name: str - :param promo_code_required: true if promotion code is - required; otherwise, false. + :param name_properties_name: Premier add on offer Name. + :type name_properties_name: str + :param promo_code_required: :code:`true` if promotion code is required; otherwise, + :code:`false`. :type promo_code_required: bool :param quota: Premier add on offer Quota. :type quota: int - :param web_hosting_plan_restrictions: App Service plans this offer is - restricted to. Possible values include: 'None', 'Free', 'Shared', 'Basic', - 'Standard', 'Premium' + :param web_hosting_plan_restrictions: App Service plans this offer is restricted to. Possible + values include: "None", "Free", "Shared", "Basic", "Standard", "Premium". :type web_hosting_plan_restrictions: str or ~azure.mgmt.web.v2016_03_01.models.AppServicePlanRestrictions :param privacy_policy_url: Privacy policy URL. @@ -2883,22 +3302,25 @@ class PremierAddOnOffer(ProxyOnlyResource): 'sku': {'key': 'properties.sku', 'type': 'str'}, 'product': {'key': 'properties.product', 'type': 'str'}, 'vendor': {'key': 'properties.vendor', 'type': 'str'}, - 'premier_add_on_offer_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'promo_code_required': {'key': 'properties.promoCodeRequired', 'type': 'bool'}, 'quota': {'key': 'properties.quota', 'type': 'int'}, - 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'AppServicePlanRestrictions'}, + 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'str'}, 'privacy_policy_url': {'key': 'properties.privacyPolicyUrl', 'type': 'str'}, 'legal_terms_url': {'key': 'properties.legalTermsUrl', 'type': 'str'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOnOffer, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) self.vendor = kwargs.get('vendor', None) - self.premier_add_on_offer_name = kwargs.get('premier_add_on_offer_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.promo_code_required = kwargs.get('promo_code_required', None) self.quota = kwargs.get('quota', None) self.web_hosting_plan_restrictions = kwargs.get('web_hosting_plan_restrictions', None) @@ -2908,14 +3330,43 @@ def __init__(self, **kwargs): self.marketplace_offer = kwargs.get('marketplace_offer', None) -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PremierAddOnOfferCollection(msrest.serialization.Model): + """Collection of premier add-on offers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOffer] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremierAddOnOffer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremierAddOnOfferCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2924,22 +3375,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -2947,7 +3395,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -2961,7 +3408,10 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PushSettings, self).__init__(**kwargs) self.is_push_enabled = kwargs.get('is_push_enabled', None) self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) @@ -2969,40 +3419,38 @@ def __init__(self, **kwargs): self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -3017,7 +3465,10 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = kwargs.get('action_host_name', None) self.reroute_percentage = kwargs.get('reroute_percentage', None) @@ -3032,8 +3483,7 @@ def __init__(self, **kwargs): class Recommendation(ProxyOnlyResource): """Represents a recommendation result generated by the recommendation engine. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3044,62 +3494,52 @@ class Recommendation(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param creation_time: Timestamp when this instance was created. - :type creation_time: datetime - :param recommendation_id: A GUID value that each recommendation object is - associated with. + :type creation_time: ~datetime.datetime + :param recommendation_id: A GUID value that each recommendation object is associated with. :type recommendation_id: str - :param resource_id: Full ARM resource ID string that this recommendation - object is associated with. + :param resource_id: Full ARM resource ID string that this recommendation object is associated + with. :type resource_id: str - :param resource_scope: Name of a resource type this recommendation - applies, e.g. Subscription, ServerFarm, Site. Possible values include: - 'ServerFarm', 'Subscription', 'WebSite' - :type resource_scope: str or - ~azure.mgmt.web.v2016_03_01.models.ResourceScopeType + :param resource_scope: Name of a resource type this recommendation applies, e.g. Subscription, + ServerFarm, Site. Possible values include: "ServerFarm", "Subscription", "WebSite". + :type resource_scope: str or ~azure.mgmt.web.v2016_03_01.models.ResourceScopeType :param rule_name: Unique name of the rule. :type rule_name: str :param display_name: UI friendly name of the rule (may not be unique). :type display_name: str :param message: Recommendation text. :type message: str - :param level: Level indicating how critical this recommendation can - impact. Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level indicating how critical this recommendation can impact. Possible values + include: "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2016_03_01.models.NotificationLevel - :param channels: List of channels that this recommendation can apply. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of channels that this recommendation can apply. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2016_03_01.models.Channels - :param tags: The list of category tags that this recommendation belongs - to. + :param tags: A set of tags. The list of category tags that this recommendation belongs to. :type tags: list[str] :param action_name: Name of action recommended by this object. :type action_name: str - :param start_time: The beginning time in UTC of a range that the - recommendation refers to. - :type start_time: datetime - :param end_time: The end time in UTC of a range that the recommendation - refers to. - :type end_time: datetime - :param next_notification_time: When to notify this recommendation next in - UTC. Null means that this will never be notified anymore. - :type next_notification_time: datetime - :param notification_expiration_time: Date and time in UTC when this - notification expires. - :type notification_expiration_time: datetime - :param notified_time: Last timestamp in UTC this instance was actually - notified. Null means that this recommendation hasn't been notified yet. - :type notified_time: datetime + :param start_time: The beginning time in UTC of a range that the recommendation refers to. + :type start_time: ~datetime.datetime + :param end_time: The end time in UTC of a range that the recommendation refers to. + :type end_time: ~datetime.datetime + :param next_notification_time: When to notify this recommendation next in UTC. Null means that + this will never be notified anymore. + :type next_notification_time: ~datetime.datetime + :param notification_expiration_time: Date and time in UTC when this notification expires. + :type notification_expiration_time: ~datetime.datetime + :param notified_time: Last timestamp in UTC this instance was actually notified. Null means + that this recommendation hasn't been notified yet. + :type notified_time: ~datetime.datetime :param score: A metric value measured by the rule. :type score: float - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool :param extension_name: Extension name of the portal if exists. :type extension_name: str :param blade_name: Deep link to a blade on the portal. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. + :param forward_link: Forward link to an external document associated with the rule. :type forward_link: str """ @@ -3121,8 +3561,8 @@ class Recommendation(ProxyOnlyResource): 'rule_name': {'key': 'properties.ruleName', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'tags': {'key': 'properties.tags', 'type': '[str]'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, @@ -3137,7 +3577,10 @@ class Recommendation(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Recommendation, self).__init__(**kwargs) self.creation_time = kwargs.get('creation_time', None) self.recommendation_id = kwargs.get('recommendation_id', None) @@ -3162,12 +3605,42 @@ def __init__(self, **kwargs): self.forward_link = kwargs.get('forward_link', None) +class RecommendationCollection(msrest.serialization.Model): + """Collection of recommendations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.Recommendation] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Recommendation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RecommendationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class RecommendationRule(ProxyOnlyResource): - """Represents a recommendation rule that the recommendation engine can - perform. + """Represents a recommendation rule that the recommendation engine can perform. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3177,41 +3650,36 @@ class RecommendationRule(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param recommendation_rule_name: Unique name of the rule. - :type recommendation_rule_name: str + :param name_properties_name: Unique name of the rule. + :type name_properties_name: str :param display_name: UI friendly name of the rule. :type display_name: str :param message: Localized name of the rule (Good for UI). :type message: str - :param recommendation_id: Recommendation ID of an associated - recommendation object tied to the rule, if exists. + :param recommendation_id: Recommendation ID of an associated recommendation object tied to the + rule, if exists. If such an object doesn't exist, it is set to null. :type recommendation_id: str :param description: Localized detailed description of the rule. :type description: str - :param action_name: Name of action that is recommended by this rule in - string. + :param action_name: Name of action that is recommended by this rule in string. :type action_name: str - :param level: Level of impact indicating how critical this rule is. - Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level of impact indicating how critical this rule is. Possible values include: + "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2016_03_01.models.NotificationLevel - :param channels: List of available channels that this rule applies. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of available channels that this rule applies. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2016_03_01.models.Channels - :param tags: An array of category tags that the rule contains. + :param tags: A set of tags. An array of category tags that the rule contains. :type tags: list[str] - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool - :param extension_name: Extension name of the portal if exists. Applicable - to dynamic rule only. + :param extension_name: Extension name of the portal if exists. Applicable to dynamic rule only. :type extension_name: str - :param blade_name: Deep link to a blade on the portal. Applicable to - dynamic rule only. + :param blade_name: Deep link to a blade on the portal. Applicable to dynamic rule only. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. Applicable to dynamic rule only. + :param forward_link: Forward link to an external document associated with the rule. Applicable + to dynamic rule only. :type forward_link: str """ @@ -3226,14 +3694,14 @@ class RecommendationRule(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'recommendation_rule_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, 'recommendation_id': {'key': 'properties.recommendationId', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'tags': {'key': 'properties.tags', 'type': '[str]'}, 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, 'extension_name': {'key': 'properties.extensionName', 'type': 'str'}, @@ -3241,9 +3709,12 @@ class RecommendationRule(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RecommendationRule, self).__init__(**kwargs) - self.recommendation_rule_name = kwargs.get('recommendation_rule_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.display_name = kwargs.get('display_name', None) self.message = kwargs.get('message', None) self.recommendation_id = kwargs.get('recommendation_id', None) @@ -3258,34 +3729,35 @@ def __init__(self, **kwargs): self.forward_link = kwargs.get('forward_link', None) -class Rendering(Model): +class Rendering(msrest.serialization.Model): """Instructions for rendering the data. - :param rendering_type: Rendering Type. Possible values include: 'NoGraph', - 'Table', 'TimeSeries', 'TimeSeriesPerInstance' - :type rendering_type: str or - ~azure.mgmt.web.v2016_03_01.models.RenderingType - :param title: Title of data + :param rendering_type: Rendering Type. Possible values include: "NoGraph", "Table", + "TimeSeries", "TimeSeriesPerInstance". + :type rendering_type: str or ~azure.mgmt.web.v2016_03_01.models.RenderingType + :param title: Title of data. :type title: str - :param description: Description of the data that will help it be - interpreted + :param description: Description of the data that will help it be interpreted. :type description: str """ _attribute_map = { - 'rendering_type': {'key': 'renderingType', 'type': 'RenderingType'}, + 'rendering_type': {'key': 'renderingType', 'type': 'str'}, 'title': {'key': 'title', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Rendering, self).__init__(**kwargs) self.rendering_type = kwargs.get('rendering_type', None) self.title = kwargs.get('title', None) self.description = kwargs.get('description', None) -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -3299,7 +3771,10 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = kwargs.get('count', None) self.time_interval = kwargs.get('time_interval', None) @@ -3308,8 +3783,7 @@ def __init__(self, **kwargs): class ResourceHealthMetadata(ProxyOnlyResource): """Used for getting ResourceHealthCheck settings. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3319,10 +3793,9 @@ class ResourceHealthMetadata(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param category: The category that the resource matches in the RHC Policy - File + :param category: The category that the resource matches in the RHC Policy File. :type category: str - :param signal_availability: Is there a health signal for the resource + :param signal_availability: Is there a health signal for the resource. :type signal_availability: bool """ @@ -3341,38 +3814,70 @@ class ResourceHealthMetadata(ProxyOnlyResource): 'signal_availability': {'key': 'properties.signalAvailability', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceHealthMetadata, self).__init__(**kwargs) self.category = kwargs.get('category', None) self.signal_availability = kwargs.get('signal_availability', None) -class ResourceMetric(Model): +class ResourceHealthMetadataCollection(msrest.serialization.Model): + """Collection of resource health metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceHealthMetadata]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceHealthMetadataCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2016_03_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] """ _validation = { @@ -3399,7 +3904,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -3412,11 +3920,10 @@ def __init__(self, **kwargs): self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -3434,17 +3941,19 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None -class ResourceMetricCollection(Model): +class ResourceMetricCollection(msrest.serialization.Model): """Collection of metric responses. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3464,17 +3973,19 @@ class ResourceMetricCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.next_link = None class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3484,21 +3995,20 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2016_03_01.models.ResourceMetricName + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: ~azure.mgmt.web.v2016_03_01.models.ResourceMetricName :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str + :ivar id_properties_id: Resource ID. + :vartype id_properties_id: str :ivar properties: Resource metric definition properties. :vartype properties: dict[str, str] """ @@ -3507,12 +4017,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, 'properties': {'readonly': True}, } @@ -3521,37 +4031,38 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(**kwargs) - self.resource_metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.resource_uri = None - self.resource_metric_definition_id = None + self.id_properties_id = None self.properties = None -class ResourceMetricDefinitionCollection(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): """Collection of metric definitions. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param value: Required. Collection of resources. - :type value: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricDefinition] + :type value: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricDefinition] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3566,17 +4077,19 @@ class ResourceMetricDefinitionCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.next_link = None -class ResourceMetricName(Model): +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -3594,13 +4107,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -3614,17 +4130,19 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.value = kwargs.get('value', None) -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -3639,8 +4157,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] """ _validation = { @@ -3663,7 +4180,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -3674,24 +4194,21 @@ def __init__(self, **kwargs): self.properties = None -class ResourceNameAvailability(Model): +class ResourceNameAvailability(msrest.serialization.Model): """Information regarding availability of a resource name. - :param name_available: true indicates name is valid and - available. false indicates the name is invalid, unavailable, - or both. + :param name_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. :type name_available: bool - :param reason: Invalid indicates the name provided does not - match Azure App Service naming requirements. AlreadyExists - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.web.v2016_03_01.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why - the given name is invalid, and provide the resource naming requirements so - that the user can select a valid name. If reason == AlreadyExists, explain - that resource name is already in use, and direct them to select a - different name. + :param reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.web.v2016_03_01.models.InAvailabilityReasonType + :param message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. :type message: str """ @@ -3701,26 +4218,28 @@ class ResourceNameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceNameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class ResourceNameAvailabilityRequest(Model): +class ResourceNameAvailabilityRequest(msrest.serialization.Model): """Resource name availability request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes + :param type: Required. Resource type used for verification. Possible values include: "Site", + "Slot", "HostingEnvironment", "PublishingUser", "Microsoft.Web/sites", + "Microsoft.Web/sites/slots", "Microsoft.Web/hostingEnvironments", + "Microsoft.Web/publishingUsers". + :type type: str or ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool """ @@ -3736,17 +4255,20 @@ class ResourceNameAvailabilityRequest(Model): 'is_fqdn': {'key': 'isFqdn', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) + self.name = kwargs['name'] + self.type = kwargs['type'] self.is_fqdn = kwargs.get('is_fqdn', None) -class ResponseMetaData(Model): +class ResponseMetaData(msrest.serialization.Model): """ResponseMetaData. - :param data_source: Source of the Data + :param data_source: Source of the Data. :type data_source: ~azure.mgmt.web.v2016_03_01.models.DataSource """ @@ -3754,24 +4276,29 @@ class ResponseMetaData(Model): 'data_source': {'key': 'dataSource', 'type': 'DataSource'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResponseMetaData, self).__init__(**kwargs) self.data_source = kwargs.get('data_source', None) -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """Resource metrics service provided by Microsoft.Insights resource provider. :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2016_03_01.models.MetricSpecification] + :type metric_specifications: list[~azure.mgmt.web.v2016_03_01.models.MetricSpecification] """ _attribute_map = { 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -3779,8 +4306,7 @@ def __init__(self, **kwargs): class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3794,117 +4320,99 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_03_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_03_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_03_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_03_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_03_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_03_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_03_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_03_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_03_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentity """ _validation = { @@ -3938,13 +4446,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -3970,11 +4479,14 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Site, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -4007,21 +4519,18 @@ def __init__(self, **kwargs): self.default_host_name = None self.slot_swap_status = None self.https_only = kwargs.get('https_only', None) - self.identity = kwargs.get('identity', None) -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -4029,52 +4538,50 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_03_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_03_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_03_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_03_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_03_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_03_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -4084,24 +4591,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_03_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_03_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_03_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_03_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_03_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_03_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_03_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_03_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_03_01.models.AutoHealRules @@ -4113,25 +4616,21 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2016_03_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_03_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_03_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_03_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_03_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_03_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_03_01.models.SupportedTlsVersions """ _validation = { @@ -4167,9 +4666,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -4186,7 +4685,10 @@ class SiteConfig(Model): 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -4235,7 +4737,7 @@ def __init__(self, **kwargs): self.min_tls_version = kwargs.get('min_tls_version', None) -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -4252,14 +4754,17 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) self.max_disk_size_in_mb = kwargs.get('max_disk_size_in_mb', None) -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -4279,7 +4784,10 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = kwargs.get('validation', None) self.validation_key = kwargs.get('validation_key', None) @@ -4287,7 +4795,7 @@ def __init__(self, **kwargs): self.decryption_key = kwargs.get('decryption_key', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -4307,7 +4815,10 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs.get('minimum', None) self.maximum = kwargs.get('maximum', None) @@ -4315,7 +4826,7 @@ def __init__(self, **kwargs): self.scale_type = kwargs.get('scale_type', None) -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -4332,8 +4843,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2016_03_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2016_03_01.models.Capability] """ @@ -4348,7 +4858,10 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -4360,14 +4873,13 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class SkuInfos(Model): +class SkuInfos(msrest.serialization.Model): """Collection of SKU information. :param resource_type: Resource type that this SKU applies to. :type resource_type: str :param skus: List of SKUs the subscription is able to use. - :type skus: - list[~azure.mgmt.web.v2016_03_01.models.GlobalCsmSkuDescription] + :type skus: list[~azure.mgmt.web.v2016_03_01.models.GlobalCsmSkuDescription] """ _attribute_map = { @@ -4375,24 +4887,25 @@ class SkuInfos(Model): 'skus': {'key': 'skus', 'type': '[GlobalCsmSkuDescription]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuInfos, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.skus = kwargs.get('skus', None) -class SlotSwapStatus(Model): +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -4408,14 +4921,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -4432,7 +4948,10 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = kwargs.get('time_taken', None) self.count = kwargs.get('count', None) @@ -4442,10 +4961,7 @@ def __init__(self, **kwargs): class SnapshotRecoveryRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4455,21 +4971,19 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app recovery should be attempted, formatted as + a DateTime string. :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. + :param recovery_target: Specifies the web app that snapshot contents will be written to. + :type recovery_target: ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryTarget + :param overwrite: If :code:`true` the recovery operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool """ @@ -4478,7 +4992,6 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -4493,7 +5006,10 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoveryRequest, self).__init__(**kwargs) self.snapshot_time = kwargs.get('snapshot_time', None) self.recovery_target = kwargs.get('recovery_target', None) @@ -4502,16 +5018,16 @@ def __init__(self, **kwargs): self.ignore_conflicting_host_names = kwargs.get('ignore_conflicting_host_names', None) -class SnapshotRecoveryTarget(Model): +class SnapshotRecoveryTarget(msrest.serialization.Model): """Specifies the web app that snapshot contents will be written to. - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the target web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -4521,31 +5037,33 @@ class SnapshotRecoveryTarget(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoveryTarget, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.id = kwargs.get('id', None) -class Solution(Model): +class Solution(msrest.serialization.Model): """Class Representing Solution for problems detected. :param id: Solution Id. :type id: float - :param display_name: Display Name of the solution + :param display_name: Display Name of the solution. :type display_name: str :param order: Order of the solution. :type order: float - :param description: Description of the solution + :param description: Description of the solution. :type description: str - :param type: Type of Solution. Possible values include: 'QuickSolution', - 'DeepInvestigation', 'BestPractices' + :param type: Type of Solution. Possible values include: "QuickSolution", "DeepInvestigation", + "BestPractices". :type type: str or ~azure.mgmt.web.v2016_03_01.models.SolutionType :param data: Solution Data. :type data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] :param metadata: Solution Metadata. - :type metadata: - list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] + :type metadata: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] """ _attribute_map = { @@ -4553,12 +5071,15 @@ class Solution(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'float'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'SolutionType'}, + 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'data', 'type': '[[NameValuePair]]'}, 'metadata': {'key': 'metadata', 'type': '[[NameValuePair]]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Solution, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.display_name = kwargs.get('display_name', None) @@ -4572,8 +5093,7 @@ def __init__(self, **kwargs): class SourceControl(ProxyOnlyResource): """The source control OAuth token. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4583,8 +5103,8 @@ class SourceControl(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param source_control_name: Name or source control type. - :type source_control_name: str + :param name_properties_name: Name or source control type. + :type name_properties_name: str :param token: OAuth access token. :type token: str :param token_secret: OAuth access token secret. @@ -4592,7 +5112,7 @@ class SourceControl(ProxyOnlyResource): :param refresh_token: OAuth refresh token. :type refresh_token: str :param expiration_time: OAuth token expiration. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime """ _validation = { @@ -4606,35 +5126,69 @@ class SourceControl(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'source_control_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'token': {'key': 'properties.token', 'type': 'str'}, 'token_secret': {'key': 'properties.tokenSecret', 'type': 'str'}, 'refresh_token': {'key': 'properties.refreshToken', 'type': 'str'}, 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SourceControl, self).__init__(**kwargs) - self.source_control_name = kwargs.get('source_control_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.token = kwargs.get('token', None) self.token_secret = kwargs.get('token_secret', None) self.refresh_token = kwargs.get('refresh_token', None) self.expiration_time = kwargs.get('expiration_time', None) -class StackMajorVersion(Model): +class SourceControlCollection(msrest.serialization.Model): + """Collection of source controls. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SourceControlCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class StackMajorVersion(msrest.serialization.Model): """Application stack major version. :param display_version: Application stack major version (display only). :type display_version: str :param runtime_version: Application stack major version (runtime only). :type runtime_version: str - :param is_default: true if this is the default major version; - otherwise, false. + :param is_default: :code:`true` if this is the default major version; otherwise, + :code:`false`. :type is_default: bool :param minor_versions: Minor versions associated with the major version. - :type minor_versions: - list[~azure.mgmt.web.v2016_03_01.models.StackMinorVersion] + :type minor_versions: list[~azure.mgmt.web.v2016_03_01.models.StackMinorVersion] """ _attribute_map = { @@ -4644,7 +5198,10 @@ class StackMajorVersion(Model): 'minor_versions': {'key': 'minorVersions', 'type': '[StackMinorVersion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StackMajorVersion, self).__init__(**kwargs) self.display_version = kwargs.get('display_version', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -4652,15 +5209,15 @@ def __init__(self, **kwargs): self.minor_versions = kwargs.get('minor_versions', None) -class StackMinorVersion(Model): +class StackMinorVersion(msrest.serialization.Model): """Application stack minor version. :param display_version: Application stack minor version (display only). :type display_version: str :param runtime_version: Application stack minor version (runtime only). :type runtime_version: str - :param is_default: true if this is the default minor version; - otherwise, false. + :param is_default: :code:`true` if this is the default minor version; otherwise, + :code:`false`. :type is_default: bool """ @@ -4670,45 +5227,43 @@ class StackMinorVersion(Model): 'is_default': {'key': 'isDefault', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StackMinorVersion, self).__init__(**kwargs) self.display_version = kwargs.get('display_version', None) self.runtime_version = kwargs.get('runtime_version', None) self.is_default = kwargs.get('is_default', None) -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Default', 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3' - :type worker_size: str or - ~azure.mgmt.web.v2016_03_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Default", "Small", + "Medium", "Large", "D1", "D2", "D3". + :type worker_size: str or ~azure.mgmt.web.v2016_03_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str @@ -4719,15 +5274,18 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, 'site_mode': {'key': 'siteMode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available_capacity = kwargs.get('available_capacity', None) @@ -4741,7 +5299,7 @@ def __init__(self, **kwargs): self.site_mode = kwargs.get('site_mode', None) -class StatusCodesBasedTrigger(Model): +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -4764,7 +5322,10 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.sub_status = kwargs.get('sub_status', None) @@ -4776,10 +5337,7 @@ def __init__(self, **kwargs): class User(ProxyOnlyResource): """User credentials used for publishing activity. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4789,16 +5347,15 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param user_name: Username + :param user_name: Username. :type user_name: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str """ @@ -4806,7 +5363,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -4821,7 +5377,10 @@ class User(ProxyOnlyResource): 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(User, self).__init__(**kwargs) self.user_name = kwargs.get('user_name', None) self.publishing_user_name = kwargs.get('publishing_user_name', None) @@ -4830,34 +5389,32 @@ def __init__(self, **kwargs): self.publishing_password_hash_salt = kwargs.get('publishing_password_hash_salt', None) -class ValidateRequest(Model): +class ValidateRequest(msrest.serialization.Model): """Resource validation request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'ServerFarm', 'Site' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.ValidateResourceTypes + :param type: Required. Resource type used for verification. Possible values include: + "ServerFarm", "Site". + :type type: str or ~azure.mgmt.web.v2016_03_01.models.ValidateResourceTypes :param location: Required. Expected location of the resource. :type location: str - :param server_farm_id: ARM resource ID of an App Service plan that would - host the app. + :param server_farm_id: ARM resource ID of an App Service plan that would host the app. :type server_farm_id: str :param sku_name: Name of the target SKU for the App Service plan. :type sku_name: str - :param need_linux_workers: true if App Service plan is for - Linux workers; otherwise, false. + :param need_linux_workers: :code:`true` if App Service plan is for Linux workers; + otherwise, :code:`false`. :type need_linux_workers: bool - :param is_spot: true if App Service plan is for Spot - instances; otherwise, false. + :param is_spot: :code:`true` if App Service plan is for Spot instances; otherwise, + :code:`false`. :type is_spot: bool :param capacity: Target capacity of the App Service plan (number of VMs). :type capacity: int - :param hosting_environment: Name of App Service Environment where app or - App Service plan should be created. + :param hosting_environment: Name of App Service Environment where app or App Service plan + should be created. :type hosting_environment: str """ @@ -4880,11 +5437,14 @@ class ValidateRequest(Model): 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.location = kwargs.get('location', None) + self.name = kwargs['name'] + self.type = kwargs['type'] + self.location = kwargs['location'] self.server_farm_id = kwargs.get('server_farm_id', None) self.sku_name = kwargs.get('sku_name', None) self.need_linux_workers = kwargs.get('need_linux_workers', None) @@ -4893,7 +5453,7 @@ def __init__(self, **kwargs): self.hosting_environment = kwargs.get('hosting_environment', None) -class ValidateResponse(Model): +class ValidateResponse(msrest.serialization.Model): """Describes the result of resource validation. :param status: Result of validation. @@ -4907,13 +5467,16 @@ class ValidateResponse(Model): 'error': {'key': 'error', 'type': 'ValidateResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateResponse, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.error = kwargs.get('error', None) -class ValidateResponseError(Model): +class ValidateResponseError(msrest.serialization.Model): """Error details for when validation fails. :param code: Validation error code. @@ -4927,25 +5490,27 @@ class ValidateResponseError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateResponseError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2016_03_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2016_03_01.models.VirtualDirectory] """ _attribute_map = { @@ -4955,7 +5520,10 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) @@ -4963,7 +5531,7 @@ def __init__(self, **kwargs): self.virtual_directories = kwargs.get('virtual_directories', None) -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -4977,13 +5545,16 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -5003,7 +5574,10 @@ class VirtualIPMapping(Model): 'in_use': {'key': 'inUse', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = kwargs.get('virtual_ip', None) self.internal_http_port = kwargs.get('internal_http_port', None) @@ -5011,11 +5585,10 @@ def __init__(self, **kwargs): self.in_use = kwargs.get('in_use', None) -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -5039,7 +5612,10 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None @@ -5048,13 +5624,9 @@ def __init__(self, **kwargs): class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5066,8 +5638,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -5075,7 +5646,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -5087,7 +5657,10 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetGateway, self).__init__(**kwargs) self.vnet_name = kwargs.get('vnet_name', None) self.vpn_package_uri = kwargs.get('vpn_package_uri', None) @@ -5096,8 +5669,7 @@ def __init__(self, **kwargs): class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5111,17 +5683,17 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: bytearray :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2016_03_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str """ @@ -5147,7 +5719,10 @@ class VnetInfo(ProxyOnlyResource): 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetInfo, self).__init__(**kwargs) self.vnet_resource_id = kwargs.get('vnet_resource_id', None) self.cert_thumbprint = None @@ -5160,8 +5735,7 @@ def __init__(self, **kwargs): class VnetParameters(ProxyOnlyResource): """The required set of inputs to validate a VNET. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5171,11 +5745,11 @@ class VnetParameters(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_resource_group: The Resource Group of the VNET to be validated + :param vnet_resource_group: The Resource Group of the VNET to be validated. :type vnet_resource_group: str - :param vnet_name: The name of the VNET to be validated + :param vnet_name: The name of the VNET to be validated. :type vnet_name: str - :param vnet_subnet_name: The subnet name to be validated + :param vnet_subnet_name: The subnet name to be validated. :type vnet_subnet_name: str """ @@ -5195,7 +5769,10 @@ class VnetParameters(ProxyOnlyResource): 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetParameters, self).__init__(**kwargs) self.vnet_resource_group = kwargs.get('vnet_resource_group', None) self.vnet_name = kwargs.get('vnet_name', None) @@ -5203,11 +5780,9 @@ def __init__(self, **kwargs): class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5217,23 +5792,22 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. + :param vnet_route_name: The name of this route. This is only returned by the server and does + not need to be set by the client. :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2016_03_01.models.RouteType """ @@ -5254,7 +5828,10 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetRoute, self).__init__(**kwargs) self.vnet_route_name = kwargs.get('vnet_route_name', None) self.start_address = kwargs.get('start_address', None) @@ -5265,8 +5842,7 @@ def __init__(self, **kwargs): class VnetValidationFailureDetails(ProxyOnlyResource): """A class that describes the reason for a validation failure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5279,8 +5855,7 @@ class VnetValidationFailureDetails(ProxyOnlyResource): :param failed: A flag describing whether or not validation failed. :type failed: bool :param failed_tests: A list of tests that failed in the validation. - :type failed_tests: - list[~azure.mgmt.web.v2016_03_01.models.VnetValidationTestFailure] + :type failed_tests: list[~azure.mgmt.web.v2016_03_01.models.VnetValidationTestFailure] """ _validation = { @@ -5298,7 +5873,10 @@ class VnetValidationFailureDetails(ProxyOnlyResource): 'failed_tests': {'key': 'properties.failedTests', 'type': '[VnetValidationTestFailure]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetValidationFailureDetails, self).__init__(**kwargs) self.failed = kwargs.get('failed', None) self.failed_tests = kwargs.get('failed_tests', None) @@ -5307,8 +5885,7 @@ def __init__(self, **kwargs): class VnetValidationTestFailure(ProxyOnlyResource): """A class that describes a test that failed during NSG and UDR validation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5320,8 +5897,7 @@ class VnetValidationTestFailure(ProxyOnlyResource): :vartype type: str :param test_name: The name of the test that failed. :type test_name: str - :param details: The details of what caused the failure, e.g. the blocking - rule name, etc. + :param details: The details of what caused the failure, e.g. the blocking rule name, etc. :type details: str """ @@ -5340,17 +5916,19 @@ class VnetValidationTestFailure(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetValidationTestFailure, self).__init__(**kwargs) self.test_name = kwargs.get('test_name', None) self.details = kwargs.get('details', None) -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -5370,30 +5948,30 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.next_link = None -class WorkerPool(Model): +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -5403,13 +5981,16 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models_py3.py index 8080cffded3a..3c0773d87a58 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_models_py3.py @@ -1,29 +1,30 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AbnormalTimePeriod(Model): +from ._web_site_management_client_enums import * + + +class AbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period identified in diagnosis. - :param start_time: Start time of the downtime - :type start_time: datetime - :param end_time: End time of the downtime - :type end_time: datetime - :param events: List of Possible Cause of downtime - :type events: - list[~azure.mgmt.web.v2016_03_01.models.DetectorAbnormalTimePeriod] - :param solutions: List of proposed solutions + :param start_time: Start time of the downtime. + :type start_time: ~datetime.datetime + :param end_time: End time of the downtime. + :type end_time: ~datetime.datetime + :param events: List of Possible Cause of downtime. + :type events: list[~azure.mgmt.web.v2016_03_01.models.DetectorAbnormalTimePeriod] + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2016_03_01.models.Solution] """ @@ -34,7 +35,15 @@ class AbnormalTimePeriod(Model): 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, *, start_time=None, end_time=None, events=None, solutions=None, **kwargs) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + events: Optional[List["DetectorAbnormalTimePeriod"]] = None, + solutions: Optional[List["Solution"]] = None, + **kwargs + ): super(AbnormalTimePeriod, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -42,22 +51,19 @@ def __init__(self, *, start_time=None, end_time=None, events=None, solutions=Non self.solutions = solutions -class AnalysisData(Model): +class AnalysisData(msrest.serialization.Model): """Class Representing Detector Evidence used for analysis. - :param source: Name of the Detector + :param source: Name of the Detector. :type source: str - :param detector_definition: Detector Definition - :type detector_definition: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition - :param metrics: Source Metrics - :type metrics: - list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] - :param data: Additional Source Data + :param detector_definition: Detector Definition. + :type detector_definition: ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition + :param metrics: Source Metrics. + :type metrics: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] + :param data: Additional Source Data. :type data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] - :param detector_meta_data: Detector Meta Data - :type detector_meta_data: - ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData + :param detector_meta_data: Detector Meta Data. + :type detector_meta_data: ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData """ _attribute_map = { @@ -68,7 +74,16 @@ class AnalysisData(Model): 'detector_meta_data': {'key': 'detectorMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, *, source: str=None, detector_definition=None, metrics=None, data=None, detector_meta_data=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional[str] = None, + detector_definition: Optional["DetectorDefinition"] = None, + metrics: Optional[List["DiagnosticMetricSet"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + detector_meta_data: Optional["ResponseMetaData"] = None, + **kwargs + ): super(AnalysisData, self).__init__(**kwargs) self.source = source self.detector_definition = detector_definition @@ -77,12 +92,10 @@ def __init__(self, *, source: str=None, detector_definition=None, metrics=None, self.detector_meta_data = detector_meta_data -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -107,7 +120,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -118,8 +136,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class AnalysisDefinition(ProxyOnlyResource): """Definition of Analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -129,7 +146,7 @@ class AnalysisDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the Analysis + :ivar description: Description of the Analysis. :vartype description: str """ @@ -148,12 +165,17 @@ class AnalysisDefinition(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(AnalysisDefinition, self).__init__(kind=kind, **kwargs) self.description = None -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -164,12 +186,17 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = url -class ApplicationStack(Model): +class ApplicationStack(msrest.serialization.Model): """Application stack. :param name: Application stack name. @@ -179,11 +206,9 @@ class ApplicationStack(Model): :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2016_03_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2016_03_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] """ _attribute_map = { @@ -194,7 +219,16 @@ class ApplicationStack(Model): 'frameworks': {'key': 'frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, *, name: str=None, display: str=None, dependency: str=None, major_versions=None, frameworks=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional[str] = None, + dependency: Optional[str] = None, + major_versions: Optional[List["StackMajorVersion"]] = None, + frameworks: Optional[List["ApplicationStack"]] = None, + **kwargs + ): super(ApplicationStack, self).__init__(**kwargs) self.name = name self.display = display @@ -203,61 +237,87 @@ def __init__(self, *, name: str=None, display: str=None, dependency: str=None, m self.frameworks = frameworks -class AppServiceEnvironment(Model): +class ApplicationStackCollection(msrest.serialization.Model): + """Collection of Application Stacks. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationStack]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ApplicationStack"], + **kwargs + ): + super(ApplicationStackCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppServiceEnvironment(msrest.serialization.Model): """Description of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param name: Required. Name of the App Service Environment. :type name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param location: Required. Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_03_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_03_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2016_03_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :type virtual_network: ~azure.mgmt.web.v2016_03_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2016_03_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Required. Description of worker pools with worker size IDs, VM sizes, and + number of workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2016_03_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -265,35 +325,29 @@ class AppServiceEnvironment(Model): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2016_03_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2016_03_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2016_03_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2016_03_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2016_03_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -301,25 +355,23 @@ class AppServiceEnvironment(Model): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] """ @@ -350,13 +402,13 @@ class AppServiceEnvironment(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, 'vnet_name': {'key': 'vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'workerPools', 'type': '[WorkerPool]'}, @@ -386,7 +438,30 @@ class AppServiceEnvironment(Model): 'user_whitelisted_ip_ranges': {'key': 'userWhitelistedIpRanges', 'type': '[str]'}, } - def __init__(self, *, name: str, location: str, virtual_network, worker_pools, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + location: str, + virtual_network: "VirtualNetworkProfile", + worker_pools: List["WorkerPool"], + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + **kwargs + ): super(AppServiceEnvironment, self).__init__(**kwargs) self.name = name self.location = location @@ -426,11 +501,10 @@ def __init__(self, *, name: str, location: str, virtual_network, worker_pools, v self.user_whitelisted_ip_ranges = user_whitelisted_ip_ranges -class Resource(Model): +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -444,7 +518,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -464,7 +538,14 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -477,8 +558,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> Non class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -492,58 +572,52 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2016_03_01.models.SkuDescription + :param name_properties_name: Name for the App Service plan. + :type name_properties_name: str + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2016_03_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str :param admin_site_name: App Service plan administration site. :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_03_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2016_03_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_03_01.models.ProvisioningState """ _validation = { @@ -551,7 +625,6 @@ class AppServicePlan(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, 'status': {'readonly': True}, 'subscription': {'readonly': True}, 'maximum_number_of_workers': {'readonly': True}, @@ -568,9 +641,10 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, @@ -584,13 +658,31 @@ class AppServicePlan(Resource): 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, tags=None, worker_tier_name: str=None, admin_site_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, is_spot: bool=None, spot_expiration_time=None, reserved: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SkuDescription"] = None, + name_properties_name: Optional[str] = None, + worker_tier_name: Optional[str] = None, + admin_site_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_plan_name = app_service_plan_name + self.sku = sku + self.name_properties_name = name_properties_name self.worker_tier_name = worker_tier_name self.status = None self.subscription = None @@ -607,10 +699,9 @@ def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, self.target_worker_count = target_worker_count self.target_worker_size_id = target_worker_size_id self.provisioning_state = None - self.sku = sku -class AppServicePlanCollection(Model): +class AppServicePlanCollection(msrest.serialization.Model): """Collection of App Service plans. All required parameters must be populated in order to send to Azure. @@ -630,43 +721,54 @@ class AppServicePlanCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, next_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: List["AppServicePlan"], + next_link: Optional[str] = None, + **kwargs + ): super(AppServicePlanCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2016_03_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2016_03_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2016_03_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2016_03_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "AutoHealActionType"]] = None, + custom_action: Optional["AutoHealCustomAction"] = None, + min_process_execution_time: Optional[str] = None, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = action_type self.custom_action = custom_action self.min_process_execution_time = min_process_execution_time -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -679,17 +781,22 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: + def __init__( + self, + *, + exe: Optional[str] = None, + parameters: Optional[str] = None, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = exe self.parameters = parameters -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2016_03_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2016_03_01.models.AutoHealActions @@ -700,13 +807,19 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + triggers: Optional["AutoHealTriggers"] = None, + actions: Optional["AutoHealActions"] = None, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = triggers self.actions = actions -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -714,11 +827,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2016_03_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2016_03_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2016_03_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2016_03_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -728,7 +839,15 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: + def __init__( + self, + *, + requests: Optional["RequestsBasedTrigger"] = None, + private_bytes_in_kb: Optional[int] = None, + status_codes: Optional[List["StatusCodesBasedTrigger"]] = None, + slow_requests: Optional["SlowRequestsBasedTrigger"] = None, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = requests self.private_bytes_in_kb = private_bytes_in_kb @@ -737,11 +856,9 @@ def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes class BillingMeter(ProxyOnlyResource): - """App Service billing entity that contains information about meter which the - Azure billing system utilizes to charge users for services. + """App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -751,15 +868,15 @@ class BillingMeter(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param meter_id: Meter GUID onboarded in Commerce + :param meter_id: Meter GUID onboarded in Commerce. :type meter_id: str - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param short_name: Short Name from App Service Azure pricing Page + :param short_name: Short Name from App Service Azure pricing Page. :type short_name: str - :param friendly_name: Friendly name of the meter + :param friendly_name: Friendly name of the meter. :type friendly_name: str - :param resource_type: App Service resource type meter used for + :param resource_type: App Service resource type meter used for. :type resource_type: str """ @@ -781,7 +898,17 @@ class BillingMeter(ProxyOnlyResource): 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, meter_id: str=None, billing_location: str=None, short_name: str=None, friendly_name: str=None, resource_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + meter_id: Optional[str] = None, + billing_location: Optional[str] = None, + short_name: Optional[str] = None, + friendly_name: Optional[str] = None, + resource_type: Optional[str] = None, + **kwargs + ): super(BillingMeter, self).__init__(kind=kind, **kwargs) self.meter_id = meter_id self.billing_location = billing_location @@ -790,7 +917,41 @@ def __init__(self, *, kind: str=None, meter_id: str=None, billing_location: str= self.resource_type = resource_type -class Capability(Model): +class BillingMeterCollection(msrest.serialization.Model): + """Collection of Billing Meters. + + 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. + + :param value: Required. Collection of Billing Meters. + :type value: list[~azure.mgmt.web.v2016_03_01.models.BillingMeter] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingMeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["BillingMeter"], + **kwargs + ): + super(BillingMeterCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -807,7 +968,14 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + reason: Optional[str] = None, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = name self.value = value @@ -817,8 +985,7 @@ def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwarg class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -832,7 +999,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -849,39 +1016,37 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2016_03_01.models.KeyVaultSecretStatus :ivar geo_region: Region of the certificate. :vartype geo_region: str - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -898,7 +1063,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -932,12 +1096,25 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, *, location: str, password: str, kind: str=None, tags=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + **kwargs + ): super(Certificate, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.friendly_name = None self.subject_name = None @@ -961,14 +1138,45 @@ def __init__(self, *, location: str, password: str, kind: str=None, tags=None, h self.server_farm_id = server_farm_id -class CertificatePatchResource(ProxyOnlyResource): - """ARM resource for a certificate. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Certificate"], + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificatePatchResource(ProxyOnlyResource): + """ARM resource for a certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -992,39 +1200,37 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2016_03_01.models.KeyVaultSecretStatus :ivar geo_region: Region of the certificate. :vartype geo_region: str - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -1040,7 +1246,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -1072,12 +1277,23 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + **kwargs + ): super(CertificatePatchResource, self).__init__(kind=kind, **kwargs) self.friendly_name = None self.subject_name = None @@ -1101,51 +1317,49 @@ def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: self.server_farm_id = server_farm_id -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. + :param ignore_quotas: :code:`true` if quotas should be ignored; otherwise, + :code:`false`. :type ignore_quotas: bool """ @@ -1167,7 +1381,22 @@ class CloningInfo(Model): 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, } - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, ignore_quotas: bool=None, **kwargs) -> None: + def __init__( + self, + *, + source_web_app_id: str, + correlation_id: Optional[str] = None, + overwrite: Optional[bool] = None, + clone_custom_host_names: Optional[bool] = None, + clone_source_control: Optional[bool] = None, + hosting_environment: Optional[str] = None, + app_settings_overrides: Optional[Dict[str, str]] = None, + configure_load_balancing: Optional[bool] = None, + traffic_manager_profile_id: Optional[str] = None, + traffic_manager_profile_name: Optional[str] = None, + ignore_quotas: Optional[bool] = None, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = correlation_id self.overwrite = overwrite @@ -1182,45 +1411,44 @@ def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrit self.ignore_quotas = ignore_quotas -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_03_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + connection_string: Optional[str] = None, + type: Optional[Union[str, "ConnectionStringType"]] = None, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = name self.connection_string = connection_string self.type = type -class CorsSettings(Model): +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] """ @@ -1229,14 +1457,18 @@ class CorsSettings(Model): 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, } - def __init__(self, *, allowed_origins=None, **kwargs) -> None: + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = allowed_origins -class CsmMoveResourceEnvelope(Model): - """Object with a list of the resources that need to be moved and the resource - group they should be moved to. +class CsmMoveResourceEnvelope(msrest.serialization.Model): + """Object with a list of the resources that need to be moved and the resource group they should be moved to. :param target_resource_group: :type target_resource_group: str @@ -1253,24 +1485,63 @@ class CsmMoveResourceEnvelope(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, *, target_resource_group: str=None, resources=None, **kwargs) -> None: + def __init__( + self, + *, + target_resource_group: Optional[str] = None, + resources: Optional[List[str]] = None, + **kwargs + ): super(CsmMoveResourceEnvelope, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources -class CsmOperationDescription(Model): +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmOperationDescription"], + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2016_03_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2016_03_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2016_03_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -1280,7 +1551,15 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["CsmOperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["CsmOperationDescriptionProperties"] = None, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = name self.display = display @@ -1288,24 +1567,29 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties self.properties = properties -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2016_03_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2016_03_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = service_specification -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -1325,7 +1609,15 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1333,13 +1625,13 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -1356,7 +1648,16 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=None, limit: int=None, name=None, **kwargs) -> None: + def __init__( + self, + *, + unit: Optional[str] = None, + next_reset_time: Optional[datetime.datetime] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["LocalizableString"] = None, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = unit self.next_reset_time = next_reset_time @@ -1365,11 +1666,10 @@ def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=N self.name = name -class CsmUsageQuotaCollection(Model): +class CsmUsageQuotaCollection(msrest.serialization.Model): """Collection of CSM usage quotas. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1389,20 +1689,24 @@ class CsmUsageQuotaCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["CsmUsageQuota"], + **kwargs + ): super(CsmUsageQuotaCollection, self).__init__(**kwargs) self.value = value self.next_link = None -class DataSource(Model): +class DataSource(msrest.serialization.Model): """Class representing data source used by the detectors. - :param instructions: Instructions if any for the data source + :param instructions: Instructions if any for the data source. :type instructions: list[str] - :param data_source_uri: Datasource Uri Links - :type data_source_uri: - list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] + :param data_source_uri: Datasource Uri Links. + :type data_source_uri: list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] """ _attribute_map = { @@ -1410,20 +1714,26 @@ class DataSource(Model): 'data_source_uri': {'key': 'dataSourceUri', 'type': '[NameValuePair]'}, } - def __init__(self, *, instructions=None, data_source_uri=None, **kwargs) -> None: + def __init__( + self, + *, + instructions: Optional[List[str]] = None, + data_source_uri: Optional[List["NameValuePair"]] = None, + **kwargs + ): super(DataSource, self).__init__(**kwargs) self.instructions = instructions self.data_source_uri = data_source_uri -class DataTableResponseColumn(Model): +class DataTableResponseColumn(msrest.serialization.Model): """Column definition. - :param column_name: Name of the column + :param column_name: Name of the column. :type column_name: str :param data_type: Data type which looks like 'String' or 'Int32'. :type data_type: str - :param column_type: Column Type + :param column_type: Column Type. :type column_type: str """ @@ -1433,22 +1743,28 @@ class DataTableResponseColumn(Model): 'column_type': {'key': 'columnType', 'type': 'str'}, } - def __init__(self, *, column_name: str=None, data_type: str=None, column_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + column_name: Optional[str] = None, + data_type: Optional[str] = None, + column_type: Optional[str] = None, + **kwargs + ): super(DataTableResponseColumn, self).__init__(**kwargs) self.column_name = column_name self.data_type = data_type self.column_type = column_type -class DataTableResponseObject(Model): +class DataTableResponseObject(msrest.serialization.Model): """Data Table which defines columns and raw row values. - :param table_name: Name of the table + :param table_name: Name of the table. :type table_name: str - :param columns: List of columns with data types - :type columns: - list[~azure.mgmt.web.v2016_03_01.models.DataTableResponseColumn] - :param rows: Raw row values + :param columns: List of columns with data types. + :type columns: list[~azure.mgmt.web.v2016_03_01.models.DataTableResponseColumn] + :param rows: Raw row values. :type rows: list[list[str]] """ @@ -1458,22 +1774,27 @@ class DataTableResponseObject(Model): 'rows': {'key': 'rows', 'type': '[[str]]'}, } - def __init__(self, *, table_name: str=None, columns=None, rows=None, **kwargs) -> None: + def __init__( + self, + *, + table_name: Optional[str] = None, + columns: Optional[List["DataTableResponseColumn"]] = None, + rows: Optional[List[List[str]]] = None, + **kwargs + ): super(DataTableResponseObject, self).__init__(**kwargs) self.table_name = table_name self.columns = columns self.rows = rows -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseError """ _validation = { @@ -1484,28 +1805,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -1514,8 +1825,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2016_03_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -1535,7 +1845,12 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, *, details=None, **kwargs) -> None: + def __init__( + self, + *, + details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -1544,11 +1859,10 @@ def __init__(self, *, details=None, **kwargs) -> None: self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -1570,30 +1884,32 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None self.target = None -class DeletedSite(Model): +class DeletedSite(msrest.serialization.Model): """A deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param id: Numeric id for the deleted site + :param id: Numeric id for the deleted site. :type id: int :ivar deleted_timestamp: Time in UTC when the app was deleted. :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site + :ivar subscription: Subscription containing the deleted site. :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site + :ivar resource_group: ResourceGroup that contained the deleted site. :vartype resource_group: str - :ivar name: Name of the deleted site + :ivar name: Name of the deleted site. :vartype name: str - :ivar slot: Slot of the deleted site + :ivar slot: Slot of the deleted site. :vartype slot: str """ @@ -1614,7 +1930,12 @@ class DeletedSite(Model): 'slot': {'key': 'slot', 'type': 'str'}, } - def __init__(self, *, id: int=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + **kwargs + ): super(DeletedSite, self).__init__(**kwargs) self.id = id self.deleted_timestamp = None @@ -1624,18 +1945,51 @@ def __init__(self, *, id: int=None, **kwargs) -> None: self.slot = None -class DeploymentLocations(Model): +class DeletedWebAppCollection(msrest.serialization.Model): + """Collection of deleted apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DeletedSite] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DeletedSite"], + **kwargs + ): + super(DeletedWebAppCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentLocations(msrest.serialization.Model): """List of available locations (regions or App Service Environments) for - deployment of App Service resources. +deployment of App Service resources. :param locations: Available regions. :type locations: list[~azure.mgmt.web.v2016_03_01.models.GeoRegion] - :param hosting_environments: Available App Service Environments with full - descriptions of the environments. - :type hosting_environments: - list[~azure.mgmt.web.v2016_03_01.models.AppServiceEnvironment] - :param hosting_environment_deployment_infos: Available App Service - Environments with basic information. + :param hosting_environments: Available App Service Environments with full descriptions of the + environments. + :type hosting_environments: list[~azure.mgmt.web.v2016_03_01.models.AppServiceEnvironment] + :param hosting_environment_deployment_infos: Available App Service Environments with basic + information. :type hosting_environment_deployment_infos: list[~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentDeploymentInfo] """ @@ -1646,34 +2000,40 @@ class DeploymentLocations(Model): 'hosting_environment_deployment_infos': {'key': 'hostingEnvironmentDeploymentInfos', 'type': '[HostingEnvironmentDeploymentInfo]'}, } - def __init__(self, *, locations=None, hosting_environments=None, hosting_environment_deployment_infos=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List["GeoRegion"]] = None, + hosting_environments: Optional[List["AppServiceEnvironment"]] = None, + hosting_environment_deployment_infos: Optional[List["HostingEnvironmentDeploymentInfo"]] = None, + **kwargs + ): super(DeploymentLocations, self).__init__(**kwargs) self.locations = locations self.hosting_environments = hosting_environments self.hosting_environment_deployment_infos = hosting_environment_deployment_infos -class DetectorAbnormalTimePeriod(Model): +class DetectorAbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period detected. - :param start_time: Start time of the correlated event - :type start_time: datetime - :param end_time: End time of the correlated event - :type end_time: datetime - :param message: Message describing the event + :param start_time: Start time of the correlated event. + :type start_time: ~datetime.datetime + :param end_time: End time of the correlated event. + :type end_time: ~datetime.datetime + :param message: Message describing the event. :type message: str - :param source: Represents the name of the Detector + :param source: Represents the name of the Detector. :type source: str - :param priority: Represents the rank of the Detector + :param priority: Represents the rank of the Detector. :type priority: float - :param meta_data: Downtime metadata - :type meta_data: - list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] - :param type: Represents the type of the Detector. Possible values include: - 'ServiceIncident', 'AppDeployment', 'AppCrash', 'RuntimeIssueDetected', - 'AseDeployment', 'UserIssue', 'PlatformIssue', 'Other' + :param meta_data: Downtime metadata. + :type meta_data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] + :param type: Represents the type of the Detector. Possible values include: "ServiceIncident", + "AppDeployment", "AppCrash", "RuntimeIssueDetected", "AseDeployment", "UserIssue", + "PlatformIssue", "Other". :type type: str or ~azure.mgmt.web.v2016_03_01.models.IssueType - :param solutions: List of proposed solutions + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2016_03_01.models.Solution] """ @@ -1684,11 +2044,23 @@ class DetectorAbnormalTimePeriod(Model): 'source': {'key': 'source', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'float'}, 'meta_data': {'key': 'metaData', 'type': '[[NameValuePair]]'}, - 'type': {'key': 'type', 'type': 'IssueType'}, + 'type': {'key': 'type', 'type': 'str'}, 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, *, start_time=None, end_time=None, message: str=None, source: str=None, priority: float=None, meta_data=None, type=None, solutions=None, **kwargs) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + message: Optional[str] = None, + source: Optional[str] = None, + priority: Optional[float] = None, + meta_data: Optional[List[List["NameValuePair"]]] = None, + type: Optional[Union[str, "IssueType"]] = None, + solutions: Optional[List["Solution"]] = None, + **kwargs + ): super(DetectorAbnormalTimePeriod, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -1703,8 +2075,7 @@ def __init__(self, *, start_time=None, end_time=None, message: str=None, source: class DetectorDefinition(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1714,11 +2085,11 @@ class DetectorDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar display_name: Display name of the detector + :ivar display_name: Display name of the detector. :vartype display_name: str - :ivar description: Description of the detector + :ivar description: Description of the detector. :vartype description: str - :ivar rank: Detector Rank + :ivar rank: Detector Rank. :vartype rank: float :ivar is_enabled: Flag representing whether detector is enabled or not. :vartype is_enabled: bool @@ -1745,7 +2116,12 @@ class DetectorDefinition(ProxyOnlyResource): 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DetectorDefinition, self).__init__(kind=kind, **kwargs) self.display_name = None self.description = None @@ -1753,19 +2129,18 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.is_enabled = None -class DetectorInfo(Model): +class DetectorInfo(msrest.serialization.Model): """Definition of Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Short description of the detector and its purpose + :ivar description: Short description of the detector and its purpose. :vartype description: str - :ivar category: Support Category + :ivar category: Support Category. :vartype category: str - :ivar sub_category: Support Sub Category + :ivar sub_category: Support Sub Category. :vartype sub_category: str - :ivar support_topic_id: Support Topic Id + :ivar support_topic_id: Support Topic Id. :vartype support_topic_id: str """ @@ -1783,7 +2158,10 @@ class DetectorInfo(Model): 'support_topic_id': {'key': 'supportTopicId', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DetectorInfo, self).__init__(**kwargs) self.description = None self.category = None @@ -1794,8 +2172,7 @@ def __init__(self, **kwargs) -> None: class DetectorResponse(ProxyOnlyResource): """Class representing Response from Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1805,9 +2182,9 @@ class DetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param metadata: metadata for the detector + :param metadata: metadata for the detector. :type metadata: ~azure.mgmt.web.v2016_03_01.models.DetectorInfo - :param dataset: Data Set + :param dataset: Data Set. :type dataset: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticData] """ @@ -1826,17 +2203,57 @@ class DetectorResponse(ProxyOnlyResource): 'dataset': {'key': 'properties.dataset', 'type': '[DiagnosticData]'}, } - def __init__(self, *, kind: str=None, metadata=None, dataset=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + metadata: Optional["DetectorInfo"] = None, + dataset: Optional[List["DiagnosticData"]] = None, + **kwargs + ): super(DetectorResponse, self).__init__(kind=kind, **kwargs) self.metadata = metadata self.dataset = dataset +class DetectorResponseCollection(msrest.serialization.Model): + """Collection of detector responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DetectorResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DetectorResponse"], + **kwargs + ): + super(DetectorResponseCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticAnalysis(ProxyOnlyResource): """Class representing a diagnostic analysis done on an application. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1846,19 +2263,16 @@ class DiagnosticAnalysis(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param abnormal_time_periods: List of time periods. - :type abnormal_time_periods: - list[~azure.mgmt.web.v2016_03_01.models.AbnormalTimePeriod] - :param payload: Data by each detector + :type abnormal_time_periods: list[~azure.mgmt.web.v2016_03_01.models.AbnormalTimePeriod] + :param payload: Data by each detector. :type payload: list[~azure.mgmt.web.v2016_03_01.models.AnalysisData] - :param non_correlated_detectors: Data by each detector for detectors that - did not corelate - :type non_correlated_detectors: - list[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] + :param non_correlated_detectors: Data by each detector for detectors that did not corelate. + :type non_correlated_detectors: list[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] """ _validation = { @@ -1879,7 +2293,17 @@ class DiagnosticAnalysis(ProxyOnlyResource): 'non_correlated_detectors': {'key': 'properties.nonCorrelatedDetectors', 'type': '[DetectorDefinition]'}, } - def __init__(self, *, kind: str=None, start_time=None, end_time=None, abnormal_time_periods=None, payload=None, non_correlated_detectors=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + abnormal_time_periods: Optional[List["AbnormalTimePeriod"]] = None, + payload: Optional[List["AnalysisData"]] = None, + non_correlated_detectors: Optional[List["DetectorDefinition"]] = None, + **kwargs + ): super(DiagnosticAnalysis, self).__init__(kind=kind, **kwargs) self.start_time = start_time self.end_time = end_time @@ -1888,11 +2312,44 @@ def __init__(self, *, kind: str=None, start_time=None, end_time=None, abnormal_t self.non_correlated_detectors = non_correlated_detectors +class DiagnosticAnalysisCollection(msrest.serialization.Model): + """Collection of Diagnostic Analyses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.AnalysisDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AnalysisDefinition"], + **kwargs + ): + super(DiagnosticAnalysisCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticCategory(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1902,7 +2359,7 @@ class DiagnosticCategory(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the diagnostic category + :ivar description: Description of the diagnostic category. :vartype description: str """ @@ -1921,18 +2378,56 @@ class DiagnosticCategory(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DiagnosticCategory, self).__init__(kind=kind, **kwargs) self.description = None -class DiagnosticData(Model): +class DiagnosticCategoryCollection(msrest.serialization.Model): + """Collection of Diagnostic Categories. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticCategory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiagnosticCategory"], + **kwargs + ): + super(DiagnosticCategoryCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DiagnosticData(msrest.serialization.Model): """Set of data with rendering instructions. - :param table: Data in table form + :param table: Data in table form. :type table: ~azure.mgmt.web.v2016_03_01.models.DataTableResponseObject - :param rendering_properties: Properties that describe how the table should - be rendered + :param rendering_properties: Properties that describe how the table should be rendered. :type rendering_properties: ~azure.mgmt.web.v2016_03_01.models.Rendering """ @@ -1941,17 +2436,56 @@ class DiagnosticData(Model): 'rendering_properties': {'key': 'renderingProperties', 'type': 'Rendering'}, } - def __init__(self, *, table=None, rendering_properties=None, **kwargs) -> None: + def __init__( + self, + *, + table: Optional["DataTableResponseObject"] = None, + rendering_properties: Optional["Rendering"] = None, + **kwargs + ): super(DiagnosticData, self).__init__(**kwargs) self.table = table self.rendering_properties = rendering_properties +class DiagnosticDetectorCollection(msrest.serialization.Model): + """Collection of Diagnostic Detectors. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DetectorDefinition"], + **kwargs + ): + super(DiagnosticDetectorCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticDetectorResponse(ProxyOnlyResource): """Class representing Response from Diagnostic Detectors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1961,27 +2495,23 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param issue_detected: Flag representing Issue was detected. :type issue_detected: bool - :param detector_definition: Detector's definition - :type detector_definition: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition - :param metrics: Metrics provided by the detector - :type metrics: - list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] - :param abnormal_time_periods: List of Correlated events found by the - detector + :param detector_definition: Detector's definition. + :type detector_definition: ~azure.mgmt.web.v2016_03_01.models.DetectorDefinition + :param metrics: Metrics provided by the detector. + :type metrics: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSet] + :param abnormal_time_periods: List of Correlated events found by the detector. :type abnormal_time_periods: list[~azure.mgmt.web.v2016_03_01.models.DetectorAbnormalTimePeriod] :param data: Additional Data that detector wants to send. :type data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] - :param response_meta_data: Meta Data - :type response_meta_data: - ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData + :param response_meta_data: Meta Data. + :type response_meta_data: ~azure.mgmt.web.v2016_03_01.models.ResponseMetaData """ _validation = { @@ -2005,7 +2535,20 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): 'response_meta_data': {'key': 'properties.responseMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, *, kind: str=None, start_time=None, end_time=None, issue_detected: bool=None, detector_definition=None, metrics=None, abnormal_time_periods=None, data=None, response_meta_data=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + issue_detected: Optional[bool] = None, + detector_definition: Optional["DetectorDefinition"] = None, + metrics: Optional[List["DiagnosticMetricSet"]] = None, + abnormal_time_periods: Optional[List["DetectorAbnormalTimePeriod"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + response_meta_data: Optional["ResponseMetaData"] = None, + **kwargs + ): super(DiagnosticDetectorResponse, self).__init__(kind=kind, **kwargs) self.start_time = start_time self.end_time = end_time @@ -2017,28 +2560,24 @@ def __init__(self, *, kind: str=None, start_time=None, end_time=None, issue_dete self.response_meta_data = response_meta_data -class DiagnosticMetricSample(Model): +class DiagnosticMetricSample(msrest.serialization.Model): """Class representing Diagnostic Metric. - :param timestamp: Time at which metric is measured - :type timestamp: datetime - :param role_instance: Role Instance. Null if this counter is not per - instance - This is returned and should be whichever instance name we desire to be - returned + :param timestamp: Time at which metric is measured. + :type timestamp: ~datetime.datetime + :param role_instance: Role Instance. Null if this counter is not per instance + This is returned and should be whichever instance name we desire to be returned i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) - where RDWORKERNAME is Machine name below and RoleInstance name in - parenthesis + where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis. :type role_instance: str - :param total: Total value of the metric. If multiple measurements are made - this will have sum of all. + :param total: Total value of the metric. If multiple measurements are made this will have sum + of all. :type total: float - :param maximum: Maximum of the metric sampled during the time period + :param maximum: Maximum of the metric sampled during the time period. :type maximum: float - :param minimum: Minimum of the metric sampled during the time period + :param minimum: Minimum of the metric sampled during the time period. :type minimum: float - :param is_aggregated: Whether the values are aggregates across all workers - or not + :param is_aggregated: Whether the values are aggregates across all workers or not. :type is_aggregated: bool """ @@ -2051,7 +2590,17 @@ class DiagnosticMetricSample(Model): 'is_aggregated': {'key': 'isAggregated', 'type': 'bool'}, } - def __init__(self, *, timestamp=None, role_instance: str=None, total: float=None, maximum: float=None, minimum: float=None, is_aggregated: bool=None, **kwargs) -> None: + def __init__( + self, + *, + timestamp: Optional[datetime.datetime] = None, + role_instance: Optional[str] = None, + total: Optional[float] = None, + maximum: Optional[float] = None, + minimum: Optional[float] = None, + is_aggregated: Optional[bool] = None, + **kwargs + ): super(DiagnosticMetricSample, self).__init__(**kwargs) self.timestamp = timestamp self.role_instance = role_instance @@ -2061,25 +2610,22 @@ def __init__(self, *, timestamp=None, role_instance: str=None, total: float=None self.is_aggregated = is_aggregated -class DiagnosticMetricSet(Model): +class DiagnosticMetricSet(msrest.serialization.Model): """Class representing Diagnostic Metric information. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param unit: Metric's unit + :param unit: Metric's unit. :type unit: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime - :param time_grain: Presented time grain. Supported grains at the moment - are PT1M, PT1H, P1D + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime + :param time_grain: Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D. :type time_grain: str - :param values: Collection of metric values for the selected period based - on the - {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} - :type values: - list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSample] + :param values: Collection of metric values for the selected period based on the + {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain}. + :type values: list[~azure.mgmt.web.v2016_03_01.models.DiagnosticMetricSample] """ _attribute_map = { @@ -2091,7 +2637,17 @@ class DiagnosticMetricSet(Model): 'values': {'key': 'values', 'type': '[DiagnosticMetricSample]'}, } - def __init__(self, *, name: str=None, unit: str=None, start_time=None, end_time=None, time_grain: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + unit: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + values: Optional[List["DiagnosticMetricSample"]] = None, + **kwargs + ): super(DiagnosticMetricSet, self).__init__(**kwargs) self.name = name self.unit = unit @@ -2101,10 +2657,9 @@ def __init__(self, *, name: str=None, unit: str=None, start_time=None, end_time= self.values = values -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -2123,7 +2678,15 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, internal_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2131,7 +2694,7 @@ def __init__(self, *, name: str=None, display_name: str=None, internal_name: str self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -2157,7 +2720,17 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, extended_code: str=None, message_template: str=None, parameters=None, inner_errors=None, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["ErrorEntity"]] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = extended_code self.message_template = message_template @@ -2167,7 +2740,7 @@ def __init__(self, *, extended_code: str=None, message_template: str=None, param self.message = message -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -2178,7 +2751,12 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: + def __init__( + self, + *, + ramp_up_rules: Optional[List["RampUpRule"]] = None, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = ramp_up_rules @@ -2186,8 +2764,7 @@ def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: class GeoRegion(ProxyOnlyResource): """Geographical region. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2197,8 +2774,8 @@ class GeoRegion(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar geo_region_name: Region name. - :vartype geo_region_name: str + :ivar name_properties_name: Region name. + :vartype name_properties_name: str :ivar description: Region description. :vartype description: str :ivar display_name: Display name for region. @@ -2209,7 +2786,7 @@ class GeoRegion(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'geo_region_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'description': {'readonly': True}, 'display_name': {'readonly': True}, } @@ -2219,19 +2796,58 @@ class GeoRegion(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'geo_region_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(GeoRegion, self).__init__(kind=kind, **kwargs) - self.geo_region_name = None + self.name_properties_name = None self.description = None self.display_name = None -class GlobalCsmSkuDescription(Model): +class GeoRegionCollection(msrest.serialization.Model): + """Collection of geographical regions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.GeoRegion] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GeoRegion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GeoRegion"], + **kwargs + ): + super(GeoRegionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class GlobalCsmSkuDescription(msrest.serialization.Model): """A Global SKU Description. :param name: Name of the resource SKU. @@ -2246,8 +2862,7 @@ class GlobalCsmSkuDescription(Model): :type capacity: ~azure.mgmt.web.v2016_03_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2016_03_01.models.Capability] """ @@ -2261,7 +2876,18 @@ class GlobalCsmSkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(GlobalCsmSkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2272,19 +2898,16 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -2294,14 +2917,21 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: + def __init__( + self, + *, + extension: Optional[str] = None, + script_processor: Optional[str] = None, + arguments: Optional[str] = None, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = extension self.script_processor = script_processor self.arguments = arguments -class HostingEnvironmentDeploymentInfo(Model): +class HostingEnvironmentDeploymentInfo(msrest.serialization.Model): """Information needed to create resources on an App Service Environment. :param name: Name of the App Service Environment. @@ -2315,17 +2945,22 @@ class HostingEnvironmentDeploymentInfo(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, name: str=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentDeploymentInfo, self).__init__(**kwargs) self.name = name self.location = location -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -2346,43 +2981,57 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = id self.name = None self.type = None -class HostNameSslState(Model): +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_03_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2016_03_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: + 'host_type': {'key': 'hostType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + virtual_ip: Optional[str] = None, + thumbprint: Optional[str] = None, + to_update: Optional[bool] = None, + host_type: Optional[Union[str, "HostType"]] = None, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = name self.ssl_state = ssl_state @@ -2395,8 +3044,7 @@ def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thum class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2416,15 +3064,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -2449,7 +3097,20 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + service_bus_namespace: Optional[str] = None, + relay_name: Optional[str] = None, + relay_arm_uri: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + send_key_name: Optional[str] = None, + send_key_value: Optional[str] = None, + service_bus_suffix: Optional[str] = None, + **kwargs + ): super(HybridConnection, self).__init__(kind=kind, **kwargs) self.service_bus_namespace = service_bus_namespace self.relay_name = relay_name @@ -2462,11 +3123,9 @@ def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_nam class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2499,7 +3158,12 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) self.send_key_name = None self.send_key_value = None @@ -2508,8 +3172,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2519,8 +3182,8 @@ class Identifier(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str + :param id_properties_id: String representation of the identity. + :type id_properties_id: str """ _validation = { @@ -2534,24 +3197,62 @@ class Identifier(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[str] = None, + **kwargs + ): super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id + self.id_properties_id = id_properties_id + + +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ -class IpSecurityRestriction(Model): + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Identifier"], + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP address the security restriction is valid - for. + :param ip_address: Required. IP address the security restriction is valid for. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str """ @@ -2564,13 +3265,19 @@ class IpSecurityRestriction(Model): 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, } - def __init__(self, *, ip_address: str, subnet_mask: str=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: str, + subnet_mask: Optional[str] = None, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = ip_address self.subnet_mask = subnet_mask -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -2584,22 +3291,25 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = value self.localized_value = localized_value -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned". + :type type: str or ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. @@ -2617,14 +3327,19 @@ class ManagedServiceIdentity(Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, } - def __init__(self, *, type=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = type self.tenant_id = None self.principal_id = None -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -2638,13 +3353,19 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, time_grain: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = time_grain self.blob_duration = blob_duration -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -2676,8 +3397,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2016_03_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2016_03_01.models.MetricAvailability] """ _attribute_map = { @@ -2698,7 +3418,26 @@ class MetricSpecification(Model): 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, supports_instance_level_aggregation: bool=None, enable_regional_mdm_account: bool=None, source_mdm_account: str=None, source_mdm_namespace: str=None, metric_filter_pattern: str=None, fill_gap_with_zero: bool=None, is_internal: bool=None, dimensions=None, category: str=None, availabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supports_instance_level_aggregation: Optional[bool] = None, + enable_regional_mdm_account: Optional[bool] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + metric_filter_pattern: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + is_internal: Optional[bool] = None, + dimensions: Optional[List["Dimension"]] = None, + category: Optional[str] = None, + availabilities: Optional[List["MetricAvailability"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2717,7 +3456,7 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio self.availabilities = availabilities -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -2728,12 +3467,17 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = name -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -2747,18 +3491,23 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = name self.value = value -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2016_03_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2016_03_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -2768,13 +3517,21 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, *, action=None, description: str=None, order: int=None, remote_subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + action: Optional[Union[str, "AccessControlEntryAction"]] = None, + description: Optional[str] = None, + order: Optional[int] = None, + remote_subnet: Optional[str] = None, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = action self.description = description @@ -2782,24 +3539,24 @@ def __init__(self, *, action=None, description: str=None, order: int=None, remot self.remote_subnet = remote_subnet -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2016_03_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2016_03_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -2807,7 +3564,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -2815,7 +3572,19 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, created_time=None, modified_time=None, expiration_time=None, geo_master_operation_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "OperationStatus"]] = None, + errors: Optional[List["ErrorEntity"]] = None, + created_time: Optional[datetime.datetime] = None, + modified_time: Optional[datetime.datetime] = None, + expiration_time: Optional[datetime.datetime] = None, + geo_master_operation_id: Optional[str] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = id self.name = name @@ -2830,8 +3599,7 @@ def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, cr class PremierAddOnOffer(ProxyOnlyResource): """Premier add-on offer. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2847,16 +3615,15 @@ class PremierAddOnOffer(ProxyOnlyResource): :type product: str :param vendor: Premier add on offer Vendor. :type vendor: str - :param premier_add_on_offer_name: Premier add on offer Name. - :type premier_add_on_offer_name: str - :param promo_code_required: true if promotion code is - required; otherwise, false. + :param name_properties_name: Premier add on offer Name. + :type name_properties_name: str + :param promo_code_required: :code:`true` if promotion code is required; otherwise, + :code:`false`. :type promo_code_required: bool :param quota: Premier add on offer Quota. :type quota: int - :param web_hosting_plan_restrictions: App Service plans this offer is - restricted to. Possible values include: 'None', 'Free', 'Shared', 'Basic', - 'Standard', 'Premium' + :param web_hosting_plan_restrictions: App Service plans this offer is restricted to. Possible + values include: "None", "Free", "Shared", "Basic", "Standard", "Premium". :type web_hosting_plan_restrictions: str or ~azure.mgmt.web.v2016_03_01.models.AppServicePlanRestrictions :param privacy_policy_url: Privacy policy URL. @@ -2883,22 +3650,38 @@ class PremierAddOnOffer(ProxyOnlyResource): 'sku': {'key': 'properties.sku', 'type': 'str'}, 'product': {'key': 'properties.product', 'type': 'str'}, 'vendor': {'key': 'properties.vendor', 'type': 'str'}, - 'premier_add_on_offer_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'promo_code_required': {'key': 'properties.promoCodeRequired', 'type': 'bool'}, 'quota': {'key': 'properties.quota', 'type': 'int'}, - 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'AppServicePlanRestrictions'}, + 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'str'}, 'privacy_policy_url': {'key': 'properties.privacyPolicyUrl', 'type': 'str'}, 'legal_terms_url': {'key': 'properties.legalTermsUrl', 'type': 'str'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: str=None, premier_add_on_offer_name: str=None, promo_code_required: bool=None, quota: int=None, web_hosting_plan_restrictions=None, privacy_policy_url: str=None, legal_terms_url: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + name_properties_name: Optional[str] = None, + promo_code_required: Optional[bool] = None, + quota: Optional[int] = None, + web_hosting_plan_restrictions: Optional[Union[str, "AppServicePlanRestrictions"]] = None, + privacy_policy_url: Optional[str] = None, + legal_terms_url: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOnOffer, self).__init__(kind=kind, **kwargs) self.sku = sku self.product = product self.vendor = vendor - self.premier_add_on_offer_name = premier_add_on_offer_name + self.name_properties_name = name_properties_name self.promo_code_required = promo_code_required self.quota = quota self.web_hosting_plan_restrictions = web_hosting_plan_restrictions @@ -2908,14 +3691,45 @@ def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: self.marketplace_offer = marketplace_offer -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PremierAddOnOfferCollection(msrest.serialization.Model): + """Collection of premier add-on offers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOffer] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremierAddOnOffer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PremierAddOnOffer"], + **kwargs + ): + super(PremierAddOnOfferCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2924,22 +3738,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -2947,7 +3758,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -2961,7 +3771,16 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + is_push_enabled: Optional[bool] = None, + tag_whitelist_json: Optional[str] = None, + tags_requiring_auth: Optional[str] = None, + dynamic_tags_json: Optional[str] = None, + **kwargs + ): super(PushSettings, self).__init__(kind=kind, **kwargs) self.is_push_enabled = is_push_enabled self.tag_whitelist_json = tag_whitelist_json @@ -2969,40 +3788,38 @@ def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: self.dynamic_tags_json = dynamic_tags_json -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -3017,7 +3834,19 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_host_name: Optional[str] = None, + reroute_percentage: Optional[float] = None, + change_step: Optional[float] = None, + change_interval_in_minutes: Optional[int] = None, + min_reroute_percentage: Optional[float] = None, + max_reroute_percentage: Optional[float] = None, + change_decision_callback_url: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = action_host_name self.reroute_percentage = reroute_percentage @@ -3032,8 +3861,7 @@ def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None class Recommendation(ProxyOnlyResource): """Represents a recommendation result generated by the recommendation engine. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3044,62 +3872,52 @@ class Recommendation(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param creation_time: Timestamp when this instance was created. - :type creation_time: datetime - :param recommendation_id: A GUID value that each recommendation object is - associated with. + :type creation_time: ~datetime.datetime + :param recommendation_id: A GUID value that each recommendation object is associated with. :type recommendation_id: str - :param resource_id: Full ARM resource ID string that this recommendation - object is associated with. + :param resource_id: Full ARM resource ID string that this recommendation object is associated + with. :type resource_id: str - :param resource_scope: Name of a resource type this recommendation - applies, e.g. Subscription, ServerFarm, Site. Possible values include: - 'ServerFarm', 'Subscription', 'WebSite' - :type resource_scope: str or - ~azure.mgmt.web.v2016_03_01.models.ResourceScopeType + :param resource_scope: Name of a resource type this recommendation applies, e.g. Subscription, + ServerFarm, Site. Possible values include: "ServerFarm", "Subscription", "WebSite". + :type resource_scope: str or ~azure.mgmt.web.v2016_03_01.models.ResourceScopeType :param rule_name: Unique name of the rule. :type rule_name: str :param display_name: UI friendly name of the rule (may not be unique). :type display_name: str :param message: Recommendation text. :type message: str - :param level: Level indicating how critical this recommendation can - impact. Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level indicating how critical this recommendation can impact. Possible values + include: "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2016_03_01.models.NotificationLevel - :param channels: List of channels that this recommendation can apply. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of channels that this recommendation can apply. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2016_03_01.models.Channels - :param tags: The list of category tags that this recommendation belongs - to. + :param tags: A set of tags. The list of category tags that this recommendation belongs to. :type tags: list[str] :param action_name: Name of action recommended by this object. :type action_name: str - :param start_time: The beginning time in UTC of a range that the - recommendation refers to. - :type start_time: datetime - :param end_time: The end time in UTC of a range that the recommendation - refers to. - :type end_time: datetime - :param next_notification_time: When to notify this recommendation next in - UTC. Null means that this will never be notified anymore. - :type next_notification_time: datetime - :param notification_expiration_time: Date and time in UTC when this - notification expires. - :type notification_expiration_time: datetime - :param notified_time: Last timestamp in UTC this instance was actually - notified. Null means that this recommendation hasn't been notified yet. - :type notified_time: datetime + :param start_time: The beginning time in UTC of a range that the recommendation refers to. + :type start_time: ~datetime.datetime + :param end_time: The end time in UTC of a range that the recommendation refers to. + :type end_time: ~datetime.datetime + :param next_notification_time: When to notify this recommendation next in UTC. Null means that + this will never be notified anymore. + :type next_notification_time: ~datetime.datetime + :param notification_expiration_time: Date and time in UTC when this notification expires. + :type notification_expiration_time: ~datetime.datetime + :param notified_time: Last timestamp in UTC this instance was actually notified. Null means + that this recommendation hasn't been notified yet. + :type notified_time: ~datetime.datetime :param score: A metric value measured by the rule. :type score: float - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool :param extension_name: Extension name of the portal if exists. :type extension_name: str :param blade_name: Deep link to a blade on the portal. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. + :param forward_link: Forward link to an external document associated with the rule. :type forward_link: str """ @@ -3121,8 +3939,8 @@ class Recommendation(ProxyOnlyResource): 'rule_name': {'key': 'properties.ruleName', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'tags': {'key': 'properties.tags', 'type': '[str]'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, @@ -3137,7 +3955,33 @@ class Recommendation(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, creation_time=None, recommendation_id: str=None, resource_id: str=None, resource_scope=None, rule_name: str=None, display_name: str=None, message: str=None, level=None, channels=None, tags=None, action_name: str=None, start_time=None, end_time=None, next_notification_time=None, notification_expiration_time=None, notified_time=None, score: float=None, is_dynamic: bool=None, extension_name: str=None, blade_name: str=None, forward_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + recommendation_id: Optional[str] = None, + resource_id: Optional[str] = None, + resource_scope: Optional[Union[str, "ResourceScopeType"]] = None, + rule_name: Optional[str] = None, + display_name: Optional[str] = None, + message: Optional[str] = None, + level: Optional[Union[str, "NotificationLevel"]] = None, + channels: Optional[Union[str, "Channels"]] = None, + tags: Optional[List[str]] = None, + action_name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + next_notification_time: Optional[datetime.datetime] = None, + notification_expiration_time: Optional[datetime.datetime] = None, + notified_time: Optional[datetime.datetime] = None, + score: Optional[float] = None, + is_dynamic: Optional[bool] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + forward_link: Optional[str] = None, + **kwargs + ): super(Recommendation, self).__init__(kind=kind, **kwargs) self.creation_time = creation_time self.recommendation_id = recommendation_id @@ -3162,12 +4006,44 @@ def __init__(self, *, kind: str=None, creation_time=None, recommendation_id: str self.forward_link = forward_link +class RecommendationCollection(msrest.serialization.Model): + """Collection of recommendations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.Recommendation] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Recommendation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Recommendation"], + **kwargs + ): + super(RecommendationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class RecommendationRule(ProxyOnlyResource): - """Represents a recommendation rule that the recommendation engine can - perform. + """Represents a recommendation rule that the recommendation engine can perform. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3177,41 +4053,36 @@ class RecommendationRule(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param recommendation_rule_name: Unique name of the rule. - :type recommendation_rule_name: str + :param name_properties_name: Unique name of the rule. + :type name_properties_name: str :param display_name: UI friendly name of the rule. :type display_name: str :param message: Localized name of the rule (Good for UI). :type message: str - :param recommendation_id: Recommendation ID of an associated - recommendation object tied to the rule, if exists. + :param recommendation_id: Recommendation ID of an associated recommendation object tied to the + rule, if exists. If such an object doesn't exist, it is set to null. :type recommendation_id: str :param description: Localized detailed description of the rule. :type description: str - :param action_name: Name of action that is recommended by this rule in - string. + :param action_name: Name of action that is recommended by this rule in string. :type action_name: str - :param level: Level of impact indicating how critical this rule is. - Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level of impact indicating how critical this rule is. Possible values include: + "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2016_03_01.models.NotificationLevel - :param channels: List of available channels that this rule applies. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of available channels that this rule applies. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2016_03_01.models.Channels - :param tags: An array of category tags that the rule contains. + :param tags: A set of tags. An array of category tags that the rule contains. :type tags: list[str] - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool - :param extension_name: Extension name of the portal if exists. Applicable - to dynamic rule only. + :param extension_name: Extension name of the portal if exists. Applicable to dynamic rule only. :type extension_name: str - :param blade_name: Deep link to a blade on the portal. Applicable to - dynamic rule only. + :param blade_name: Deep link to a blade on the portal. Applicable to dynamic rule only. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. Applicable to dynamic rule only. + :param forward_link: Forward link to an external document associated with the rule. Applicable + to dynamic rule only. :type forward_link: str """ @@ -3226,14 +4097,14 @@ class RecommendationRule(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'recommendation_rule_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, 'recommendation_id': {'key': 'properties.recommendationId', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'tags': {'key': 'properties.tags', 'type': '[str]'}, 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, 'extension_name': {'key': 'properties.extensionName', 'type': 'str'}, @@ -3241,9 +4112,27 @@ class RecommendationRule(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, recommendation_rule_name: str=None, display_name: str=None, message: str=None, recommendation_id: str=None, description: str=None, action_name: str=None, level=None, channels=None, tags=None, is_dynamic: bool=None, extension_name: str=None, blade_name: str=None, forward_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + display_name: Optional[str] = None, + message: Optional[str] = None, + recommendation_id: Optional[str] = None, + description: Optional[str] = None, + action_name: Optional[str] = None, + level: Optional[Union[str, "NotificationLevel"]] = None, + channels: Optional[Union[str, "Channels"]] = None, + tags: Optional[List[str]] = None, + is_dynamic: Optional[bool] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + forward_link: Optional[str] = None, + **kwargs + ): super(RecommendationRule, self).__init__(kind=kind, **kwargs) - self.recommendation_rule_name = recommendation_rule_name + self.name_properties_name = name_properties_name self.display_name = display_name self.message = message self.recommendation_id = recommendation_id @@ -3258,34 +4147,39 @@ def __init__(self, *, kind: str=None, recommendation_rule_name: str=None, displa self.forward_link = forward_link -class Rendering(Model): +class Rendering(msrest.serialization.Model): """Instructions for rendering the data. - :param rendering_type: Rendering Type. Possible values include: 'NoGraph', - 'Table', 'TimeSeries', 'TimeSeriesPerInstance' - :type rendering_type: str or - ~azure.mgmt.web.v2016_03_01.models.RenderingType - :param title: Title of data + :param rendering_type: Rendering Type. Possible values include: "NoGraph", "Table", + "TimeSeries", "TimeSeriesPerInstance". + :type rendering_type: str or ~azure.mgmt.web.v2016_03_01.models.RenderingType + :param title: Title of data. :type title: str - :param description: Description of the data that will help it be - interpreted + :param description: Description of the data that will help it be interpreted. :type description: str """ _attribute_map = { - 'rendering_type': {'key': 'renderingType', 'type': 'RenderingType'}, + 'rendering_type': {'key': 'renderingType', 'type': 'str'}, 'title': {'key': 'title', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, rendering_type=None, title: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + rendering_type: Optional[Union[str, "RenderingType"]] = None, + title: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(Rendering, self).__init__(**kwargs) self.rendering_type = rendering_type self.title = title self.description = description -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -3299,7 +4193,13 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = count self.time_interval = time_interval @@ -3308,8 +4208,7 @@ def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> Non class ResourceHealthMetadata(ProxyOnlyResource): """Used for getting ResourceHealthCheck settings. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3319,10 +4218,9 @@ class ResourceHealthMetadata(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param category: The category that the resource matches in the RHC Policy - File + :param category: The category that the resource matches in the RHC Policy File. :type category: str - :param signal_availability: Is there a health signal for the resource + :param signal_availability: Is there a health signal for the resource. :type signal_availability: bool """ @@ -3341,38 +4239,76 @@ class ResourceHealthMetadata(ProxyOnlyResource): 'signal_availability': {'key': 'properties.signalAvailability', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, category: str=None, signal_availability: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + category: Optional[str] = None, + signal_availability: Optional[bool] = None, + **kwargs + ): super(ResourceHealthMetadata, self).__init__(kind=kind, **kwargs) self.category = category self.signal_availability = signal_availability -class ResourceMetric(Model): +class ResourceHealthMetadataCollection(msrest.serialization.Model): + """Collection of resource health metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceHealthMetadata]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceHealthMetadata"], + **kwargs + ): + super(ResourceHealthMetadataCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2016_03_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] """ _validation = { @@ -3399,7 +4335,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -3412,11 +4351,10 @@ def __init__(self, **kwargs) -> None: self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -3434,17 +4372,19 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None -class ResourceMetricCollection(Model): +class ResourceMetricCollection(msrest.serialization.Model): """Collection of metric responses. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3464,7 +4404,12 @@ class ResourceMetricCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["ResourceMetric"], + **kwargs + ): super(ResourceMetricCollection, self).__init__(**kwargs) self.value = value self.next_link = None @@ -3473,8 +4418,7 @@ def __init__(self, *, value, **kwargs) -> None: class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3484,21 +4428,20 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2016_03_01.models.ResourceMetricName + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: ~azure.mgmt.web.v2016_03_01.models.ResourceMetricName :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str + :ivar id_properties_id: Resource ID. + :vartype id_properties_id: str :ivar properties: Resource metric definition properties. :vartype properties: dict[str, str] """ @@ -3507,12 +4450,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, 'properties': {'readonly': True}, } @@ -3521,37 +4464,40 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) - self.resource_metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.resource_uri = None - self.resource_metric_definition_id = None + self.id_properties_id = None self.properties = None -class ResourceMetricDefinitionCollection(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): """Collection of metric definitions. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param value: Required. Collection of resources. - :type value: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricDefinition] + :type value: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricDefinition] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3566,17 +4512,21 @@ class ResourceMetricDefinitionCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["ResourceMetricDefinition"], + **kwargs + ): super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) self.value = value self.next_link = None -class ResourceMetricName(Model): +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -3594,13 +4544,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -3614,17 +4567,22 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = key self.value = value -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -3639,8 +4597,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_03_01.models.ResourceMetricProperty] """ _validation = { @@ -3663,7 +4620,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -3674,24 +4634,21 @@ def __init__(self, **kwargs) -> None: self.properties = None -class ResourceNameAvailability(Model): +class ResourceNameAvailability(msrest.serialization.Model): """Information regarding availability of a resource name. - :param name_available: true indicates name is valid and - available. false indicates the name is invalid, unavailable, - or both. + :param name_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. :type name_available: bool - :param reason: Invalid indicates the name provided does not - match Azure App Service naming requirements. AlreadyExists - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.web.v2016_03_01.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why - the given name is invalid, and provide the resource naming requirements so - that the user can select a valid name. If reason == AlreadyExists, explain - that resource name is already in use, and direct them to select a - different name. + :param reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.web.v2016_03_01.models.InAvailabilityReasonType + :param message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. :type message: str """ @@ -3701,26 +4658,32 @@ class ResourceNameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "InAvailabilityReasonType"]] = None, + message: Optional[str] = None, + **kwargs + ): super(ResourceNameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class ResourceNameAvailabilityRequest(Model): +class ResourceNameAvailabilityRequest(msrest.serialization.Model): """Resource name availability request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes + :param type: Required. Resource type used for verification. Possible values include: "Site", + "Slot", "HostingEnvironment", "PublishingUser", "Microsoft.Web/sites", + "Microsoft.Web/sites/slots", "Microsoft.Web/hostingEnvironments", + "Microsoft.Web/publishingUsers". + :type type: str or ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool """ @@ -3736,17 +4699,24 @@ class ResourceNameAvailabilityRequest(Model): 'is_fqdn': {'key': 'isFqdn', 'type': 'bool'}, } - def __init__(self, *, name: str, type, is_fqdn: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + type: Union[str, "CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ): super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type self.is_fqdn = is_fqdn -class ResponseMetaData(Model): +class ResponseMetaData(msrest.serialization.Model): """ResponseMetaData. - :param data_source: Source of the Data + :param data_source: Source of the Data. :type data_source: ~azure.mgmt.web.v2016_03_01.models.DataSource """ @@ -3754,24 +4724,33 @@ class ResponseMetaData(Model): 'data_source': {'key': 'dataSource', 'type': 'DataSource'}, } - def __init__(self, *, data_source=None, **kwargs) -> None: + def __init__( + self, + *, + data_source: Optional["DataSource"] = None, + **kwargs + ): super(ResponseMetaData, self).__init__(**kwargs) self.data_source = data_source -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """Resource metrics service provided by Microsoft.Insights resource provider. :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2016_03_01.models.MetricSpecification] + :type metric_specifications: list[~azure.mgmt.web.v2016_03_01.models.MetricSpecification] """ _attribute_map = { 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, metric_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -3779,8 +4758,7 @@ def __init__(self, *, metric_specifications=None, **kwargs) -> None: class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3794,117 +4772,99 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_03_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_03_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_03_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_03_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_03_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_03_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_03_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_03_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_03_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_03_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2016_03_01.models.ManagedServiceIdentity """ _validation = { @@ -3938,13 +4898,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -3970,11 +4931,34 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, snapshot_info=None, https_only: bool=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + snapshot_info: Optional["SnapshotRecoveryRequest"] = None, + https_only: Optional[bool] = None, + **kwargs + ): super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -4007,21 +4991,18 @@ def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=No self.default_host_name = None self.slot_swap_status = None self.https_only = https_only - self.identity = identity -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -4029,52 +5010,50 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_03_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_03_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_03_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_03_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_03_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_03_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_03_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -4084,24 +5063,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_03_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_03_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_03_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_03_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_03_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_03_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_03_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_03_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_03_01.models.AutoHealRules @@ -4113,25 +5088,21 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2016_03_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_03_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_03_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_03_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_03_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_03_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_03_01.models.SupportedTlsVersions """ _validation = { @@ -4167,9 +5138,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -4186,7 +5157,55 @@ class SiteConfig(Model): 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, } - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, ip_security_restrictions=None, http20_enabled: bool=True, min_tls_version=None, **kwargs) -> None: + def __init__( + self, + *, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -4235,7 +5254,7 @@ def __init__(self, *, number_of_workers: int=None, default_documents=None, net_f self.min_tls_version = min_tls_version -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -4252,14 +5271,21 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: + def __init__( + self, + *, + max_percentage_cpu: Optional[float] = None, + max_memory_in_mb: Optional[int] = None, + max_disk_size_in_mb: Optional[int] = None, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = max_percentage_cpu self.max_memory_in_mb = max_memory_in_mb self.max_disk_size_in_mb = max_disk_size_in_mb -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -4279,7 +5305,15 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + validation: Optional[str] = None, + validation_key: Optional[str] = None, + decryption: Optional[str] = None, + decryption_key: Optional[str] = None, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = validation self.validation_key = validation_key @@ -4287,7 +5321,7 @@ def __init__(self, *, validation: str=None, validation_key: str=None, decryption self.decryption_key = decryption_key -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -4307,7 +5341,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[str] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -4315,7 +5357,7 @@ def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, s self.scale_type = scale_type -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -4332,8 +5374,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2016_03_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2016_03_01.models.Capability] """ @@ -4348,7 +5389,19 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + sku_capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -4360,14 +5413,13 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class SkuInfos(Model): +class SkuInfos(msrest.serialization.Model): """Collection of SKU information. :param resource_type: Resource type that this SKU applies to. :type resource_type: str :param skus: List of SKUs the subscription is able to use. - :type skus: - list[~azure.mgmt.web.v2016_03_01.models.GlobalCsmSkuDescription] + :type skus: list[~azure.mgmt.web.v2016_03_01.models.GlobalCsmSkuDescription] """ _attribute_map = { @@ -4375,24 +5427,28 @@ class SkuInfos(Model): 'skus': {'key': 'skus', 'type': '[GlobalCsmSkuDescription]'}, } - def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + skus: Optional[List["GlobalCsmSkuDescription"]] = None, + **kwargs + ): super(SkuInfos, self).__init__(**kwargs) self.resource_type = resource_type self.skus = skus -class SlotSwapStatus(Model): +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -4408,14 +5464,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -4432,7 +5491,14 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_taken: Optional[str] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = time_taken self.count = count @@ -4442,10 +5508,7 @@ def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str= class SnapshotRecoveryRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4455,21 +5518,19 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app recovery should be attempted, formatted as + a DateTime string. :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. + :param recovery_target: Specifies the web app that snapshot contents will be written to. + :type recovery_target: ~azure.mgmt.web.v2016_03_01.models.SnapshotRecoveryTarget + :param overwrite: If :code:`true` the recovery operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool """ @@ -4478,7 +5539,6 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -4493,7 +5553,17 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, } - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_target=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + snapshot_time: Optional[str] = None, + recovery_target: Optional["SnapshotRecoveryTarget"] = None, + overwrite: Optional[bool] = None, + recover_configuration: Optional[bool] = None, + ignore_conflicting_host_names: Optional[bool] = None, + **kwargs + ): super(SnapshotRecoveryRequest, self).__init__(kind=kind, **kwargs) self.snapshot_time = snapshot_time self.recovery_target = recovery_target @@ -4502,16 +5572,16 @@ def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, self.ignore_conflicting_host_names = ignore_conflicting_host_names -class SnapshotRecoveryTarget(Model): +class SnapshotRecoveryTarget(msrest.serialization.Model): """Specifies the web app that snapshot contents will be written to. - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the target web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -4521,31 +5591,36 @@ class SnapshotRecoveryTarget(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): super(SnapshotRecoveryTarget, self).__init__(**kwargs) self.location = location self.id = id -class Solution(Model): +class Solution(msrest.serialization.Model): """Class Representing Solution for problems detected. :param id: Solution Id. :type id: float - :param display_name: Display Name of the solution + :param display_name: Display Name of the solution. :type display_name: str :param order: Order of the solution. :type order: float - :param description: Description of the solution + :param description: Description of the solution. :type description: str - :param type: Type of Solution. Possible values include: 'QuickSolution', - 'DeepInvestigation', 'BestPractices' + :param type: Type of Solution. Possible values include: "QuickSolution", "DeepInvestigation", + "BestPractices". :type type: str or ~azure.mgmt.web.v2016_03_01.models.SolutionType :param data: Solution Data. :type data: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] :param metadata: Solution Metadata. - :type metadata: - list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] + :type metadata: list[list[~azure.mgmt.web.v2016_03_01.models.NameValuePair]] """ _attribute_map = { @@ -4553,12 +5628,23 @@ class Solution(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'float'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'SolutionType'}, + 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'data', 'type': '[[NameValuePair]]'}, 'metadata': {'key': 'metadata', 'type': '[[NameValuePair]]'}, } - def __init__(self, *, id: float=None, display_name: str=None, order: float=None, description: str=None, type=None, data=None, metadata=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[float] = None, + display_name: Optional[str] = None, + order: Optional[float] = None, + description: Optional[str] = None, + type: Optional[Union[str, "SolutionType"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + metadata: Optional[List[List["NameValuePair"]]] = None, + **kwargs + ): super(Solution, self).__init__(**kwargs) self.id = id self.display_name = display_name @@ -4572,8 +5658,7 @@ def __init__(self, *, id: float=None, display_name: str=None, order: float=None, class SourceControl(ProxyOnlyResource): """The source control OAuth token. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4583,8 +5668,8 @@ class SourceControl(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param source_control_name: Name or source control type. - :type source_control_name: str + :param name_properties_name: Name or source control type. + :type name_properties_name: str :param token: OAuth access token. :type token: str :param token_secret: OAuth access token secret. @@ -4592,7 +5677,7 @@ class SourceControl(ProxyOnlyResource): :param refresh_token: OAuth refresh token. :type refresh_token: str :param expiration_time: OAuth token expiration. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime """ _validation = { @@ -4606,35 +5691,78 @@ class SourceControl(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'source_control_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'token': {'key': 'properties.token', 'type': 'str'}, 'token_secret': {'key': 'properties.tokenSecret', 'type': 'str'}, 'refresh_token': {'key': 'properties.refreshToken', 'type': 'str'}, 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, source_control_name: str=None, token: str=None, token_secret: str=None, refresh_token: str=None, expiration_time=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + token: Optional[str] = None, + token_secret: Optional[str] = None, + refresh_token: Optional[str] = None, + expiration_time: Optional[datetime.datetime] = None, + **kwargs + ): super(SourceControl, self).__init__(kind=kind, **kwargs) - self.source_control_name = source_control_name + self.name_properties_name = name_properties_name self.token = token self.token_secret = token_secret self.refresh_token = refresh_token self.expiration_time = expiration_time -class StackMajorVersion(Model): +class SourceControlCollection(msrest.serialization.Model): + """Collection of source controls. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_03_01.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SourceControl"], + **kwargs + ): + super(SourceControlCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StackMajorVersion(msrest.serialization.Model): """Application stack major version. :param display_version: Application stack major version (display only). :type display_version: str :param runtime_version: Application stack major version (runtime only). :type runtime_version: str - :param is_default: true if this is the default major version; - otherwise, false. + :param is_default: :code:`true` if this is the default major version; otherwise, + :code:`false`. :type is_default: bool :param minor_versions: Minor versions associated with the major version. - :type minor_versions: - list[~azure.mgmt.web.v2016_03_01.models.StackMinorVersion] + :type minor_versions: list[~azure.mgmt.web.v2016_03_01.models.StackMinorVersion] """ _attribute_map = { @@ -4644,7 +5772,15 @@ class StackMajorVersion(Model): 'minor_versions': {'key': 'minorVersions', 'type': '[StackMinorVersion]'}, } - def __init__(self, *, display_version: str=None, runtime_version: str=None, is_default: bool=None, minor_versions=None, **kwargs) -> None: + def __init__( + self, + *, + display_version: Optional[str] = None, + runtime_version: Optional[str] = None, + is_default: Optional[bool] = None, + minor_versions: Optional[List["StackMinorVersion"]] = None, + **kwargs + ): super(StackMajorVersion, self).__init__(**kwargs) self.display_version = display_version self.runtime_version = runtime_version @@ -4652,15 +5788,15 @@ def __init__(self, *, display_version: str=None, runtime_version: str=None, is_d self.minor_versions = minor_versions -class StackMinorVersion(Model): +class StackMinorVersion(msrest.serialization.Model): """Application stack minor version. :param display_version: Application stack minor version (display only). :type display_version: str :param runtime_version: Application stack minor version (runtime only). :type runtime_version: str - :param is_default: true if this is the default minor version; - otherwise, false. + :param is_default: :code:`true` if this is the default minor version; otherwise, + :code:`false`. :type is_default: bool """ @@ -4670,45 +5806,47 @@ class StackMinorVersion(Model): 'is_default': {'key': 'isDefault', 'type': 'bool'}, } - def __init__(self, *, display_version: str=None, runtime_version: str=None, is_default: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_version: Optional[str] = None, + runtime_version: Optional[str] = None, + is_default: Optional[bool] = None, + **kwargs + ): super(StackMinorVersion, self).__init__(**kwargs) self.display_version = display_version self.runtime_version = runtime_version self.is_default = is_default -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Default', 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3' - :type worker_size: str or - ~azure.mgmt.web.v2016_03_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Default", "Small", + "Medium", "Large", "D1", "D2", "D3". + :type worker_size: str or ~azure.mgmt.web.v2016_03_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str @@ -4719,15 +5857,29 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, 'site_mode': {'key': 'siteMode', 'type': 'str'}, } - def __init__(self, *, name: str=None, available_capacity: int=None, total_capacity: int=None, unit: str=None, compute_mode=None, worker_size=None, worker_size_id: int=None, exclude_from_capacity_allocation: bool=None, is_applicable_for_all_compute_modes: bool=None, site_mode: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available_capacity: Optional[int] = None, + total_capacity: Optional[int] = None, + unit: Optional[str] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[Union[str, "WorkerSizeOptions"]] = None, + worker_size_id: Optional[int] = None, + exclude_from_capacity_allocation: Optional[bool] = None, + is_applicable_for_all_compute_modes: Optional[bool] = None, + site_mode: Optional[str] = None, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = name self.available_capacity = available_capacity @@ -4741,7 +5893,7 @@ def __init__(self, *, name: str=None, available_capacity: int=None, total_capaci self.site_mode = site_mode -class StatusCodesBasedTrigger(Model): +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -4764,7 +5916,16 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[int] = None, + sub_status: Optional[int] = None, + win32_status: Optional[int] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = status self.sub_status = sub_status @@ -4776,10 +5937,7 @@ def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int= class User(ProxyOnlyResource): """User credentials used for publishing activity. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4789,16 +5947,15 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param user_name: Username + :param user_name: Username. :type user_name: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str """ @@ -4806,7 +5963,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -4821,7 +5977,17 @@ class User(ProxyOnlyResource): 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, } - def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + user_name: Optional[str] = None, + publishing_user_name: Optional[str] = None, + publishing_password: Optional[str] = None, + publishing_password_hash: Optional[str] = None, + publishing_password_hash_salt: Optional[str] = None, + **kwargs + ): super(User, self).__init__(kind=kind, **kwargs) self.user_name = user_name self.publishing_user_name = publishing_user_name @@ -4830,34 +5996,32 @@ def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str= self.publishing_password_hash_salt = publishing_password_hash_salt -class ValidateRequest(Model): +class ValidateRequest(msrest.serialization.Model): """Resource validation request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'ServerFarm', 'Site' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.ValidateResourceTypes + :param type: Required. Resource type used for verification. Possible values include: + "ServerFarm", "Site". + :type type: str or ~azure.mgmt.web.v2016_03_01.models.ValidateResourceTypes :param location: Required. Expected location of the resource. :type location: str - :param server_farm_id: ARM resource ID of an App Service plan that would - host the app. + :param server_farm_id: ARM resource ID of an App Service plan that would host the app. :type server_farm_id: str :param sku_name: Name of the target SKU for the App Service plan. :type sku_name: str - :param need_linux_workers: true if App Service plan is for - Linux workers; otherwise, false. + :param need_linux_workers: :code:`true` if App Service plan is for Linux workers; + otherwise, :code:`false`. :type need_linux_workers: bool - :param is_spot: true if App Service plan is for Spot - instances; otherwise, false. + :param is_spot: :code:`true` if App Service plan is for Spot instances; otherwise, + :code:`false`. :type is_spot: bool :param capacity: Target capacity of the App Service plan (number of VMs). :type capacity: int - :param hosting_environment: Name of App Service Environment where app or - App Service plan should be created. + :param hosting_environment: Name of App Service Environment where app or App Service plan + should be created. :type hosting_environment: str """ @@ -4880,7 +6044,20 @@ class ValidateRequest(Model): 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, *, name: str, type, location: str, server_farm_id: str=None, sku_name: str=None, need_linux_workers: bool=None, is_spot: bool=None, capacity: int=None, hosting_environment: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + type: Union[str, "ValidateResourceTypes"], + location: str, + server_farm_id: Optional[str] = None, + sku_name: Optional[str] = None, + need_linux_workers: Optional[bool] = None, + is_spot: Optional[bool] = None, + capacity: Optional[int] = None, + hosting_environment: Optional[str] = None, + **kwargs + ): super(ValidateRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -4893,7 +6070,7 @@ def __init__(self, *, name: str, type, location: str, server_farm_id: str=None, self.hosting_environment = hosting_environment -class ValidateResponse(Model): +class ValidateResponse(msrest.serialization.Model): """Describes the result of resource validation. :param status: Result of validation. @@ -4907,13 +6084,19 @@ class ValidateResponse(Model): 'error': {'key': 'error', 'type': 'ValidateResponseError'}, } - def __init__(self, *, status: str=None, error=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ValidateResponseError"] = None, + **kwargs + ): super(ValidateResponse, self).__init__(**kwargs) self.status = status self.error = error -class ValidateResponseError(Model): +class ValidateResponseError(msrest.serialization.Model): """Error details for when validation fails. :param code: Validation error code. @@ -4927,25 +6110,30 @@ class ValidateResponseError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ValidateResponseError, self).__init__(**kwargs) self.code = code self.message = message -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2016_03_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2016_03_01.models.VirtualDirectory] """ _attribute_map = { @@ -4955,7 +6143,15 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + preload_enabled: Optional[bool] = None, + virtual_directories: Optional[List["VirtualDirectory"]] = None, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path @@ -4963,7 +6159,7 @@ def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_e self.virtual_directories = virtual_directories -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -4977,13 +6173,19 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -5003,7 +6205,15 @@ class VirtualIPMapping(Model): 'in_use': {'key': 'inUse', 'type': 'bool'}, } - def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, internal_https_port: int=None, in_use: bool=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_ip: Optional[str] = None, + internal_http_port: Optional[int] = None, + internal_https_port: Optional[int] = None, + in_use: Optional[bool] = None, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = virtual_ip self.internal_http_port = internal_http_port @@ -5011,11 +6221,10 @@ def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, intern self.in_use = in_use -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -5039,7 +6248,13 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + subnet: Optional[str] = None, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = id self.name = None @@ -5048,13 +6263,9 @@ def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5066,8 +6277,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -5075,7 +6285,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -5087,7 +6296,14 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_name: Optional[str] = None, + vpn_package_uri: Optional[str] = None, + **kwargs + ): super(VnetGateway, self).__init__(kind=kind, **kwargs) self.vnet_name = vnet_name self.vpn_package_uri = vpn_package_uri @@ -5096,8 +6312,7 @@ def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5111,17 +6326,17 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: bytearray :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2016_03_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str """ @@ -5147,7 +6362,15 @@ class VnetInfo(ProxyOnlyResource): 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: bytearray=None, dns_servers: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_id: Optional[str] = None, + cert_blob: Optional[bytearray] = None, + dns_servers: Optional[str] = None, + **kwargs + ): super(VnetInfo, self).__init__(kind=kind, **kwargs) self.vnet_resource_id = vnet_resource_id self.cert_thumbprint = None @@ -5160,8 +6383,7 @@ def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: byt class VnetParameters(ProxyOnlyResource): """The required set of inputs to validate a VNET. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5171,11 +6393,11 @@ class VnetParameters(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_resource_group: The Resource Group of the VNET to be validated + :param vnet_resource_group: The Resource Group of the VNET to be validated. :type vnet_resource_group: str - :param vnet_name: The name of the VNET to be validated + :param vnet_name: The name of the VNET to be validated. :type vnet_name: str - :param vnet_subnet_name: The subnet name to be validated + :param vnet_subnet_name: The subnet name to be validated. :type vnet_subnet_name: str """ @@ -5195,7 +6417,15 @@ class VnetParameters(ProxyOnlyResource): 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_resource_group: str=None, vnet_name: str=None, vnet_subnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_group: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + **kwargs + ): super(VnetParameters, self).__init__(kind=kind, **kwargs) self.vnet_resource_group = vnet_resource_group self.vnet_name = vnet_name @@ -5203,11 +6433,9 @@ def __init__(self, *, kind: str=None, vnet_resource_group: str=None, vnet_name: class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5217,23 +6445,22 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. + :param vnet_route_name: The name of this route. This is only returned by the server and does + not need to be set by the client. :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2016_03_01.models.RouteType """ @@ -5254,7 +6481,16 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_route_name: Optional[str] = None, + start_address: Optional[str] = None, + end_address: Optional[str] = None, + route_type: Optional[Union[str, "RouteType"]] = None, + **kwargs + ): super(VnetRoute, self).__init__(kind=kind, **kwargs) self.vnet_route_name = vnet_route_name self.start_address = start_address @@ -5265,8 +6501,7 @@ def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: class VnetValidationFailureDetails(ProxyOnlyResource): """A class that describes the reason for a validation failure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5279,8 +6514,7 @@ class VnetValidationFailureDetails(ProxyOnlyResource): :param failed: A flag describing whether or not validation failed. :type failed: bool :param failed_tests: A list of tests that failed in the validation. - :type failed_tests: - list[~azure.mgmt.web.v2016_03_01.models.VnetValidationTestFailure] + :type failed_tests: list[~azure.mgmt.web.v2016_03_01.models.VnetValidationTestFailure] """ _validation = { @@ -5298,7 +6532,14 @@ class VnetValidationFailureDetails(ProxyOnlyResource): 'failed_tests': {'key': 'properties.failedTests', 'type': '[VnetValidationTestFailure]'}, } - def __init__(self, *, kind: str=None, failed: bool=None, failed_tests=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + failed: Optional[bool] = None, + failed_tests: Optional[List["VnetValidationTestFailure"]] = None, + **kwargs + ): super(VnetValidationFailureDetails, self).__init__(kind=kind, **kwargs) self.failed = failed self.failed_tests = failed_tests @@ -5307,8 +6548,7 @@ def __init__(self, *, kind: str=None, failed: bool=None, failed_tests=None, **kw class VnetValidationTestFailure(ProxyOnlyResource): """A class that describes a test that failed during NSG and UDR validation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5320,8 +6560,7 @@ class VnetValidationTestFailure(ProxyOnlyResource): :vartype type: str :param test_name: The name of the test that failed. :type test_name: str - :param details: The details of what caused the failure, e.g. the blocking - rule name, etc. + :param details: The details of what caused the failure, e.g. the blocking rule name, etc. :type details: str """ @@ -5340,17 +6579,23 @@ class VnetValidationTestFailure(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, *, kind: str=None, test_name: str=None, details: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + test_name: Optional[str] = None, + details: Optional[str] = None, + **kwargs + ): super(VnetValidationTestFailure, self).__init__(kind=kind, **kwargs) self.test_name = test_name self.details = details -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -5370,30 +6615,32 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["Site"], + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) self.value = value self.next_link = None -class WorkerPool(Model): +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_03_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -5403,13 +6650,21 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = worker_size_id self.compute_mode = compute_mode diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_web_site_management_client_enums.py index 598dc7b25863..0ac844b0a6ed 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_web_site_management_client_enums.py @@ -1,287 +1,350 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class KeyVaultSecretStatus(str, Enum): - - initialized = "Initialized" - waiting_on_certificate_order = "WaitingOnCertificateOrder" - succeeded = "Succeeded" - certificate_order_failed = "CertificateOrderFailed" - operation_not_permitted_on_key_vault = "OperationNotPermittedOnKeyVault" - azure_service_unauthorized_to_access_key_vault = "AzureServiceUnauthorizedToAccessKeyVault" - key_vault_does_not_exist = "KeyVaultDoesNotExist" - key_vault_secret_does_not_exist = "KeyVaultSecretDoesNotExist" - unknown_error = "UnknownError" - external_private_key = "ExternalPrivateKey" - unknown = "Unknown" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" - - -class HostingEnvironmentStatus(str, Enum): - - preparing = "Preparing" - ready = "Ready" - scaling = "Scaling" - deleting = "Deleting" - - -class InternalLoadBalancingMode(str, Enum): - - none = "None" - web = "Web" - publishing = "Publishing" - - -class ComputeModeOptions(str, Enum): - - shared = "Shared" - dedicated = "Dedicated" - dynamic = "Dynamic" - - -class WorkerSizeOptions(str, Enum): - - default = "Default" - small = "Small" - medium = "Medium" - large = "Large" - d1 = "D1" - d2 = "D2" - d3 = "D3" - - -class AccessControlEntryAction(str, Enum): - - permit = "Permit" - deny = "Deny" - - -class OperationStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - - -class IssueType(str, Enum): - - service_incident = "ServiceIncident" - app_deployment = "AppDeployment" - app_crash = "AppCrash" - runtime_issue_detected = "RuntimeIssueDetected" - ase_deployment = "AseDeployment" - user_issue = "UserIssue" - platform_issue = "PlatformIssue" - other = "Other" - - -class SolutionType(str, Enum): - - quick_solution = "QuickSolution" - deep_investigation = "DeepInvestigation" - best_practices = "BestPractices" - - -class RenderingType(str, Enum): - - no_graph = "NoGraph" - table = "Table" - time_series = "TimeSeries" - time_series_per_instance = "TimeSeriesPerInstance" - - -class ResourceScopeType(str, Enum): - - server_farm = "ServerFarm" - subscription = "Subscription" - web_site = "WebSite" - - -class NotificationLevel(str, Enum): - - critical = "Critical" - warning = "Warning" - information = "Information" - non_urgent_suggestion = "NonUrgentSuggestion" - - -class Channels(str, Enum): - - notification = "Notification" - api = "Api" - email = "Email" - webhook = "Webhook" - all = "All" - - -class AppServicePlanRestrictions(str, Enum): - - none = "None" - free = "Free" - shared = "Shared" - basic = "Basic" - standard = "Standard" - premium = "Premium" - - -class InAvailabilityReasonType(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" - - -class CheckNameResourceTypes(str, Enum): - - site = "Site" - slot = "Slot" - hosting_environment = "HostingEnvironment" - publishing_user = "PublishingUser" - microsoft_websites = "Microsoft.Web/sites" - microsoft_websitesslots = "Microsoft.Web/sites/slots" - microsoft_webhosting_environments = "Microsoft.Web/hostingEnvironments" - microsoft_webpublishing_users = "Microsoft.Web/publishingUsers" - - -class ValidateResourceTypes(str, Enum): - - server_farm = "ServerFarm" - site = "Site" - - -class SkuName(str, Enum): - - free = "Free" - shared = "Shared" - basic = "Basic" - standard = "Standard" - premium = "Premium" - premium_v2 = "PremiumV2" - dynamic = "Dynamic" - isolated = "Isolated" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AccessControlEntryAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action object. + """ + + PERMIT = "Permit" + DENY = "Deny" + +class AppServicePlanRestrictions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plans this offer is restricted to. + """ + + NONE = "None" + FREE = "Free" + SHARED = "Shared" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class AutoHealActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Predefined action to be taken. + """ + + RECYCLE = "Recycle" + LOG_EVENT = "LogEvent" + CUSTOM_ACTION = "CustomAction" + +class Channels(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """List of channels that this recommendation can apply. + """ + + NOTIFICATION = "Notification" + API = "Api" + EMAIL = "Email" + WEBHOOK = "Webhook" + ALL = "All" + +class CheckNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource type used for verification. + """ + + SITE = "Site" + SLOT = "Slot" + HOSTING_ENVIRONMENT = "HostingEnvironment" + PUBLISHING_USER = "PublishingUser" + MICROSOFT_WEB_SITES = "Microsoft.Web/sites" + MICROSOFT_WEB_SITES_SLOTS = "Microsoft.Web/sites/slots" + MICROSOFT_WEB_HOSTING_ENVIRONMENTS = "Microsoft.Web/hostingEnvironments" + MICROSOFT_WEB_PUBLISHING_USERS = "Microsoft.Web/publishingUsers" + +class ComputeModeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Shared/dedicated workers. + """ + + SHARED = "Shared" + DEDICATED = "Dedicated" + DYNAMIC = "Dynamic" + +class ConnectionStringType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of database. + """ + + MY_SQL = "MySql" + SQL_SERVER = "SQLServer" + SQL_AZURE = "SQLAzure" + CUSTOM = "Custom" + NOTIFICATION_HUB = "NotificationHub" + SERVICE_BUS = "ServiceBus" + EVENT_HUB = "EventHub" + API_HUB = "ApiHub" + DOC_DB = "DocDb" + REDIS_CACHE = "RedisCache" + POSTGRE_SQL = "PostgreSQL" + +class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + +class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + +class HostingEnvironmentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the App Service Environment. + """ + + PREPARING = "Preparing" + READY = "Ready" + SCALING = "Scaling" + DELETING = "Deleting" + +class HostType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether the hostname is a standard or repository hostname. + """ + + STANDARD = "Standard" + REPOSITORY = "Repository" + +class InAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """:code:`Invalid` indicates the name provided does not match Azure App Service + naming requirements. :code:`AlreadyExists` indicates that the name is already in + use and is therefore unavailable. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class InternalLoadBalancingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies which endpoints to serve internally in the Virtual Network for the App Service + Environment. + """ + + NONE = "None" + WEB = "Web" + PUBLISHING = "Publishing" + +class IssueType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Represents the type of the Detector + """ + + SERVICE_INCIDENT = "ServiceIncident" + APP_DEPLOYMENT = "AppDeployment" + APP_CRASH = "AppCrash" + RUNTIME_ISSUE_DETECTED = "RuntimeIssueDetected" + ASE_DEPLOYMENT = "AseDeployment" + USER_ISSUE = "UserIssue" + PLATFORM_ISSUE = "PlatformIssue" + OTHER = "Other" + +class KeyVaultSecretStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Key Vault secret. + """ + + INITIALIZED = "Initialized" + WAITING_ON_CERTIFICATE_ORDER = "WaitingOnCertificateOrder" + SUCCEEDED = "Succeeded" + CERTIFICATE_ORDER_FAILED = "CertificateOrderFailed" + OPERATION_NOT_PERMITTED_ON_KEY_VAULT = "OperationNotPermittedOnKeyVault" + AZURE_SERVICE_UNAUTHORIZED_TO_ACCESS_KEY_VAULT = "AzureServiceUnauthorizedToAccessKeyVault" + KEY_VAULT_DOES_NOT_EXIST = "KeyVaultDoesNotExist" + KEY_VAULT_SECRET_DOES_NOT_EXIST = "KeyVaultSecretDoesNotExist" + UNKNOWN_ERROR = "UnknownError" + EXTERNAL_PRIVATE_KEY = "ExternalPrivateKey" + UNKNOWN = "Unknown" + +class ManagedPipelineMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Managed pipeline mode. + """ + + INTEGRATED = "Integrated" + CLASSIC = "Classic" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + +class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Level indicating how critical this recommendation can impact. + """ + + CRITICAL = "Critical" + WARNING = "Warning" + INFORMATION = "Information" + NON_URGENT_SUGGESTION = "NonUrgentSuggestion" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the operation. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App Service Environment. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" + +class RenderingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rendering Type + """ + + NO_GRAPH = "NoGraph" + TABLE = "Table" + TIME_SERIES = "TimeSeries" + TIME_SERIES_PER_INSTANCE = "TimeSeriesPerInstance" + +class ResourceScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of a resource type this recommendation applies, e.g. Subscription, ServerFarm, Site. + """ + + SERVER_FARM = "ServerFarm" + SUBSCRIPTION = "Subscription" + WEB_SITE = "WebSite" + +class RouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of route this is: + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 + INHERITED - Routes inherited from the real Virtual Network routes + STATIC - Static route set on the app only + + These values will be used for syncing an app's routes with those from a Virtual Network. + """ + + DEFAULT = "DEFAULT" + INHERITED = "INHERITED" + STATIC = "STATIC" + +class ScmType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SCM type. + """ + + NONE = "None" + DROPBOX = "Dropbox" + TFS = "Tfs" + LOCAL_GIT = "LocalGit" + GIT_HUB = "GitHub" + CODE_PLEX_GIT = "CodePlexGit" + CODE_PLEX_HG = "CodePlexHg" + BITBUCKET_GIT = "BitbucketGit" + BITBUCKET_HG = "BitbucketHg" + EXTERNAL_GIT = "ExternalGit" + EXTERNAL_HG = "ExternalHg" + ONE_DRIVE = "OneDrive" + VSO = "VSO" + +class SiteAvailabilityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Management information availability state for the app. + """ + + NORMAL = "Normal" + LIMITED = "Limited" + DISASTER_RECOVERY_MODE = "DisasterRecoveryMode" + +class SiteLoadBalancing(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site load balancing. + """ + + WEIGHTED_ROUND_ROBIN = "WeightedRoundRobin" + LEAST_REQUESTS = "LeastRequests" + LEAST_RESPONSE_TIME = "LeastResponseTime" + WEIGHTED_TOTAL_TRAFFIC = "WeightedTotalTraffic" + REQUEST_HASH = "RequestHash" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + FREE = "Free" + SHARED = "Shared" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + PREMIUM_V2 = "PremiumV2" + DYNAMIC = "Dynamic" + ISOLATED = "Isolated" + +class SolutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of Solution + """ + + QUICK_SOLUTION = "QuickSolution" + DEEP_INVESTIGATION = "DeepInvestigation" + BEST_PRACTICES = "BestPractices" + +class SslState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SSL type. + """ + + DISABLED = "Disabled" + SNI_ENABLED = "SniEnabled" + IP_BASED_ENABLED = "IpBasedEnabled" + +class StatusOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plan status. + """ + + READY = "Ready" + PENDING = "Pending" + CREATING = "Creating" + +class SupportedTlsVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """MinTlsVersion: configures the minimum version of TLS required for SSL requests + """ + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" + +class UsageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State indicating whether the app has exceeded its quota usage. Read-only. + """ + + NORMAL = "Normal" + EXCEEDED = "Exceeded" + +class ValidateResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource type used for verification. + """ + + SERVER_FARM = "ServerFarm" + SITE = "Site" + +class WorkerSizeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Size of the machines. + """ + + DEFAULT = "Default" + SMALL = "Small" + MEDIUM = "Medium" + LARGE = "Large" + D1 = "D1" + D2 = "D2" + D3 = "D3" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/__init__.py index 00a18715fd99..48bbadb98d0b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._certificates_operations import CertificatesOperations @@ -15,8 +12,8 @@ from ._provider_operations import ProviderOperations from ._recommendations_operations import RecommendationsOperations from ._resource_health_metadata_operations import ResourceHealthMetadataOperations -from ._billing_meters_operations import BillingMetersOperations from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin +from ._billing_meters_operations import BillingMetersOperations __all__ = [ 'CertificatesOperations', @@ -25,6 +22,6 @@ 'ProviderOperations', 'RecommendationsOperations', 'ResourceHealthMetadataOperations', - 'BillingMetersOperations', 'WebSiteManagementClientOperationsMixin', + 'BillingMetersOperations', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py index 292ab542cc46..61bef816adf8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py @@ -1,112 +1,117 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class BillingMetersOperations(object): """BillingMetersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def list( - self, billing_location=None, custom_headers=None, raw=False, **operation_config): + self, + billing_location=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BillingMeterCollection"] """Gets a list of meters for a given location. Gets a list of meters for a given location. - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BillingMeter - :rtype: - ~azure.mgmt.web.v2016_03_01.models.BillingMeterPaged[~azure.mgmt.web.v2016_03_01.models.BillingMeter] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if billing_location is not None: query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BillingMeterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BillingMeterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py index 057be75f276e..c7224a89d592 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py @@ -1,444 +1,428 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates for a subscription. Get all certificates for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2016_03_01.models.CertificatePaged[~azure.mgmt.web.v2016_03_01.models.Certificate] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates in a resource group. Get all certificates in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2016_03_01.models.CertificatePaged[~azure.mgmt.web.v2016_03_01.models.Certificate] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Get a certificate. Get a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def create_or_update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.Certificate" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2016_03_01.models.Certificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2016_03_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a certificate. Delete a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.CertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2016_03_01.models.CertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2016_03_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py index ff1dd6a6530e..aaf573be8c25 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py @@ -1,108 +1,112 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DeletedWebAppsOperations(object): """DeletedWebAppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedWebAppCollection"] """Get all deleted apps for a subscription. Get all deleted apps for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedSite - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DeletedSitePaged[~azure.mgmt.web.v2016_03_01.models.DeletedSite] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedWebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedSitePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py index 23da7c5a1f8b..df093fb21397 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py @@ -1,1758 +1,1744 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DiagnosticsOperations(object): """DiagnosticsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def list_hosting_environment_detector_responses( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Hosting Environment Detector Responses. List Hosting Environment Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Site Name + :param name: Site Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorResponsePaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponse] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_hosting_environment_detector_responses.metadata['url'] + url = self.list_hosting_environment_detector_responses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} # type: ignore def get_hosting_environment_detector_response( - self, resource_group_name, name, detector_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + detector_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get Hosting Environment Detector Response. Get Hosting Environment Detector Response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: App Service Environment Name + :param name: App Service Environment Name. :type name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_hosting_environment_detector_response.metadata['url'] + url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} + get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} # type: ignore def list_site_detector_responses( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Site Detector Responses. List Site Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorResponsePaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponse] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detector_responses.metadata['url'] + url = self.list_site_detector_responses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} # type: ignore def get_site_detector_response( - self, resource_group_name, site_name, detector_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get site detector response. Get site detector response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_site_detector_response.metadata['url'] + url = self.get_site_detector_response.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} + get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} # type: ignore def list_site_diagnostic_categories( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticCategoryCollection"] """Get Diagnostics Categories. Get Diagnostics Categories. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DiagnosticCategory - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategoryPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_diagnostic_categories.metadata['url'] + url = self.list_site_diagnostic_categories.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticCategoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiagnosticCategoryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} + return ItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} # type: ignore def get_site_diagnostic_category( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticCategory" """Get Diagnostics Category. Get Diagnostics Category. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticCategory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_site_diagnostic_category.metadata['url'] + url = self.get_site_diagnostic_category.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticCategory', response) + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} + get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} # type: ignore def list_site_analyses( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticAnalysisCollection"] """Get Site Analyses. Get Site Analyses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AnalysisDefinition - :rtype: - ~azure.mgmt.web.v2016_03_01.models.AnalysisDefinitionPaged[~azure.mgmt.web.v2016_03_01.models.AnalysisDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_analyses.metadata['url'] + url = self.list_site_analyses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticAnalysisCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AnalysisDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} + return ItemPaged( + get_next, extract_data + ) + list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore def get_site_analysis( - self, resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Get Site Analysis. Get Site Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param analysis_name: Analysis Name + :param analysis_name: Analysis Name. :type analysis_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_site_analysis.metadata['url'] + url = self.get_site_analysis.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} + get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore def execute_site_analysis( - self, resource_group_name, site_name, diagnostic_category, analysis_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Execute Analysis. Execute Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param analysis_name: Analysis Resource Name + :param analysis_name: Analysis Resource Name. :type analysis_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.execute_site_analysis.metadata['url'] + url = self.execute_site_analysis.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} + execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore def list_site_detectors( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detectors. Get Detectors. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detectors.metadata['url'] + url = self.list_site_detectors.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore def get_site_detector( - self, resource_group_name, site_name, diagnostic_category, detector_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + detector_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detector. Get Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param detector_name: Detector Name + :param detector_name: Detector Name. :type detector_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_site_detector.metadata['url'] + url = self.get_site_detector.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} + return ItemPaged( + get_next, extract_data + ) + get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore def execute_site_detector( - self, resource_group_name, site_name, detector_name, diagnostic_category, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + diagnostic_category, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticDetectorResponse" """Execute Detector. Execute Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticDetectorResponse or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorResponse - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.execute_site_detector.metadata['url'] + url = self.execute_site_detector.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticDetectorResponse', response) + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} + execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore def list_site_detector_responses_slot( - self, resource_group_name, site_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Site Detector Responses. List Site Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorResponsePaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponse] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detector_responses_slot.metadata['url'] + url = self.list_site_detector_responses_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} # type: ignore def get_site_detector_response_slot( - self, resource_group_name, site_name, detector_name, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get site detector response. Get site detector response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_site_detector_response_slot.metadata['url'] + url = self.get_site_detector_response_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} + get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} # type: ignore def list_site_diagnostic_categories_slot( - self, resource_group_name, site_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticCategoryCollection"] """Get Diagnostics Categories. Get Diagnostics Categories. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DiagnosticCategory - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategoryPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_diagnostic_categories_slot.metadata['url'] + url = self.list_site_diagnostic_categories_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticCategoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiagnosticCategoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} + return ItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} # type: ignore def get_site_diagnostic_category_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticCategory" """Get Diagnostics Category. Get Diagnostics Category. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticCategory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_site_diagnostic_category_slot.metadata['url'] + url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticCategory', response) + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} + get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} # type: ignore def list_site_analyses_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticAnalysisCollection"] """Get Site Analyses. Get Site Analyses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AnalysisDefinition - :rtype: - ~azure.mgmt.web.v2016_03_01.models.AnalysisDefinitionPaged[~azure.mgmt.web.v2016_03_01.models.AnalysisDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_analyses_slot.metadata['url'] + url = self.list_site_analyses_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticAnalysisCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AnalysisDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} + return ItemPaged( + get_next, extract_data + ) + list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore def get_site_analysis_slot( - self, resource_group_name, site_name, diagnostic_category, analysis_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Get Site Analysis. Get Site Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param analysis_name: Analysis Name + :param analysis_name: Analysis Name. :type analysis_name: str - :param slot: Slot - optional + :param slot: Slot - optional. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_site_analysis_slot.metadata['url'] + url = self.get_site_analysis_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} + get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore def execute_site_analysis_slot( - self, resource_group_name, site_name, diagnostic_category, analysis_name, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Execute Analysis. Execute Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param analysis_name: Analysis Resource Name + :param analysis_name: Analysis Resource Name. :type analysis_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.execute_site_analysis_slot.metadata['url'] + url = self.execute_site_analysis_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} + execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore def list_site_detectors_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detectors. Get Detectors. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detectors_slot.metadata['url'] + url = self.list_site_detectors_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore def get_site_detector_slot( - self, resource_group_name, site_name, diagnostic_category, detector_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + detector_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detector. Get Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param detector_name: Detector Name + :param detector_name: Detector Name. :type detector_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2016_03_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2016_03_01.models.DetectorDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_site_detector_slot.metadata['url'] + url = self.get_site_detector_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} + return ItemPaged( + get_next, extract_data + ) + get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore def execute_site_detector_slot( - self, resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + diagnostic_category, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticDetectorResponse" """Execute Detector. Execute Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticDetectorResponse or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) :rtype: ~azure.mgmt.web.v2016_03_01.models.DiagnosticDetectorResponse - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.execute_site_detector_slot.metadata['url'] + url = self.execute_site_detector_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DiagnosticDetectorResponse', response) + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} + execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py index 0081f39d0f9d..94e82f0c364f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py @@ -1,246 +1,247 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class ProviderOperations(object): """ProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def get_available_stacks( - self, os_type_selected=None, custom_headers=None, raw=False, **operation_config): + self, + os_type_selected=None, # type: Optional[Union[str, "models.Enum0"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ApplicationStackCollection"] """Get available application frameworks and their versions. Get available application frameworks and their versions. - :param os_type_selected: Possible values include: 'Windows', 'Linux' - :type os_type_selected: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ApplicationStack - :rtype: - ~azure.mgmt.web.v2016_03_01.models.ApplicationStackPaged[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] - :raises: :class:`CloudError` + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2016_03_01.models.Enum0 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_available_stacks.metadata['url'] - + url = self.get_available_stacks.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] if os_type_selected is not None: query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ApplicationStackPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} + return ItemPaged( + get_next, extract_data + ) + get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} # type: ignore def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Gets all available operations for the Microsoft.Web resource provider. - Also exposes resource metric definitions. - - Gets all available operations for the Microsoft.Web resource provider. - Also exposes resource metric definitions. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2016_03_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2016_03_01.models.CsmOperationDescription] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions. + + Gets all available operations for the Microsoft.Web resource provider. Also exposes resource + metric definitions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} # type: ignore def get_available_stacks_on_prem( - self, os_type_selected=None, custom_headers=None, raw=False, **operation_config): + self, + os_type_selected=None, # type: Optional[Union[str, "models.Enum1"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ApplicationStackCollection"] """Get available application frameworks and their versions. Get available application frameworks and their versions. - :param os_type_selected: Possible values include: 'Windows', 'Linux' - :type os_type_selected: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ApplicationStack - :rtype: - ~azure.mgmt.web.v2016_03_01.models.ApplicationStackPaged[~azure.mgmt.web.v2016_03_01.models.ApplicationStack] - :raises: :class:`CloudError` + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2016_03_01.models.Enum1 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_available_stacks_on_prem.metadata['url'] + url = self.get_available_stacks_on_prem.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if os_type_selected is not None: query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ApplicationStackPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} + return ItemPaged( + get_next, extract_data + ) + get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py index e849b31b882a..c483e0c56473 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py @@ -1,644 +1,628 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class RecommendationsOperations(object): """RecommendationsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def list( - self, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """List all recommendations for a subscription. List all recommendations for a subscription. - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channels eq 'Api' or channel eq 'Notification' and startTime - eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or + channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2016_03_01.models.RecommendationPaged[~azure.mgmt.web.v2016_03_01.models.Recommendation] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} # type: ignore def reset_all_filters( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for a subscription. Reset all recommendation opt-out settings for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.reset_all_filters.metadata['url'] + url = self.reset_all_filters.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} + if cls: + return cls(pipeline_response, None, {}) + + reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} # type: ignore def disable_recommendation_for_subscription( - self, name, custom_headers=None, raw=False, **operation_config): - """Disables the specified rule so it will not apply to a subscription in - the future. + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Disables the specified rule so it will not apply to a subscription in the future. - Disables the specified rule so it will not apply to a subscription in - the future. + Disables the specified rule so it will not apply to a subscription in the future. - :param name: Rule name + :param name: Rule name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.disable_recommendation_for_subscription.metadata['url'] + url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def list_history_for_web_app( - self, resource_group_name, site_name, filter=None, custom_headers=None, raw=False, **operation_config): - """Get past recommendations for an app, optionally specified by the time - range. + if cls: + return cls(pipeline_response, None, {}) - Get past recommendations for an app, optionally specified by the time - range. + disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_history_for_web_app( + self, + resource_group_name, # type: str + site_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] + """Get past recommendations for an app, optionally specified by the time range. + + Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param filter: Filter is specified by using OData syntax. Example: - $filter=channels eq 'Api' or channel eq 'Notification' and startTime - eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or + channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2016_03_01.models.RecommendationPaged[~azure.mgmt.web.v2016_03_01.models.Recommendation] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_history_for_web_app.metadata['url'] + url = self.list_history_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} + return ItemPaged( + get_next, extract_data + ) + list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} # type: ignore def list_recommended_rules_for_web_app( - self, resource_group_name, site_name, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """Get all recommendations for an app. Get all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Return only channels specified in the filter. Filter is - specified by using OData syntax. Example: $filter=channels eq 'Api' or - channel eq 'Notification' + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2016_03_01.models.RecommendationPaged[~azure.mgmt.web.v2016_03_01.models.Recommendation] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommended_rules_for_web_app.metadata['url'] + url = self.list_recommended_rules_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} # type: ignore def disable_all_for_web_app( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable all recommendations for an app. Disable all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.disable_all_for_web_app.metadata['url'] + url = self.disable_all_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} + if cls: + return cls(pipeline_response, None, {}) + + disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} # type: ignore def reset_all_filters_for_web_app( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.reset_all_filters_for_web_app.metadata['url'] + url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} + if cls: + return cls(pipeline_response, None, {}) + + reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} # type: ignore def get_rule_details_by_web_app( - self, resource_group_name, site_name, name, update_seen=None, recommendation_id=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + name, # type: str + update_seen=None, # type: Optional[bool] + recommendation_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RecommendationRule" """Get a recommendation rule for an app. Get a recommendation rule for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str :param name: Name of the recommendation. :type name: str - :param update_seen: Specify true to update the last-seen - timestamp of the recommendation object. + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. :type update_seen: bool - :param recommendation_id: The GUID of the recommendation object if you - query an expired one. You don't need to specify it to query an active - entry. + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. :type recommendation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecommendationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.RecommendationRule or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_rule_details_by_web_app.metadata['url'] + url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if update_seen is not None: query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') if recommendation_id is not None: query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RecommendationRule', response) + deserialized = self._deserialize('RecommendationRule', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} + get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} # type: ignore def disable_recommendation_for_site( - self, resource_group_name, site_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disables the specific rule for a web site permanently. Disables the specific rule for a web site permanently. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site name + :param site_name: Site name. :type site_name: str - :param name: Rule name + :param name: Rule name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.disable_recommendation_for_site.metadata['url'] + url = self.disable_recommendation_for_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} + 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_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py index 876c8fa050a2..3043c773cb37 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py @@ -1,465 +1,460 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class ResourceHealthMetadataOperations(object): """ResourceHealthMetadataOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_03_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. - :ivar api_version: API Version. Constant value: "2016-03-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] """List all ResourceHealthMetadata for all sites in the subscription. List all ResourceHealthMetadata for all sites in the subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """List all ResourceHealthMetadata for all sites in the resource group in - the subscription. + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """List all ResourceHealthMetadata for all sites in the resource group in the subscription. - List all ResourceHealthMetadata for all sites in the resource group in - the subscription. + List all ResourceHealthMetadata for all sites in the resource group in the subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore def list_by_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the category of ResourceHealthMetadata to use for the given site - as a collection. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. - Gets the category of ResourceHealthMetadata to use for the given site - as a collection. + Gets the category of ResourceHealthMetadata to use for the given site as a collection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_site.metadata['url'] + url = self.list_by_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} # type: ignore def get_by_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceHealthMetadata" """Gets the category of ResourceHealthMetadata to use for the given site. Gets the category of ResourceHealthMetadata to use for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of web app + :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceHealthMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_by_site.metadata['url'] + url = self.get_by_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceHealthMetadata', response) + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} + get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} # type: ignore def list_by_site_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets the category of ResourceHealthMetadata to use for the given site - as a collection. - - Gets the category of ResourceHealthMetadata to use for the given site - as a collection. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_site_slot.metadata['url'] + url = self.list_by_site_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} # type: ignore def get_by_site_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceHealthMetadata" """Gets the category of ResourceHealthMetadata to use for the given site. Gets the category of ResourceHealthMetadata to use for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of web app + :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceHealthMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_by_site_slot.metadata['url'] + url = self.get_by_site_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceHealthMetadata', response) + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} + get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py index f1def3b3f169..3986fd0ed3ad 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py @@ -1,989 +1,934 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models -import uuid +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 WebSiteManagementClientOperationsMixin(object): def get_publishing_user( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.User" """Gets publishing user. Gets publishing user. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_publishing_user.metadata['url'] + url = self.get_publishing_user.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} + get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore def update_publishing_user( - self, user_details, custom_headers=None, raw=False, **operation_config): + self, + user_details, # type: "models.User" + **kwargs # type: Any + ): + # type: (...) -> "models.User" """Updates publishing user. Updates publishing user. - :param user_details: Details of publishing user + :param user_details: Details of publishing user. :type user_details: ~azure.mgmt.web.v2016_03_01.models.User - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_publishing_user.metadata['url'] + url = self.update_publishing_user.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} + update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore def list_source_controls( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SourceControlCollection"] """Gets the source controls available for Azure websites. Gets the source controls available for Azure websites. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SourceControl - :rtype: - ~azure.mgmt.web.v2016_03_01.models.SourceControlPaged[~azure.mgmt.web.v2016_03_01.models.SourceControl] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_source_controls.metadata['url'] - + url = self.list_source_controls.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SourceControlCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SourceControlPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} + return ItemPaged( + get_next, extract_data + ) + list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} # type: ignore def get_source_control( - self, source_control_type, custom_headers=None, raw=False, **operation_config): + self, + source_control_type, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SourceControl" """Gets source control token. Gets source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_source_control.metadata['url'] + url = self.get_source_control.metadata['url'] # type: ignore path_format_arguments = { - 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str') + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SourceControl', response) + deserialized = self._deserialize('SourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} + get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore def update_source_control( - self, source_control_type, request_message, custom_headers=None, raw=False, **operation_config): + self, + source_control_type, # type: str + request_message, # type: "models.SourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SourceControl" """Updates source control token. Updates source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param request_message: Source control token information - :type request_message: - ~azure.mgmt.web.v2016_03_01.models.SourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2016_03_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control.metadata['url'] + url = self.update_source_control.metadata['url'] # type: ignore path_format_arguments = { - 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str') + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SourceControl', response) + deserialized = self._deserialize('SourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} + update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore def check_name_availability( - self, name, type, is_fqdn=None, custom_headers=None, raw=False, **operation_config): + self, + name, # type: str + type, # type: Union[str, "models.CheckNameResourceTypes"] + is_fqdn=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceNameAvailability" """Check if a resource name is available. Check if a resource name is available. :param name: Resource name to verify. :type name: str - :param type: Resource type used for verification. Possible values - include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2016_03_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceNameAvailability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceNameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(request, 'ResourceNameAvailabilityRequest') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ResourceNameAvailability', response) + deserialized = self._deserialize('ResourceNameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} # type: ignore def get_subscription_deployment_locations( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentLocations" """Gets list of available geo regions plus ministamps. Gets list of available geo regions plus ministamps. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentLocations or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.DeploymentLocations or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.get_subscription_deployment_locations.metadata['url'] + url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('DeploymentLocations', response) + deserialized = self._deserialize('DeploymentLocations', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} + get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} # type: ignore def list_geo_regions( - self, sku=None, linux_workers_enabled=None, custom_headers=None, raw=False, **operation_config): + self, + sku=None, # type: Optional[Union[str, "models.SkuName"]] + linux_workers_enabled=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.GeoRegionCollection"] """Get a list of available geographical regions. Get a list of available geographical regions. - :param sku: Name of SKU used to filter the regions. Possible values - include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', - 'PremiumV2', 'Dynamic', 'Isolated' + :param sku: Name of SKU used to filter the regions. :type sku: str or ~azure.mgmt.web.v2016_03_01.models.SkuName - :param linux_workers_enabled: Specify true if you want to - filter to only regions that support Linux workers. + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. :type linux_workers_enabled: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of GeoRegion - :rtype: - ~azure.mgmt.web.v2016_03_01.models.GeoRegionPaged[~azure.mgmt.web.v2016_03_01.models.GeoRegion] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_geo_regions.metadata['url'] + url = self.list_geo_regions.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if sku is not None: query_parameters['sku'] = self._serialize.query("sku", sku, 'str') if linux_workers_enabled is not None: query_parameters['linuxWorkersEnabled'] = self._serialize.query("linux_workers_enabled", linux_workers_enabled, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('GeoRegionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.GeoRegionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} + return ItemPaged( + get_next, extract_data + ) + list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} # type: ignore def list_site_identifiers_assigned_to_host_name( - self, name=None, custom_headers=None, raw=False, **operation_config): + self, + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """List all apps that are assigned to a hostname. List all apps that are assigned to a hostname. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2016_03_01.models.IdentifierPaged[~azure.mgmt.web.v2016_03_01.models.Identifier] - :raises: :class:`CloudError` + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2016_03_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - name_identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_identifiers_assigned_to_host_name.metadata['url'] + url = self.list_site_identifiers_assigned_to_host_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(name_identifier, 'NameIdentifier') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} + return ItemPaged( + get_next, extract_data + ) + list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} # type: ignore def list_premier_add_on_offers( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PremierAddOnOfferCollection"] """List all premier add-on offers. List all premier add-on offers. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PremierAddOnOffer - :rtype: - ~azure.mgmt.web.v2016_03_01.models.PremierAddOnOfferPaged[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOffer] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_03_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_premier_add_on_offers.metadata['url'] + url = self.list_premier_add_on_offers.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PremierAddOnOfferCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PremierAddOnOfferPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} + return ItemPaged( + get_next, extract_data + ) + list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} # type: ignore def list_skus( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.SkuInfos" """List all SKUs. List all SKUs. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SkuInfos or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.SkuInfos or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + # Construct URL - url = self.list_skus.metadata['url'] + url = self.list_skus.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SkuInfos', response) + deserialized = self._deserialize('SkuInfos', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} # type: ignore def verify_hosting_environment_vnet( - self, parameters, custom_headers=None, raw=False, **operation_config): - """Verifies if this VNET is compatible with an App Service Environment by - analyzing the Network Security Group rules. + self, + parameters, # type: "models.VnetParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetValidationFailureDetails" + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. - Verifies if this VNET is compatible with an App Service Environment by - analyzing the Network Security Group rules. + Verifies if this VNET is compatible with an App Service Environment by analyzing the Network + Security Group rules. - :param parameters: VNET information + :param parameters: VNET information. :type parameters: ~azure.mgmt.web.v2016_03_01.models.VnetParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetValidationFailureDetails or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_03_01.models.VnetValidationFailureDetails or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.verify_hosting_environment_vnet.metadata['url'] + url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetValidationFailureDetails', response) + deserialized = self._deserialize('VnetValidationFailureDetails', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} + verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} # type: ignore def move( - self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): + # type: (...) -> None """Move resources between resource groups. Move resources between resource groups. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope + :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 """ - move_resource_envelope = models.CsmMoveResourceEnvelope(target_resource_group=target_resource_group, resources=resources) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.move.metadata['url'] + url = self.move.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} + if cls: + return cls(pipeline_response, None, {}) + + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} # type: ignore def validate( - self, resource_group_name, validate_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + validate_request, # type: "models.ValidateRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.ValidateResponse" """Validate if a resource can be created. Validate if a resource can be created. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param validate_request: Request with the resources to validate. - :type validate_request: - ~azure.mgmt.web.v2016_03_01.models.ValidateRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ValidateResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_03_01.models.ValidateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type validate_request: ~azure.mgmt.web.v2016_03_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_03_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate.metadata['url'] + url = self.validate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ValidateResponse', response) + deserialized = self._deserialize('ValidateResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} # type: ignore def validate_move( - self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): + # type: (...) -> None """Validate whether a resource can be moved. Validate whether a resource can be moved. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2016_03_01.models.CsmMoveResourceEnvelope + :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 """ - move_resource_envelope = models.CsmMoveResourceEnvelope(target_resource_group=target_resource_group, resources=resources) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-03-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.validate_move.metadata['url'] + url = self.validate_move.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} + 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, {}) + + validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py index b96e0933169e..6bb47e26649f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2016-08-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json new file mode 100644 index 000000000000..e6da136924e2 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json @@ -0,0 +1,58 @@ +{ + "chosen_version": "2016-08-01", + "total_api_version_list": ["2016-08-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "web_apps": "WebAppsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py index 50a0633dd1db..ac0df08e7cb7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py @@ -1,50 +1,69 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration from .operations import WebAppsOperations from . import models -class WebSiteManagementClient(SDKClient): - """WebSite Management Client +class WebSiteManagementClient(object): + """WebSite Management Client. - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration - - :ivar web_apps: WebApps operations + :ivar web_apps: WebAppsOperations operations :vartype web_apps: azure.mgmt.web.v2016_08_01.operations.WebAppsOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2016-08-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.web_apps = WebAppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py new file mode 100644 index 000000000000..a268aa73d52f --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2016-08-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..e4a4f3702f85 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import WebAppsOperations +from .. import models + + +class WebSiteManagementClient(object): + """WebSite Management Client. + + :ivar web_apps: WebAppsOperations operations + :vartype web_apps: azure.mgmt.web.v2016_08_01.aio.operations_async.WebAppsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.web_apps = WebAppsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..cd4c84b8c270 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_apps_operations_async import WebAppsOperations + +__all__ = [ + 'WebAppsOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py new file mode 100644 index 000000000000..e8c462f9816b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py @@ -0,0 +1,22210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, IO, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebAppsOperations: + """WebAppsOperations 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.web.v2016_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps for a subscription. + + Get all apps for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/sites'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + include_slots: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Gets all web, mobile, and API apps in the specified resource group. + + Gets all web, mobile, and API apps in the specified resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param include_slots: Specify :code:`true` to include deployment slots in + results. The default is false, which only gives you the production slot of all apps. + :type include_slots: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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] + if include_slots is not None: + query_parameters['includeSlots'] = self._serialize.query("include_slots", include_slots, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.Site"]: + """Gets the details of a web, mobile, or API app. + + Gets the details of a web, mobile, or API app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + site_envelope: "models.Site", + **kwargs + ) -> "models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'Site') + 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]: + 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('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + site_envelope: "models.Site", + **kwargs + ) -> AsyncLROPoller["models.Site"]: + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.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, + name=name, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/sites/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + delete_metrics: Optional[bool] = None, + delete_empty_server_farm: Optional[bool] = None, + **kwargs + ) -> None: + """Deletes a web, mobile, or API app, or one of the deployment slots. + + Deletes a web, mobile, or API app, or one of the deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app to delete. + :type name: str + :param delete_metrics: If true, web app metrics are also deleted. + :type delete_metrics: bool + :param delete_empty_server_farm: Specify false if you want to keep empty App Service plan. By + default, empty App Service plan is deleted. + :type delete_empty_server_farm: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if delete_metrics is not None: + query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') + if delete_empty_server_farm is not None: + query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 404]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + site_envelope: "models.SitePatchResource", + **kwargs + ) -> "models.Site": + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'SitePatchResource') + 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]: + 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('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def analyze_custom_hostname( + self, + resource_group_name: str, + name: str, + host_name: Optional[str] = None, + **kwargs + ) -> "models.CustomHostnameAnalysisResult": + """Analyze a custom hostname. + + Analyze a custom hostname. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param host_name: Custom hostname. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.analyze_custom_hostname.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if host_name is not None: + query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} # type: ignore + + async def apply_slot_config_to_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + """Applies the configuration settings from the target slot onto the current slot. + + Applies the configuration settings from the target slot onto the current slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.apply_slot_config_to_production.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} # type: ignore + + async def backup( + self, + resource_group_name: str, + name: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Creates a backup of an app. + + Creates a backup of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} # type: ignore + + def list_backups( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_backups.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} # type: ignore + + async def discover_restore( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreRequest": + """Discovers an existing app backup that can be restored from a blob in Azure storage. + + Discovers an existing app backup that can be restored from a blob in Azure storage. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.discover_restore.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + discover_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover'} # type: ignore + + async def get_backup_status( + self, + resource_group_name: str, + name: str, + backup_id: str, + **kwargs + ) -> "models.BackupItem": + """Gets a backup of an app by its ID. + + Gets a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_backup_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore + + async def delete_backup( + self, + resource_group_name: str, + name: str, + backup_id: str, + **kwargs + ) -> None: + """Deletes a backup of an app by its ID. + + Deletes a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore + + async def list_backup_status_secrets( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param backup_id: ID of backup. + :type backup_id: str + :param request: Information on backup request. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_backup_status_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} # type: ignore + + async def _restore_initial( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + async def begin_restore( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller["models.RestoreResponse"]: + """Restores a specific backup to another app (or deployment slot, if specified). + + Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestoreResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.RestoreResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + lro_delay = kwargs.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._restore_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RestoreResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + def list_configurations( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigResourceCollection"]: + """List the configurations of an app. + + List the configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configurations.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteConfigResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} # type: ignore + + async def update_application_settings( + self, + resource_group_name: str, + name: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the application settings of an app. + + Replaces the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_application_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} # type: ignore + + async def list_application_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of an app. + + Gets the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_application_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} # type: ignore + + async def update_auth_settings( + self, + resource_group_name: str, + name: str, + site_auth_settings: "models.SiteAuthSettings", + **kwargs + ) -> "models.SiteAuthSettings": + """Updates the Authentication / Authorization settings associated with web app. + + Updates the Authentication / Authorization settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_auth_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} # type: ignore + + async def get_auth_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteAuthSettings": + """Gets the Authentication/Authorization settings of an app. + + Gets the Authentication/Authorization settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_auth_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} # type: ignore + + async def update_backup_configuration( + self, + resource_group_name: str, + name: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupRequest": + """Updates the backup configuration of an app. + + Updates the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Edited backup configuration. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore + + async def delete_backup_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes the backup configuration of an app. + + Deletes the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore + + async def get_backup_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.BackupRequest": + """Gets the backup configuration of an app. + + Gets the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} # type: ignore + + async def update_connection_strings( + self, + resource_group_name: str, + name: str, + connection_strings: "models.ConnectionStringDictionary", + **kwargs + ) -> "models.ConnectionStringDictionary": + """Replaces the connection strings of an app. + + Replaces the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_connection_strings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} # type: ignore + + async def list_connection_strings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.ConnectionStringDictionary": + """Gets the connection strings of an app. + + Gets the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_connection_strings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} # type: ignore + + async def get_diagnostic_logs_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteLogsConfig": + """Gets the logging configuration of an app. + + Gets the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore + + async def update_diagnostic_logs_config( + self, + resource_group_name: str, + name: str, + site_logs_config: "models.SiteLogsConfig", + **kwargs + ) -> "models.SiteLogsConfig": + """Updates the logging configuration of an app. + + Updates the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore + + async def update_metadata( + self, + resource_group_name: str, + name: str, + metadata: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the metadata of an app. + + Replaces the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_metadata.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(metadata, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} # type: ignore + + async def list_metadata( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the metadata of an app. + + Gets the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_metadata.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} # type: ignore + + async def _list_publishing_credentials_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.User": + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_publishing_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + async def begin_list_publishing_credentials( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller["models.User"]: + """Gets the Git/FTP publishing credentials of an app. + + Gets the Git/FTP publishing credentials of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.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._list_publishing_credentials_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + async def update_site_push_settings( + self, + resource_group_name: str, + name: str, + push_settings: "models.PushSettings", + **kwargs + ) -> "models.PushSettings": + """Updates the Push settings associated with web app. + + Updates the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param push_settings: Push settings associated with web app. + :type push_settings: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_site_push_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(push_settings, 'PushSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} # type: ignore + + async def list_site_push_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PushSettings": + """Gets the Push settings associated with web app. + + Gets the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_site_push_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} # type: ignore + + async def list_slot_configuration_names( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SlotConfigNamesResource": + """Gets the names of app settings and connection strings that stick to the slot (not swapped). + + Gets the names of app settings and connection strings that stick to the slot (not swapped). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_slot_configuration_names.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore + + async def update_slot_configuration_names( + self, + resource_group_name: str, + name: str, + slot_config_names: "models.SlotConfigNamesResource", + **kwargs + ) -> "models.SlotConfigNamesResource": + """Updates the names of application settings and connection string that remain with the slot during swap operation. + + Updates the names of application settings and connection string that remain with the slot + during swap operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_config_names: Names of application settings and connection strings. See example. + :type slot_config_names: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_slot_configuration_names.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore + + async def get_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. + + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + async def create_or_update_configuration( + self, + resource_group_name: str, + name: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + async def update_configuration( + self, + resource_group_name: str, + name: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + def list_configuration_snapshot_info( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigurationSnapshotInfoCollection"]: + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. + + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configuration_snapshot_info.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteConfigurationSnapshotInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} # type: ignore + + async def get_configuration_snapshot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets a snapshot of the configuration of an app at a previous point in time. + + Gets a snapshot of the configuration of an app at a previous point in time. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_configuration_snapshot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} # type: ignore + + async def recover_site_configuration_snapshot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + **kwargs + ) -> None: + """Reverts the configuration of an app to a previous snapshot. + + Reverts the configuration of an app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} # type: ignore + + async def get_web_site_container_logs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional[IO]: + """Gets the last lines of docker logs for the given site. + + Gets the last lines of docker logs for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_web_site_container_logs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/octet-stream' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} # type: ignore + + async def get_web_site_container_logs_zip( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional[IO]: + """Gets the ZIP archived docker log files for the given site. + + Gets the ZIP archived docker log files for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_web_site_container_logs_zip.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/zip' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} # type: ignore + + def list_continuous_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ContinuousWebJobCollection"]: + """List continuous web jobs for an app, or a deployment slot. + + List continuous web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_continuous_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ContinuousWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} # type: ignore + + async def get_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> Optional["models.ContinuousWebJob"]: + """Gets a continuous web job by its ID for an app, or a deployment slot. + + Gets a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ContinuousWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore + + async def delete_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Delete a continuous web job by its ID for an app, or a deployment slot. + + Delete a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore + + async def start_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Start a continuous web job for an app, or a deployment slot. + + Start a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.start_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} # type: ignore + + async def stop_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Stop a continuous web job for an app, or a deployment slot. + + Stop a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.stop_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} # type: ignore + + def list_deployments( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.DeploymentCollection"]: + """List deployments for an app, or a deployment slot. + + List deployments for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_deployments.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('DeploymentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} # type: ignore + + async def get_deployment( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> "models.Deployment": + """Get a deployment by its ID for an app, or a deployment slot. + + Get a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def create_deployment( + self, + resource_group_name: str, + name: str, + id: str, + deployment: "models.Deployment", + **kwargs + ) -> "models.Deployment": + """Create a deployment for an app, or a deployment slot. + + Create a deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: ID of an existing deployment. + :type id: str + :param deployment: Deployment details. + :type deployment: ~azure.mgmt.web.v2016_08_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def delete_deployment( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> None: + """Delete a deployment by its ID for an app, or a deployment slot. + + Delete a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def list_deployment_log( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> "models.Deployment": + """List deployment log for specific deployment for an app, or a deployment slot. + + List deployment log for specific deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_deployment_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} # type: ignore + + def list_domain_ownership_identifiers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """Lists ownership identifiers for domain associated with web app. + + Lists ownership identifiers for domain associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_domain_ownership_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} # type: ignore + + async def get_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + **kwargs + ) -> "models.Identifier": + """Get domain ownership identifier for web app. + + Get domain ownership identifier for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def create_or_update_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def delete_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + **kwargs + ) -> None: + """Deletes a domain ownership identifier for a web app. + + Deletes a domain ownership identifier for a web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def update_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def get_ms_deploy_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_ms_deploy_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def _create_ms_deploy_operation_initial( + self, + resource_group_name: str, + name: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def begin_create_ms_deploy_operation( + self, + resource_group_name: str, + name: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def get_ms_deploy_log( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_ms_deploy_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} # type: ignore + + def list_functions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.FunctionEnvelopeCollection"]: + """List the functions for a web site, or a deployment slot. + + List the functions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('FunctionEnvelopeCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} # type: ignore + + async def get_functions_admin_token( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> str: + """Fetch a short lived token that can be exchanged for a master key. + + Fetch a short lived token that can be exchanged for a master key. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_functions_admin_token.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} # type: ignore + + async def get_function( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> Optional["models.FunctionEnvelope"]: + """Get function information by its ID for web site, or a deployment slot. + + Get function information by its ID for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_function.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def _create_function_initial( + self, + resource_group_name: str, + name: str, + function_name: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> "models.FunctionEnvelope": + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_function_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_function_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def begin_create_function( + self, + resource_group_name: str, + name: str, + function_name: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> AsyncLROPoller["models.FunctionEnvelope"]: + """Create function for web site, or a deployment slot. + + Create function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param function_envelope: Function details. + :type function_envelope: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.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_function_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def delete_function( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> None: + """Delete a function for web site, or a deployment slot. + + Delete a function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_function.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def list_function_secrets( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> "models.FunctionSecrets": + """Get function secrets for a function in a web site, or a deployment slot. + + Get function secrets for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_function_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} # type: ignore + + def list_host_name_bindings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.HostNameBindingCollection"]: + """Get hostname bindings for an app or a deployment slot. + + Get hostname bindings for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_host_name_bindings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('HostNameBindingCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} # type: ignore + + async def get_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + **kwargs + ) -> "models.HostNameBinding": + """Get the named hostname binding for an app (or deployment slot, if specified). + + Get the named hostname binding for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def create_or_update_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + host_name_binding: "models.HostNameBinding", + **kwargs + ) -> "models.HostNameBinding": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def delete_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def get_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def create_or_update_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> None: + """Removes a Hybrid Connection from this site. + + Removes a Hybrid Connection from this site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def update_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Gets the send key name and value for a Hybrid Connection. + + Gets the send key name and value for a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + async def list_hybrid_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves all Service Bus Hybrid Connections used by this Web App. + + Retrieves all Service Bus Hybrid Connections used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_hybrid_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} # type: ignore + + async def list_relay_service_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Gets hybrid connections configured for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_relay_service_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} # type: ignore + + async def get_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets a hybrid connection configuration by its name. + + Gets a hybrid connection configuration by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection. + :type entity_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def create_or_update_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def delete_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + **kwargs + ) -> None: + """Deletes a relay service connection by its name. + + Deletes a relay service connection by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def update_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + def list_instance_identifiers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebAppInstanceCollection"]: + """Gets all scale-out instances of an app. + + Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebAppInstanceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} # type: ignore + + async def get_instance_ms_deploy_status( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def _create_instance_ms_deploy_operation_initial( + self, + resource_group_name: str, + name: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def begin_create_instance_ms_deploy_operation( + self, + resource_group_name: str, + name: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_instance_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def get_instance_ms_deploy_log( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_processes( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_processes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} # type: ignore + + async def get_instance_process( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def delete_instance_process( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_instance_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def get_instance_process_dump( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_dump.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore + + def list_instance_process_modules( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_modules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore + + async def get_instance_process_module( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_module.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_instance_process_threads( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_threads.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore + + async def get_instance_process_thread( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_thread.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore + + async def is_cloneable( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteCloneability": + """Shows whether an app can be cloned to another resource group or subscription. + + Shows whether an app can be cloned to another resource group or subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.is_cloneable.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteCloneability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} # type: ignore + + async def list_sync_function_triggers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.FunctionSecrets": + """This is to allow calling via powershell and ARM template. + + This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_sync_function_triggers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} # type: ignore + + def list_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Gets all metric definitions of an app (or deployment slot, if specified). + + Gets all metric definitions of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions'} # type: ignore + + def list_metrics( + self, + resource_group_name: str, + name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Gets performance metrics of an app (or deployment slot, if specified). + + Gets performance metrics of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param details: Specify "true" to include metric details in the response. It is "false" by + default. + :type details: bool + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics'} # type: ignore + + async def _migrate_storage_initial( + self, + subscription_name: str, + resource_group_name: str, + name: str, + migration_options: "models.StorageMigrationOptions", + **kwargs + ) -> "models.StorageMigrationResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._migrate_storage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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['subscriptionName'] = self._serialize.query("subscription_name", subscription_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _migrate_storage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + async def begin_migrate_storage( + self, + subscription_name: str, + resource_group_name: str, + name: str, + migration_options: "models.StorageMigrationOptions", + **kwargs + ) -> AsyncLROPoller["models.StorageMigrationResponse"]: + """Restores a web app. + + Restores a web app. + + :param subscription_name: Azure subscription. + :type subscription_name: str + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param migration_options: Migration migrationOptions. + :type migration_options: ~azure.mgmt.web.v2016_08_01.models.StorageMigrationOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageMigrationResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.StorageMigrationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + lro_delay = kwargs.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._migrate_storage_initial( + subscription_name=subscription_name, + resource_group_name=resource_group_name, + name=name, + migration_options=migration_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + async def _migrate_my_sql_initial( + self, + resource_group_name: str, + name: str, + migration_request_envelope: "models.MigrateMySqlRequest", + **kwargs + ) -> "models.Operation": + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._migrate_my_sql_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _migrate_my_sql_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + async def begin_migrate_my_sql( + self, + resource_group_name: str, + name: str, + migration_request_envelope: "models.MigrateMySqlRequest", + **kwargs + ) -> AsyncLROPoller["models.Operation"]: + """Migrates a local (in-app) MySql database to a remote MySql database. + + Migrates a local (in-app) MySql database to a remote MySql database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param migration_request_envelope: MySql migration options. + :type migration_request_envelope: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Operation or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + lro_delay = kwargs.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._migrate_my_sql_initial( + resource_group_name=resource_group_name, + name=name, + migration_request_envelope=migration_request_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + async def get_migrate_my_sql_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MigrateMySqlStatus": + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. + + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} # type: ignore + + async def list_network_features( + self, + resource_group_name: str, + name: str, + view: str, + **kwargs + ) -> Optional["models.NetworkFeatures"]: + """Gets all network features used by the app (or deployment slot, if specified). + + Gets all network features used by the app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param view: The type of view. This can either be "summary" or "detailed". + :type view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_network_features.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'view': self._serialize.url("view", view, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('NetworkFeatures', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} # type: ignore + + async def start_web_site_network_trace( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> str: + """Start capturing network packets for the site. + + Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.start_web_site_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} # type: ignore + + async def stop_web_site_network_trace( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> str: + """Stop ongoing capturing network packets for the site. + + Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.stop_web_site_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} # type: ignore + + async def generate_new_site_publishing_password( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Generates a new publishing password for an app (or deployment slot, if specified). + + Generates a new publishing password for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} # type: ignore + + def list_perf_mon_counters( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.PerfMonCounterCollection"]: + """Gets perfmon counters for web app. + + Gets perfmon counters for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_perf_mon_counters.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} # type: ignore + + async def get_site_php_error_log_flag( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SitePhpErrorLogFlag": + """Gets web app's event logs. + + Gets web app's event logs. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} # type: ignore + + async def list_premier_add_ons( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets the premier add-ons of an app. + + Gets the premier add-ons of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_premier_add_ons.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} # type: ignore + + async def get_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets a named add-on of an app. + + Gets a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def add_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + premier_add_on: "models.PremierAddOn", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def delete_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + **kwargs + ) -> None: + """Delete a premier add-on from an app. + + Delete a premier add-on from an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + def list_processes( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_processes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} # type: ignore + + async def get_process( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore + + async def delete_process( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore + + async def get_process_dump( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_dump.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} # type: ignore + + def list_process_modules( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_modules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} # type: ignore + + async def get_process_module( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_module.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_process_threads( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_threads.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} # type: ignore + + async def get_process_thread( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_thread.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads/{threadId}'} # type: ignore + + def list_public_certificates( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.PublicCertificateCollection"]: + """Get public certificates for an app or a deployment slot. + + Get public certificates for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_public_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('PublicCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} # type: ignore + + async def get_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + **kwargs + ) -> "models.PublicCertificate": + """Get the named public certificate for an app (or deployment slot, if specified). + + Get the named public certificate for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def create_or_update_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + public_certificate: "models.PublicCertificate", + **kwargs + ) -> "models.PublicCertificate": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(public_certificate, 'PublicCertificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def delete_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def list_publishing_profile_xml_with_secrets( + self, + resource_group_name: str, + name: str, + publishing_profile_options: "models.CsmPublishingProfileOptions", + **kwargs + ) -> IO: + """Gets the publishing profile for an app (or deployment slot, if specified). + + Gets the publishing profile for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2016_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} # type: ignore + + async def _recover_initial( + self, + resource_group_name: str, + name: str, + recovery_entity: "models.SnapshotRecoveryRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._recover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') + 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]: + 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, {}) + + _recover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover'} # type: ignore + + async def begin_recover( + self, + resource_group_name: str, + name: str, + recovery_entity: "models.SnapshotRecoveryRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Recovers a web app to a previous snapshot. + + Recovers a web app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param recovery_entity: Snapshot data used for web app recovery. Snapshot information can be + obtained by calling GetDeletedSites or GetSiteSnapshots API. + :type recovery_entity: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._recover_initial( + resource_group_name=resource_group_name, + name=name, + recovery_entity=recovery_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover'} # type: ignore + + async def reset_production_slot_config( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. + + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.reset_production_slot_config.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} # type: ignore + + async def restart( + self, + resource_group_name: str, + name: str, + soft_restart: Optional[bool] = None, + synchronous: Optional[bool] = None, + **kwargs + ) -> None: + """Restarts an app (or deployment slot, if specified). + + Restarts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. + :type soft_restart: bool + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). + :type synchronous: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.restart.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + if synchronous is not None: + query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} # type: ignore + + def list_site_extensions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteExtensionInfoCollection"]: + """Get list of site extensions for a web site, or a deployment slot. + + Get list of site extensions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_extensions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteExtensionInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} # type: ignore + + async def get_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + """Get site extension information by its ID for a web site, or a deployment slot. + + Get site extension information by its ID for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_site_extension.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _install_site_extension_initial( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self._install_site_extension_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 429]: + 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('SiteExtensionInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _install_site_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def begin_install_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> AsyncLROPoller["models.SiteExtensionInfo"]: + """Install site extension on a web site, or a deployment slot. + + Install site extension on a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def delete_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> None: + """Remove a site extension from a web site, or a deployment slot. + + Remove a site extension from a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_site_extension.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + def list_slots( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Gets an app's deployment slots. + + Gets an app's deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slots.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} # type: ignore + + async def get_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional["models.Site"]: + """Gets the details of a web, mobile, or API app. + + Gets the details of a web, mobile, or API app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. By default, this API returns the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def _create_or_update_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.Site", + skip_dns_registration: Optional[bool] = None, + skip_custom_domain_verification: Optional[bool] = None, + force_dns_registration: Optional[bool] = None, + ttl_in_seconds: Optional[str] = None, + **kwargs + ) -> "models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if skip_dns_registration is not None: + query_parameters['skipDnsRegistration'] = self._serialize.query("skip_dns_registration", skip_dns_registration, 'bool') + if skip_custom_domain_verification is not None: + query_parameters['skipCustomDomainVerification'] = self._serialize.query("skip_custom_domain_verification", skip_custom_domain_verification, 'bool') + if force_dns_registration is not None: + query_parameters['forceDnsRegistration'] = self._serialize.query("force_dns_registration", force_dns_registration, 'bool') + if ttl_in_seconds is not None: + query_parameters['ttlInSeconds'] = self._serialize.query("ttl_in_seconds", ttl_in_seconds, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'Site') + 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]: + 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('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def begin_create_or_update_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.Site", + skip_dns_registration: Optional[bool] = None, + skip_custom_domain_verification: Optional[bool] = None, + force_dns_registration: Optional[bool] = None, + ttl_in_seconds: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["models.Site"]: + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. + :type slot: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.Site + :param skip_dns_registration: If true web app hostname is not registered with DNS on creation. + This parameter is + only used for app creation. + :type skip_dns_registration: bool + :param skip_custom_domain_verification: If true, custom (non *.azurewebsites.net) domains + associated with web app are not verified. + :type skip_custom_domain_verification: bool + :param force_dns_registration: If true, web app hostname is force registered with DNS. + :type force_dns_registration: bool + :param ttl_in_seconds: Time to live in seconds for web app's default domain name. + :type ttl_in_seconds: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.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_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_envelope=site_envelope, + skip_dns_registration=skip_dns_registration, + skip_custom_domain_verification=skip_custom_domain_verification, + force_dns_registration=force_dns_registration, + ttl_in_seconds=ttl_in_seconds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def delete_slot( + self, + resource_group_name: str, + name: str, + slot: str, + delete_metrics: Optional[bool] = None, + delete_empty_server_farm: Optional[bool] = None, + skip_dns_registration: Optional[bool] = None, + **kwargs + ) -> None: + """Deletes a web, mobile, or API app, or one of the deployment slots. + + Deletes a web, mobile, or API app, or one of the deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app to delete. + :type name: str + :param slot: Name of the deployment slot to delete. By default, the API deletes the production + slot. + :type slot: str + :param delete_metrics: If true, web app metrics are also deleted. + :type delete_metrics: bool + :param delete_empty_server_farm: Specify true if the App Service plan will be empty after app + deletion and you want to delete the empty App Service plan. By default, the empty App Service + plan is not deleted. + :type delete_empty_server_farm: bool + :param skip_dns_registration: If true, DNS registration is skipped. + :type skip_dns_registration: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if delete_metrics is not None: + query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') + if delete_empty_server_farm is not None: + query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') + if skip_dns_registration is not None: + query_parameters['skipDnsRegistration'] = self._serialize.query("skip_dns_registration", skip_dns_registration, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 404]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def update_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.SitePatchResource", + skip_dns_registration: Optional[bool] = None, + skip_custom_domain_verification: Optional[bool] = None, + force_dns_registration: Optional[bool] = None, + ttl_in_seconds: Optional[str] = None, + **kwargs + ) -> "models.Site": + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. + :type slot: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.SitePatchResource + :param skip_dns_registration: If true web app hostname is not registered with DNS on creation. + This parameter is + only used for app creation. + :type skip_dns_registration: bool + :param skip_custom_domain_verification: If true, custom (non *.azurewebsites.net) domains + associated with web app are not verified. + :type skip_custom_domain_verification: bool + :param force_dns_registration: If true, web app hostname is force registered with DNS. + :type force_dns_registration: bool + :param ttl_in_seconds: Time to live in seconds for web app's default domain name. + :type ttl_in_seconds: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if skip_dns_registration is not None: + query_parameters['skipDnsRegistration'] = self._serialize.query("skip_dns_registration", skip_dns_registration, 'bool') + if skip_custom_domain_verification is not None: + query_parameters['skipCustomDomainVerification'] = self._serialize.query("skip_custom_domain_verification", skip_custom_domain_verification, 'bool') + if force_dns_registration is not None: + query_parameters['forceDnsRegistration'] = self._serialize.query("force_dns_registration", force_dns_registration, 'bool') + if ttl_in_seconds is not None: + query_parameters['ttlInSeconds'] = self._serialize.query("ttl_in_seconds", ttl_in_seconds, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'SitePatchResource') + 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]: + 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('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def analyze_custom_hostname_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: Optional[str] = None, + **kwargs + ) -> "models.CustomHostnameAnalysisResult": + """Analyze a custom hostname. + + Analyze a custom hostname. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param host_name: Custom hostname. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if host_name is not None: + query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} # type: ignore + + async def apply_slot_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + """Applies the configuration settings from the target slot onto the current slot. + + Applies the configuration settings from the target slot onto the current slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} # type: ignore + + async def backup_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Creates a backup of an app. + + Creates a backup of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + backup for the production slot. + :type slot: str + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} # type: ignore + + def list_backups_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_backups_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} # type: ignore + + async def discover_restore_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreRequest": + """Discovers an existing app backup that can be restored from a blob in Azure storage. + + Discovers an existing app backup that can be restored from a blob in Azure storage. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will perform + discovery for the production slot. + :type slot: str + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.discover_restore_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + discover_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover'} # type: ignore + + async def get_backup_status_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + **kwargs + ) -> "models.BackupItem": + """Gets a backup of an app by its ID. + + Gets a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a backup + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_backup_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore + + async def delete_backup_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + **kwargs + ) -> None: + """Deletes a backup of an app by its ID. + + Deletes a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + backup of the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore + + async def list_backup_status_secrets_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param backup_id: ID of backup. + :type backup_id: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param request: Information on backup request. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} # type: ignore + + async def _restore_slot_initial( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _restore_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + async def begin_restore_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller["models.RestoreResponse"]: + """Restores a specific backup to another app (or deployment slot, if specified). + + Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestoreResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.RestoreResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + lro_delay = kwargs.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._restore_slot_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RestoreResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + def list_configurations_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigResourceCollection"]: + """List the configurations of an app. + + List the configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configurations_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteConfigResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} # type: ignore + + async def update_application_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the application settings of an app. + + Replaces the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + application settings for the production slot. + :type slot: str + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_application_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} # type: ignore + + async def list_application_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of an app. + + Gets the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + application settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_application_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} # type: ignore + + async def update_auth_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_auth_settings: "models.SiteAuthSettings", + **kwargs + ) -> "models.SiteAuthSettings": + """Updates the Authentication / Authorization settings associated with web app. + + Updates the Authentication / Authorization settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_auth_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} # type: ignore + + async def get_auth_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteAuthSettings": + """Gets the Authentication/Authorization settings of an app. + + Gets the Authentication/Authorization settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_auth_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} # type: ignore + + async def update_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupRequest": + """Updates the backup configuration of an app. + + Updates the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + backup configuration for the production slot. + :type slot: str + :param request: Edited backup configuration. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore + + async def delete_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes the backup configuration of an app. + + Deletes the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + backup configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore + + async def get_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.BackupRequest": + """Gets the backup configuration of an app. + + Gets the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + backup configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} # type: ignore + + async def update_connection_strings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_strings: "models.ConnectionStringDictionary", + **kwargs + ) -> "models.ConnectionStringDictionary": + """Replaces the connection strings of an app. + + Replaces the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + connection settings for the production slot. + :type slot: str + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_connection_strings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} # type: ignore + + async def list_connection_strings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.ConnectionStringDictionary": + """Gets the connection strings of an app. + + Gets the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + connection settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_connection_strings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} # type: ignore + + async def get_diagnostic_logs_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteLogsConfig": + """Gets the logging configuration of an app. + + Gets the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + logging configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore + + async def update_diagnostic_logs_config_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_logs_config: "models.SiteLogsConfig", + **kwargs + ) -> "models.SiteLogsConfig": + """Updates the logging configuration of an app. + + Updates the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + logging configuration for the production slot. + :type slot: str + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore + + async def update_metadata_slot( + self, + resource_group_name: str, + name: str, + slot: str, + metadata: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the metadata of an app. + + Replaces the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + metadata for the production slot. + :type slot: str + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_metadata_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(metadata, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} # type: ignore + + async def list_metadata_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the metadata of an app. + + Gets the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + metadata for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_metadata_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} # type: ignore + + async def _list_publishing_credentials_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.User": + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_publishing_credentials_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + async def begin_list_publishing_credentials_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncLROPoller["models.User"]: + """Gets the Git/FTP publishing credentials of an app. + + Gets the Git/FTP publishing credentials of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing credentials for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.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._list_publishing_credentials_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + async def update_site_push_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + push_settings: "models.PushSettings", + **kwargs + ) -> "models.PushSettings": + """Updates the Push settings associated with web app. + + Updates the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param push_settings: Push settings associated with web app. + :type push_settings: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_site_push_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(push_settings, 'PushSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} # type: ignore + + async def list_site_push_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PushSettings": + """Gets the Push settings associated with web app. + + Gets the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_site_push_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} # type: ignore + + async def get_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. + + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + async def create_or_update_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. + :type slot: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + async def update_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. + :type slot: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + def list_configuration_snapshot_info_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigurationSnapshotInfoCollection"]: + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. + + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configuration_snapshot_info_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteConfigurationSnapshotInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} # type: ignore + + async def get_configuration_snapshot_slot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + slot: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets a snapshot of the configuration of an app at a previous point in time. + + Gets a snapshot of the configuration of an app at a previous point in time. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} # type: ignore + + async def recover_site_configuration_snapshot_slot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + slot: str, + **kwargs + ) -> None: + """Reverts the configuration of an app to a previous snapshot. + + Reverts the configuration of an app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} # type: ignore + + async def get_web_site_container_logs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Gets the last lines of docker logs for the given site. + + Gets the last lines of docker logs for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/octet-stream' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} # type: ignore + + async def get_web_site_container_logs_zip_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Gets the ZIP archived docker log files for the given site. + + Gets the ZIP archived docker log files for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_web_site_container_logs_zip_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/zip' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} # type: ignore + + def list_continuous_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ContinuousWebJobCollection"]: + """List continuous web jobs for an app, or a deployment slot. + + List continuous web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_continuous_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ContinuousWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} # type: ignore + + async def get_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> Optional["models.ContinuousWebJob"]: + """Gets a continuous web job by its ID for an app, or a deployment slot. + + Gets a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ContinuousWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore + + async def delete_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a continuous web job by its ID for an app, or a deployment slot. + + Delete a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore + + async def start_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Start a continuous web job for an app, or a deployment slot. + + Start a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} # type: ignore + + async def stop_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Stop a continuous web job for an app, or a deployment slot. + + Stop a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} # type: ignore + + def list_deployments_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DeploymentCollection"]: + """List deployments for an app, or a deployment slot. + + List deployments for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_deployments_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DeploymentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} # type: ignore + + async def get_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> "models.Deployment": + """Get a deployment by its ID for an app, or a deployment slot. + + Get a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets a deployment + for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def create_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + deployment: "models.Deployment", + **kwargs + ) -> "models.Deployment": + """Create a deployment for an app, or a deployment slot. + + Create a deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: ID of an existing deployment. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API creates a + deployment for the production slot. + :type slot: str + :param deployment: Deployment details. + :type deployment: ~azure.mgmt.web.v2016_08_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def delete_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> None: + """Delete a deployment by its ID for an app, or a deployment slot. + + Delete a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def list_deployment_log_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> "models.Deployment": + """List deployment log for specific deployment for an app, or a deployment slot. + + List deployment log for specific deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_deployment_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} # type: ignore + + def list_domain_ownership_identifiers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """Lists ownership identifiers for domain associated with web app. + + Lists ownership identifiers for domain associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_domain_ownership_identifiers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} # type: ignore + + async def get_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + **kwargs + ) -> "models.Identifier": + """Get domain ownership identifier for web app. + + Get domain ownership identifier for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def create_or_update_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def delete_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a domain ownership identifier for a web app. + + Deletes a domain ownership identifier for a web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def update_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def get_ms_deploy_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def _create_ms_deploy_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def begin_create_ms_deploy_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def get_ms_deploy_log_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_functions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.FunctionEnvelopeCollection"]: + """List the functions for a web site, or a deployment slot. + + List the functions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_functions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('FunctionEnvelopeCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} # type: ignore + + async def get_functions_admin_token_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> str: + """Fetch a short lived token that can be exchanged for a master key. + + Fetch a short lived token that can be exchanged for a master key. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} # type: ignore + + async def get_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> Optional["models.FunctionEnvelope"]: + """Get function information by its ID for web site, or a deployment slot. + + Get function information by its ID for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_function_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def _create_instance_function_slot_initial( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> "models.FunctionEnvelope": + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_function_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def begin_create_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> AsyncLROPoller["models.FunctionEnvelope"]: + """Create function for web site, or a deployment slot. + + Create function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :param function_envelope: Function details. + :type function_envelope: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.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_instance_function_slot_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + slot=slot, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def delete_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a function for web site, or a deployment slot. + + Delete a function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_instance_function_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def list_function_secrets_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> "models.FunctionSecrets": + """Get function secrets for a function in a web site, or a deployment slot. + + Get function secrets for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_function_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} # type: ignore + + def list_host_name_bindings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.HostNameBindingCollection"]: + """Get hostname bindings for an app or a deployment slot. + + Get hostname bindings for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_host_name_bindings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('HostNameBindingCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} # type: ignore + + async def get_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: str, + **kwargs + ) -> "models.HostNameBinding": + """Get the named hostname binding for an app (or deployment slot, if specified). + + Get the named hostname binding for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. + :type slot: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def create_or_update_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + host_name: str, + slot: str, + host_name_binding: "models.HostNameBinding", + **kwargs + ) -> "models.HostNameBinding": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. + :type slot: str + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def delete_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param host_name: Hostname in the hostname binding. + :type host_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def get_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def create_or_update_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> None: + """Removes a Hybrid Connection from this site. + + Removes a Hybrid Connection from this site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def update_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Gets the send key name and value for a Hybrid Connection. + + Gets the send key name and value for a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + async def list_hybrid_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves all Service Bus Hybrid Connections used by this Web App. + + Retrieves all Service Bus Hybrid Connections used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} # type: ignore + + async def list_relay_service_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Gets hybrid connections configured for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get hybrid + connections for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} # type: ignore + + async def get_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets a hybrid connection configuration by its name. + + Gets a hybrid connection configuration by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a hybrid + connection for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def create_or_update_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. + :type slot: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def delete_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a relay service connection by its name. + + Deletes a relay service connection by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + hybrid connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def update_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. + :type slot: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + def list_instance_identifiers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.WebAppInstanceCollection"]: + """Gets all scale-out instances of an app. + + Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_identifiers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('WebAppInstanceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} # type: ignore + + async def get_instance_ms_deploy_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def _create_instance_ms_deploy_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def begin_create_instance_ms_deploy_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_instance_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def get_instance_ms_deploy_log_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_processes_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_processes_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} # type: ignore + + async def get_instance_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def delete_instance_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_instance_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def get_instance_process_dump_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore + + def list_instance_process_modules_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_modules_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore + + async def get_instance_process_module_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_module_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_instance_process_threads_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_threads_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore + + async def get_instance_process_thread_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore + + async def is_cloneable_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteCloneability": + """Shows whether an app can be cloned to another resource group or subscription. + + Shows whether an app can be cloned to another resource group or subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. By default, this API returns information on the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.is_cloneable_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteCloneability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} # type: ignore + + async def list_sync_function_triggers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.FunctionSecrets": + """This is to allow calling via powershell and ARM template. + + This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} # type: ignore + + def list_metric_definitions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Gets all metric definitions of an app (or deployment slot, if specified). + + Gets all metric definitions of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metric + definitions of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metric_definitions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metric_definitions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions'} # type: ignore + + def list_metrics_slot( + self, + resource_group_name: str, + name: str, + slot: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Gets performance metrics of an app (or deployment slot, if specified). + + Gets performance metrics of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metrics + of the production slot. + :type slot: str + :param details: Specify "true" to include metric details in the response. It is "false" by + default. + :type details: bool + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metrics_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics'} # type: ignore + + async def get_migrate_my_sql_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.MigrateMySqlStatus": + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. + + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} # type: ignore + + async def list_network_features_slot( + self, + resource_group_name: str, + name: str, + view: str, + slot: str, + **kwargs + ) -> Optional["models.NetworkFeatures"]: + """Gets all network features used by the app (or deployment slot, if specified). + + Gets all network features used by the app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param view: The type of view. This can either be "summary" or "detailed". + :type view: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get network + features for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_network_features_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'view': self._serialize.url("view", view, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('NetworkFeatures', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} # type: ignore + + async def start_web_site_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> str: + """Start capturing network packets for the site. + + Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} # type: ignore + + async def stop_web_site_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> str: + """Stop ongoing capturing network packets for the site. + + Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} # type: ignore + + async def generate_new_site_publishing_password_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Generates a new publishing password for an app (or deployment slot, if specified). + + Generates a new publishing password for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API generate a new + publishing password for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} # type: ignore + + def list_perf_mon_counters_slot( + self, + resource_group_name: str, + name: str, + slot: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.PerfMonCounterCollection"]: + """Gets perfmon counters for web app. + + Gets perfmon counters for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_perf_mon_counters_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} # type: ignore + + async def get_site_php_error_log_flag_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SitePhpErrorLogFlag": + """Gets web app's event logs. + + Gets web app's event logs. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} # type: ignore + + async def list_premier_add_ons_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets the premier add-ons of an app. + + Gets the premier add-ons of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + premier add-ons for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} # type: ignore + + async def get_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets a named add-on of an app. + + Gets a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named add-on for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def add_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + premier_add_on: "models.PremierAddOn", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. + :type slot: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def delete_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a premier add-on from an app. + + Delete a premier add-on from an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + named add-on for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + def list_processes_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_processes_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} # type: ignore + + async def get_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore + + async def delete_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore + + async def get_process_dump_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_dump_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} # type: ignore + + def list_process_modules_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_modules_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} # type: ignore + + async def get_process_module_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_module_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_process_threads_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_threads_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} # type: ignore + + async def get_process_thread_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_process_thread_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads/{threadId}'} # type: ignore + + def list_public_certificates_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.PublicCertificateCollection"]: + """Get public certificates for an app or a deployment slot. + + Get public certificates for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_public_certificates_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('PublicCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} # type: ignore + + async def get_public_certificate_slot( + self, + resource_group_name: str, + name: str, + slot: str, + public_certificate_name: str, + **kwargs + ) -> "models.PublicCertificate": + """Get the named public certificate for an app (or deployment slot, if specified). + + Get the named public certificate for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. + :type slot: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def create_or_update_public_certificate_slot( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + slot: str, + public_certificate: "models.PublicCertificate", + **kwargs + ) -> "models.PublicCertificate": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. + :type slot: str + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(public_certificate, 'PublicCertificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def delete_public_certificate_slot( + self, + resource_group_name: str, + name: str, + slot: str, + public_certificate_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param public_certificate_name: Public certificate name. + :type public_certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def list_publishing_profile_xml_with_secrets_slot( + self, + resource_group_name: str, + name: str, + slot: str, + publishing_profile_options: "models.CsmPublishingProfileOptions", + **kwargs + ) -> IO: + """Gets the publishing profile for an app (or deployment slot, if specified). + + Gets the publishing profile for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing profile for the production slot. + :type slot: str + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2016_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} # type: ignore + + async def _recover_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + recovery_entity: "models.SnapshotRecoveryRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._recover_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') + 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]: + 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, {}) + + _recover_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover'} # type: ignore + + async def begin_recover_slot( + self, + resource_group_name: str, + name: str, + slot: str, + recovery_entity: "models.SnapshotRecoveryRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Recovers a web app to a previous snapshot. + + Recovers a web app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param recovery_entity: Snapshot data used for web app recovery. Snapshot information can be + obtained by calling GetDeletedSites or GetSiteSnapshots API. + :type recovery_entity: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._recover_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + recovery_entity=recovery_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recover_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover'} # type: ignore + + async def reset_slot_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. + + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API resets + configuration settings for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} # type: ignore + + async def restart_slot( + self, + resource_group_name: str, + name: str, + slot: str, + soft_restart: Optional[bool] = None, + synchronous: Optional[bool] = None, + **kwargs + ) -> None: + """Restarts an app (or deployment slot, if specified). + + Restarts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restart the + production slot. + :type slot: str + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. + :type soft_restart: bool + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). + :type synchronous: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.restart_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + if synchronous is not None: + query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} # type: ignore + + def list_site_extensions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteExtensionInfoCollection"]: + """Get list of site extensions for a web site, or a deployment slot. + + Get list of site extensions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_extensions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteExtensionInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} # type: ignore + + async def get_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + """Get site extension information by its ID for a web site, or a deployment slot. + + Get site extension information by its ID for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_site_extension_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _install_site_extension_slot_initial( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 429]: + 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('SiteExtensionInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _install_site_extension_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def begin_install_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> AsyncLROPoller["models.SiteExtensionInfo"]: + """Install site extension on a web site, or a deployment slot. + + Install site extension on a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_slot_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def delete_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> None: + """Remove a site extension from a web site, or a deployment slot. + + Remove a site extension from a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_site_extension_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + def list_slot_differences_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncIterable["models.SlotDifferenceCollection"]: + """Get the difference in configuration settings between two web app slots. + + Get the difference in configuration settings between two web app slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slot_differences_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} # type: ignore + + async def _swap_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._swap_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + _swap_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + async def begin_swap_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Swaps two deployment slots of an app. + + Swaps two deployment slots of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._swap_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + def list_snapshots_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user. + + Returns all Snapshots to the user. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :param slot: Website Slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} # type: ignore + + async def get_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteSourceControl": + """Gets the source control configuration of an app. + + Gets the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + source control configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 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('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def _create_or_update_source_control_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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]: + 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('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_source_control_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def begin_create_or_update_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> AsyncLROPoller["models.SiteSourceControl"]: + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. + :type slot: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.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_source_control_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def delete_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes the source control configuration of an app. + + Deletes the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + source control configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def update_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. + :type slot: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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, 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('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def start_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Starts an app (or deployment slot, if specified). + + Starts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will start the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.start_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} # type: ignore + + async def stop_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stops an app (or deployment slot, if specified). + + Stops an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will stop the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.stop_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} # type: ignore + + async def sync_repository_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Sync web app repository. + + Sync web app repository. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.sync_repository_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} # type: ignore + + async def sync_function_triggers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the scale controller. + + Syncs function trigger metadata to the scale controller. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.sync_function_triggers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} # type: ignore + + def list_triggered_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.TriggeredWebJobCollection"]: + """List triggered web jobs for an app, or a deployment slot. + + List triggered web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('TriggeredWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} # type: ignore + + async def get_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> Optional["models.TriggeredWebJob"]: + """Gets a triggered web job by its ID for an app, or a deployment slot. + + Gets a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore + + async def delete_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a triggered web job by its ID for an app, or a deployment slot. + + Delete a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore + + def list_triggered_web_job_history_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.TriggeredJobHistoryCollection"]: + """List a triggered web job's history for an app, or a deployment slot. + + List a triggered web job's history for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_job_history_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('TriggeredJobHistoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} # type: ignore + + async def get_triggered_web_job_history_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + id: str, + slot: str, + **kwargs + ) -> Optional["models.TriggeredJobHistory"]: + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param id: History ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredJobHistory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore + + async def run_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Run a triggered web job for an app, or a deployment slot. + + Run a triggered web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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, {}) + + run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} # type: ignore + + def list_usages_slot( + self, + resource_group_name: str, + name: str, + slot: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets the quota usage information of an app (or deployment slot, if specified). + + Gets the quota usage information of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get quota + information of the production slot. + :type slot: str + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} # type: ignore + + async def list_vnet_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Gets the virtual networks the app (or deployment slot) is connected to. + + Gets the virtual networks the app (or deployment slot) is connected to. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get virtual + network connections for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_vnet_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + **kwargs + ) -> "models.VnetInfo": + """Gets a virtual network the app (or deployment slot) is connected to by name. + + Gets a virtual network the app (or deployment slot) is connected to by name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named virtual network for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def create_or_update_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def delete_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Deletes a connection from an app (or deployment slot to a named virtual network. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def update_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + **kwargs + ) -> Optional["models.VnetGateway"]: + """Gets an app's Virtual Network gateway. + + Gets an app's Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def create_or_update_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. + :type slot: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. + :type slot: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + def list_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.WebJobCollection"]: + """List webjobs for an app, or a deployment slot. + + List webjobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('WebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} # type: ignore + + async def get_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> "models.WebJob": + """Get webjob information for an app, or a deployment slot. + + Get webjob information for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of the web job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} # type: ignore + + def list_slot_differences_from_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncIterable["models.SlotDifferenceCollection"]: + """Get the difference in configuration settings between two web app slots. + + Get the difference in configuration settings between two web app slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slot_differences_from_production.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} # type: ignore + + async def _swap_slot_with_production_initial( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + _swap_slot_with_production_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + async def begin_swap_slot_with_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Swaps two deployment slots of an app. + + Swaps two deployment slots of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._swap_slot_with_production_initial( + resource_group_name=resource_group_name, + name=name, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + def list_snapshots( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user. + + Returns all Snapshots to the user. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} # type: ignore + + async def get_source_control( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteSourceControl": + """Gets the source control configuration of an app. + + Gets the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 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('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def _create_or_update_source_control_initial( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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]: + 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('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_source_control_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def begin_create_or_update_source_control( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> AsyncLROPoller["models.SiteSourceControl"]: + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.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_source_control_initial( + resource_group_name=resource_group_name, + name=name, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def delete_source_control( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes the source control configuration of an app. + + Deletes the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def update_source_control( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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, 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('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def start( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Starts an app (or deployment slot, if specified). + + Starts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.start.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} # type: ignore + + async def stop( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stops an app (or deployment slot, if specified). + + Stops an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.stop.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} # type: ignore + + async def sync_repository( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Sync web app repository. + + Sync web app repository. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.sync_repository.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} # type: ignore + + async def sync_function_triggers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the scale controller. + + Syncs function trigger metadata to the scale controller. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.sync_function_triggers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} # type: ignore + + def list_triggered_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.TriggeredWebJobCollection"]: + """List triggered web jobs for an app, or a deployment slot. + + List triggered web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('TriggeredWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} # type: ignore + + async def get_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> Optional["models.TriggeredWebJob"]: + """Gets a triggered web job by its ID for an app, or a deployment slot. + + Gets a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore + + async def delete_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Delete a triggered web job by its ID for an app, or a deployment slot. + + Delete a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore + + def list_triggered_web_job_history( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> AsyncIterable["models.TriggeredJobHistoryCollection"]: + """List a triggered web job's history for an app, or a deployment slot. + + List a triggered web job's history for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_job_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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: + 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('TriggeredJobHistoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} # type: ignore + + async def get_triggered_web_job_history( + self, + resource_group_name: str, + name: str, + web_job_name: str, + id: str, + **kwargs + ) -> Optional["models.TriggeredJobHistory"]: + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param id: History ID. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_triggered_web_job_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredJobHistory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore + + async def run_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Run a triggered web job for an app, or a deployment slot. + + Run a triggered web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.run_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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, {}) + + run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets the quota usage information of an app (or deployment slot, if specified). + + Gets the quota usage information of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} # type: ignore + + async def list_vnet_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Gets the virtual networks the app (or deployment slot) is connected to. + + Gets the virtual networks the app (or deployment slot) is connected to. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.list_vnet_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> "models.VnetInfo": + """Gets a virtual network the app (or deployment slot) is connected to by name. + + Gets a virtual network the app (or deployment slot) is connected to by name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def create_or_update_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def delete_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> None: + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Deletes a connection from an app (or deployment slot to a named virtual network. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.delete_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def update_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + **kwargs + ) -> Optional["models.VnetGateway"]: + """Gets an app's Virtual Network gateway. + + Gets an app's Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def create_or_update_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + def list_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebJobCollection"]: + """List webjobs for an app, or a deployment slot. + + List webjobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} # type: ignore + + async def get_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> "models.WebJob": + """Get webjob information for an app, or a deployment slot. + + Get webjob information for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of the web job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + + # Construct URL + url = self.get_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/__init__.py index 2f3735650390..f0ca635fa955 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/__init__.py @@ -1,18 +1,14 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import ApiDefinitionInfo from ._models_py3 import ApplicationLogsConfig - from ._models_py3 import AppServicePlan from ._models_py3 import AutoHealActions from ._models_py3 import AutoHealCustomAction from ._models_py3 import AutoHealRules @@ -21,57 +17,68 @@ from ._models_py3 import AzureBlobStorageHttpLogsConfig from ._models_py3 import AzureTableStorageApplicationLogsConfig from ._models_py3 import BackupItem + from ._models_py3 import BackupItemCollection from ._models_py3 import BackupRequest from ._models_py3 import BackupSchedule - from ._models_py3 import Capability from ._models_py3 import CloningInfo - from ._models_py3 import ConnectionStringDictionary from ._models_py3 import ConnStringInfo from ._models_py3 import ConnStringValueTypePair + from ._models_py3 import ConnectionStringDictionary from ._models_py3 import ContinuousWebJob + from ._models_py3 import ContinuousWebJobCollection from ._models_py3 import CorsSettings from ._models_py3 import CsmPublishingProfileOptions from ._models_py3 import CsmSlotEntity from ._models_py3 import CsmUsageQuota + from ._models_py3 import CsmUsageQuotaCollection from ._models_py3 import CustomHostnameAnalysisResult from ._models_py3 import DatabaseBackupSetting from ._models_py3 import Deployment + from ._models_py3 import DeploymentCollection from ._models_py3 import EnabledConfig from ._models_py3 import ErrorEntity from ._models_py3 import Experiments from ._models_py3 import FileSystemApplicationLogsConfig from ._models_py3 import FileSystemHttpLogsConfig from ._models_py3 import FunctionEnvelope + from ._models_py3 import FunctionEnvelopeCollection from ._models_py3 import FunctionSecrets from ._models_py3 import HandlerMapping - from ._models_py3 import HostingEnvironmentProfile from ._models_py3 import HostNameBinding + from ._models_py3 import HostNameBindingCollection from ._models_py3 import HostNameSslState + from ._models_py3 import HostingEnvironmentProfile from ._models_py3 import HttpLogsConfig from ._models_py3 import HybridConnection from ._models_py3 import HybridConnectionKey from ._models_py3 import Identifier + from ._models_py3 import IdentifierCollection from ._models_py3 import IpSecurityRestriction from ._models_py3 import LocalizableString - from ._models_py3 import ManagedServiceIdentity - from ._models_py3 import MigrateMySqlRequest - from ._models_py3 import MigrateMySqlStatus from ._models_py3 import MSDeploy from ._models_py3 import MSDeployLog from ._models_py3 import MSDeployLogEntry from ._models_py3 import MSDeployStatus + from ._models_py3 import ManagedServiceIdentity + from ._models_py3 import MigrateMySqlRequest + from ._models_py3 import MigrateMySqlStatus from ._models_py3 import NameValuePair from ._models_py3 import NetworkFeatures from ._models_py3 import Operation + from ._models_py3 import PerfMonCounterCollection from ._models_py3 import PerfMonResponse from ._models_py3 import PerfMonSample from ._models_py3 import PerfMonSet from ._models_py3 import PremierAddOn from ._models_py3 import ProcessInfo + from ._models_py3 import ProcessInfoCollection from ._models_py3 import ProcessModuleInfo + from ._models_py3 import ProcessModuleInfoCollection from ._models_py3 import ProcessThreadInfo + from ._models_py3 import ProcessThreadInfoCollection from ._models_py3 import ProxyOnlyResource from ._models_py3 import PublicCertificate + from ._models_py3 import PublicCertificateCollection from ._models_py3 import PushSettings from ._models_py3 import RampUpRule from ._models_py3 import RelayServiceConnectionEntity @@ -79,7 +86,9 @@ from ._models_py3 import Resource from ._models_py3 import ResourceMetric from ._models_py3 import ResourceMetricAvailability + from ._models_py3 import ResourceMetricCollection from ._models_py3 import ResourceMetricDefinition + from ._models_py3 import ResourceMetricDefinitionCollection from ._models_py3 import ResourceMetricName from ._models_py3 import ResourceMetricProperty from ._models_py3 import ResourceMetricValue @@ -91,8 +100,11 @@ from ._models_py3 import SiteCloneabilityCriterion from ._models_py3 import SiteConfig from ._models_py3 import SiteConfigResource + from ._models_py3 import SiteConfigResourceCollection from ._models_py3 import SiteConfigurationSnapshotInfo + from ._models_py3 import SiteConfigurationSnapshotInfoCollection from ._models_py3 import SiteExtensionInfo + from ._models_py3 import SiteExtensionInfoCollection from ._models_py3 import SiteInstance from ._models_py3 import SiteLimits from ._models_py3 import SiteLogsConfig @@ -100,13 +112,13 @@ from ._models_py3 import SitePatchResource from ._models_py3 import SitePhpErrorLogFlag from ._models_py3 import SiteSourceControl - from ._models_py3 import SkuCapacity - from ._models_py3 import SkuDescription from ._models_py3 import SlotConfigNamesResource from ._models_py3 import SlotDifference + from ._models_py3 import SlotDifferenceCollection from ._models_py3 import SlotSwapStatus from ._models_py3 import SlowRequestsBasedTrigger from ._models_py3 import Snapshot + from ._models_py3 import SnapshotCollection from ._models_py3 import SnapshotRecoveryRequest from ._models_py3 import SnapshotRecoveryTarget from ._models_py3 import StatusCodesBasedTrigger @@ -114,196 +126,195 @@ from ._models_py3 import StorageMigrationResponse from ._models_py3 import StringDictionary from ._models_py3 import TriggeredJobHistory + from ._models_py3 import TriggeredJobHistoryCollection from ._models_py3 import TriggeredJobRun from ._models_py3 import TriggeredWebJob + from ._models_py3 import TriggeredWebJobCollection from ._models_py3 import User from ._models_py3 import VirtualApplication from ._models_py3 import VirtualDirectory from ._models_py3 import VnetGateway from ._models_py3 import VnetInfo from ._models_py3 import VnetRoute + from ._models_py3 import WebAppCollection + from ._models_py3 import WebAppInstanceCollection from ._models_py3 import WebJob + from ._models_py3 import WebJobCollection except (SyntaxError, ImportError): - from ._models import ApiDefinitionInfo - from ._models import ApplicationLogsConfig - from ._models import AppServicePlan - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import AzureBlobStorageApplicationLogsConfig - from ._models import AzureBlobStorageHttpLogsConfig - from ._models import AzureTableStorageApplicationLogsConfig - from ._models import BackupItem - from ._models import BackupRequest - from ._models import BackupSchedule - from ._models import Capability - from ._models import CloningInfo - from ._models import ConnectionStringDictionary - from ._models import ConnStringInfo - from ._models import ConnStringValueTypePair - from ._models import ContinuousWebJob - from ._models import CorsSettings - from ._models import CsmPublishingProfileOptions - from ._models import CsmSlotEntity - from ._models import CsmUsageQuota - from ._models import CustomHostnameAnalysisResult - from ._models import DatabaseBackupSetting - from ._models import Deployment - from ._models import EnabledConfig - from ._models import ErrorEntity - from ._models import Experiments - from ._models import FileSystemApplicationLogsConfig - from ._models import FileSystemHttpLogsConfig - from ._models import FunctionEnvelope - from ._models import FunctionSecrets - from ._models import HandlerMapping - from ._models import HostingEnvironmentProfile - from ._models import HostNameBinding - from ._models import HostNameSslState - from ._models import HttpLogsConfig - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import Identifier - from ._models import IpSecurityRestriction - from ._models import LocalizableString - from ._models import ManagedServiceIdentity - from ._models import MigrateMySqlRequest - from ._models import MigrateMySqlStatus - from ._models import MSDeploy - from ._models import MSDeployLog - from ._models import MSDeployLogEntry - from ._models import MSDeployStatus - from ._models import NameValuePair - from ._models import NetworkFeatures - from ._models import Operation - from ._models import PerfMonResponse - from ._models import PerfMonSample - from ._models import PerfMonSet - from ._models import PremierAddOn - from ._models import ProcessInfo - from ._models import ProcessModuleInfo - from ._models import ProcessThreadInfo - from ._models import ProxyOnlyResource - from ._models import PublicCertificate - from ._models import PushSettings - from ._models import RampUpRule - from ._models import RelayServiceConnectionEntity - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceMetric - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import ResourceMetricName - from ._models import ResourceMetricProperty - from ._models import ResourceMetricValue - from ._models import RestoreRequest - from ._models import RestoreResponse - from ._models import Site - from ._models import SiteAuthSettings - from ._models import SiteCloneability - from ._models import SiteCloneabilityCriterion - from ._models import SiteConfig - from ._models import SiteConfigResource - from ._models import SiteConfigurationSnapshotInfo - from ._models import SiteExtensionInfo - from ._models import SiteInstance - from ._models import SiteLimits - from ._models import SiteLogsConfig - from ._models import SiteMachineKey - from ._models import SitePatchResource - from ._models import SitePhpErrorLogFlag - from ._models import SiteSourceControl - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SlotConfigNamesResource - from ._models import SlotDifference - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import Snapshot - from ._models import SnapshotRecoveryRequest - from ._models import SnapshotRecoveryTarget - from ._models import StatusCodesBasedTrigger - from ._models import StorageMigrationOptions - from ._models import StorageMigrationResponse - from ._models import StringDictionary - from ._models import TriggeredJobHistory - from ._models import TriggeredJobRun - from ._models import TriggeredWebJob - from ._models import User - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetRoute - from ._models import WebJob -from ._paged_models import BackupItemPaged -from ._paged_models import ContinuousWebJobPaged -from ._paged_models import CsmUsageQuotaPaged -from ._paged_models import DeploymentPaged -from ._paged_models import FunctionEnvelopePaged -from ._paged_models import HostNameBindingPaged -from ._paged_models import IdentifierPaged -from ._paged_models import PerfMonResponsePaged -from ._paged_models import ProcessInfoPaged -from ._paged_models import ProcessModuleInfoPaged -from ._paged_models import ProcessThreadInfoPaged -from ._paged_models import PublicCertificatePaged -from ._paged_models import ResourceMetricDefinitionPaged -from ._paged_models import ResourceMetricPaged -from ._paged_models import SiteConfigResourcePaged -from ._paged_models import SiteConfigurationSnapshotInfoPaged -from ._paged_models import SiteExtensionInfoPaged -from ._paged_models import SiteInstancePaged -from ._paged_models import SitePaged -from ._paged_models import SlotDifferencePaged -from ._paged_models import SnapshotPaged -from ._paged_models import TriggeredJobHistoryPaged -from ._paged_models import TriggeredWebJobPaged -from ._paged_models import WebJobPaged + from ._models import ApiDefinitionInfo # type: ignore + from ._models import ApplicationLogsConfig # type: ignore + from ._models import AutoHealActions # type: ignore + from ._models import AutoHealCustomAction # type: ignore + from ._models import AutoHealRules # type: ignore + from ._models import AutoHealTriggers # type: ignore + from ._models import AzureBlobStorageApplicationLogsConfig # type: ignore + from ._models import AzureBlobStorageHttpLogsConfig # type: ignore + from ._models import AzureTableStorageApplicationLogsConfig # type: ignore + from ._models import BackupItem # type: ignore + from ._models import BackupItemCollection # type: ignore + from ._models import BackupRequest # type: ignore + from ._models import BackupSchedule # type: ignore + from ._models import CloningInfo # type: ignore + from ._models import ConnStringInfo # type: ignore + from ._models import ConnStringValueTypePair # type: ignore + from ._models import ConnectionStringDictionary # type: ignore + from ._models import ContinuousWebJob # type: ignore + from ._models import ContinuousWebJobCollection # type: ignore + from ._models import CorsSettings # type: ignore + from ._models import CsmPublishingProfileOptions # type: ignore + from ._models import CsmSlotEntity # type: ignore + from ._models import CsmUsageQuota # type: ignore + from ._models import CsmUsageQuotaCollection # type: ignore + from ._models import CustomHostnameAnalysisResult # type: ignore + from ._models import DatabaseBackupSetting # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentCollection # type: ignore + from ._models import EnabledConfig # type: ignore + from ._models import ErrorEntity # type: ignore + from ._models import Experiments # type: ignore + from ._models import FileSystemApplicationLogsConfig # type: ignore + from ._models import FileSystemHttpLogsConfig # type: ignore + from ._models import FunctionEnvelope # type: ignore + from ._models import FunctionEnvelopeCollection # type: ignore + from ._models import FunctionSecrets # type: ignore + from ._models import HandlerMapping # type: ignore + from ._models import HostNameBinding # type: ignore + from ._models import HostNameBindingCollection # type: ignore + from ._models import HostNameSslState # type: ignore + from ._models import HostingEnvironmentProfile # type: ignore + from ._models import HttpLogsConfig # type: ignore + from ._models import HybridConnection # type: ignore + from ._models import HybridConnectionKey # type: ignore + from ._models import Identifier # type: ignore + from ._models import IdentifierCollection # type: ignore + from ._models import IpSecurityRestriction # type: ignore + from ._models import LocalizableString # type: ignore + from ._models import MSDeploy # type: ignore + from ._models import MSDeployLog # type: ignore + from ._models import MSDeployLogEntry # type: ignore + from ._models import MSDeployStatus # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import MigrateMySqlRequest # type: ignore + from ._models import MigrateMySqlStatus # type: ignore + from ._models import NameValuePair # type: ignore + from ._models import NetworkFeatures # type: ignore + from ._models import Operation # type: ignore + from ._models import PerfMonCounterCollection # type: ignore + from ._models import PerfMonResponse # type: ignore + from ._models import PerfMonSample # type: ignore + from ._models import PerfMonSet # type: ignore + from ._models import PremierAddOn # type: ignore + from ._models import ProcessInfo # type: ignore + from ._models import ProcessInfoCollection # type: ignore + from ._models import ProcessModuleInfo # type: ignore + from ._models import ProcessModuleInfoCollection # type: ignore + from ._models import ProcessThreadInfo # type: ignore + from ._models import ProcessThreadInfoCollection # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import PublicCertificate # type: ignore + from ._models import PublicCertificateCollection # type: ignore + from ._models import PushSettings # type: ignore + from ._models import RampUpRule # type: ignore + from ._models import RelayServiceConnectionEntity # type: ignore + from ._models import RequestsBasedTrigger # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceMetric # type: ignore + from ._models import ResourceMetricAvailability # type: ignore + from ._models import ResourceMetricCollection # type: ignore + from ._models import ResourceMetricDefinition # type: ignore + from ._models import ResourceMetricDefinitionCollection # type: ignore + from ._models import ResourceMetricName # type: ignore + from ._models import ResourceMetricProperty # type: ignore + from ._models import ResourceMetricValue # type: ignore + from ._models import RestoreRequest # type: ignore + from ._models import RestoreResponse # type: ignore + from ._models import Site # type: ignore + from ._models import SiteAuthSettings # type: ignore + from ._models import SiteCloneability # type: ignore + from ._models import SiteCloneabilityCriterion # type: ignore + from ._models import SiteConfig # type: ignore + from ._models import SiteConfigResource # type: ignore + from ._models import SiteConfigResourceCollection # type: ignore + from ._models import SiteConfigurationSnapshotInfo # type: ignore + from ._models import SiteConfigurationSnapshotInfoCollection # type: ignore + from ._models import SiteExtensionInfo # type: ignore + from ._models import SiteExtensionInfoCollection # type: ignore + from ._models import SiteInstance # type: ignore + from ._models import SiteLimits # type: ignore + from ._models import SiteLogsConfig # type: ignore + from ._models import SiteMachineKey # type: ignore + from ._models import SitePatchResource # type: ignore + from ._models import SitePhpErrorLogFlag # type: ignore + from ._models import SiteSourceControl # type: ignore + from ._models import SlotConfigNamesResource # type: ignore + from ._models import SlotDifference # type: ignore + from ._models import SlotDifferenceCollection # type: ignore + from ._models import SlotSwapStatus # type: ignore + from ._models import SlowRequestsBasedTrigger # type: ignore + from ._models import Snapshot # type: ignore + from ._models import SnapshotCollection # type: ignore + from ._models import SnapshotRecoveryRequest # type: ignore + from ._models import SnapshotRecoveryTarget # type: ignore + from ._models import StatusCodesBasedTrigger # type: ignore + from ._models import StorageMigrationOptions # type: ignore + from ._models import StorageMigrationResponse # type: ignore + from ._models import StringDictionary # type: ignore + from ._models import TriggeredJobHistory # type: ignore + from ._models import TriggeredJobHistoryCollection # type: ignore + from ._models import TriggeredJobRun # type: ignore + from ._models import TriggeredWebJob # type: ignore + from ._models import TriggeredWebJobCollection # type: ignore + from ._models import User # type: ignore + from ._models import VirtualApplication # type: ignore + from ._models import VirtualDirectory # type: ignore + from ._models import VnetGateway # type: ignore + from ._models import VnetInfo # type: ignore + from ._models import VnetRoute # type: ignore + from ._models import WebAppCollection # type: ignore + from ._models import WebAppInstanceCollection # type: ignore + from ._models import WebJob # type: ignore + from ._models import WebJobCollection # type: ignore + from ._web_site_management_client_enums import ( - LogLevel, + AutoHealActionType, + AzureResourceType, BackupItemStatus, - DatabaseType, - FrequencyUnit, BackupRestoreOperationType, + BuiltInAuthenticationProvider, + CloneAbilityResult, ConnectionStringType, ContinuousWebJobStatus, - WebJobType, - PublishingProfileFormat, - DnsVerificationTestResult, - AzureResourceType, CustomHostNameDnsRecordType, + DatabaseType, + DnsVerificationTestResult, + FrequencyUnit, HostNameType, - SslState, + HostType, + LogLevel, MSDeployLogEntryType, MSDeployProvisioningState, + ManagedPipelineMode, + ManagedServiceIdentityType, MySqlMigrationType, OperationStatus, - RouteType, PublicCertificateLocation, - UnauthenticatedClientAction, - BuiltInAuthenticationProvider, - CloneAbilityResult, + PublishingProfileFormat, + RouteType, ScmType, - ManagedPipelineMode, + SiteAvailabilityState, + SiteExtensionType, SiteLoadBalancing, - AutoHealActionType, + SslState, SupportedTlsVersions, - SiteExtensionType, - UsageState, - SiteAvailabilityState, - HostType, TriggeredWebJobStatus, - ManagedServiceIdentityType, - StatusOptions, - ProvisioningState, + UnauthenticatedClientAction, + UsageState, + WebJobType, ) __all__ = [ 'ApiDefinitionInfo', 'ApplicationLogsConfig', - 'AppServicePlan', 'AutoHealActions', 'AutoHealCustomAction', 'AutoHealRules', @@ -312,57 +323,68 @@ 'AzureBlobStorageHttpLogsConfig', 'AzureTableStorageApplicationLogsConfig', 'BackupItem', + 'BackupItemCollection', 'BackupRequest', 'BackupSchedule', - 'Capability', 'CloningInfo', - 'ConnectionStringDictionary', 'ConnStringInfo', 'ConnStringValueTypePair', + 'ConnectionStringDictionary', 'ContinuousWebJob', + 'ContinuousWebJobCollection', 'CorsSettings', 'CsmPublishingProfileOptions', 'CsmSlotEntity', 'CsmUsageQuota', + 'CsmUsageQuotaCollection', 'CustomHostnameAnalysisResult', 'DatabaseBackupSetting', 'Deployment', + 'DeploymentCollection', 'EnabledConfig', 'ErrorEntity', 'Experiments', 'FileSystemApplicationLogsConfig', 'FileSystemHttpLogsConfig', 'FunctionEnvelope', + 'FunctionEnvelopeCollection', 'FunctionSecrets', 'HandlerMapping', - 'HostingEnvironmentProfile', 'HostNameBinding', + 'HostNameBindingCollection', 'HostNameSslState', + 'HostingEnvironmentProfile', 'HttpLogsConfig', 'HybridConnection', 'HybridConnectionKey', 'Identifier', + 'IdentifierCollection', 'IpSecurityRestriction', 'LocalizableString', - 'ManagedServiceIdentity', - 'MigrateMySqlRequest', - 'MigrateMySqlStatus', 'MSDeploy', 'MSDeployLog', 'MSDeployLogEntry', 'MSDeployStatus', + 'ManagedServiceIdentity', + 'MigrateMySqlRequest', + 'MigrateMySqlStatus', 'NameValuePair', 'NetworkFeatures', 'Operation', + 'PerfMonCounterCollection', 'PerfMonResponse', 'PerfMonSample', 'PerfMonSet', 'PremierAddOn', 'ProcessInfo', + 'ProcessInfoCollection', 'ProcessModuleInfo', + 'ProcessModuleInfoCollection', 'ProcessThreadInfo', + 'ProcessThreadInfoCollection', 'ProxyOnlyResource', 'PublicCertificate', + 'PublicCertificateCollection', 'PushSettings', 'RampUpRule', 'RelayServiceConnectionEntity', @@ -370,7 +392,9 @@ 'Resource', 'ResourceMetric', 'ResourceMetricAvailability', + 'ResourceMetricCollection', 'ResourceMetricDefinition', + 'ResourceMetricDefinitionCollection', 'ResourceMetricName', 'ResourceMetricProperty', 'ResourceMetricValue', @@ -382,8 +406,11 @@ 'SiteCloneabilityCriterion', 'SiteConfig', 'SiteConfigResource', + 'SiteConfigResourceCollection', 'SiteConfigurationSnapshotInfo', + 'SiteConfigurationSnapshotInfoCollection', 'SiteExtensionInfo', + 'SiteExtensionInfoCollection', 'SiteInstance', 'SiteLimits', 'SiteLogsConfig', @@ -391,13 +418,13 @@ 'SitePatchResource', 'SitePhpErrorLogFlag', 'SiteSourceControl', - 'SkuCapacity', - 'SkuDescription', 'SlotConfigNamesResource', 'SlotDifference', + 'SlotDifferenceCollection', 'SlotSwapStatus', 'SlowRequestsBasedTrigger', 'Snapshot', + 'SnapshotCollection', 'SnapshotRecoveryRequest', 'SnapshotRecoveryTarget', 'StatusCodesBasedTrigger', @@ -405,73 +432,52 @@ 'StorageMigrationResponse', 'StringDictionary', 'TriggeredJobHistory', + 'TriggeredJobHistoryCollection', 'TriggeredJobRun', 'TriggeredWebJob', + 'TriggeredWebJobCollection', 'User', 'VirtualApplication', 'VirtualDirectory', 'VnetGateway', 'VnetInfo', 'VnetRoute', + 'WebAppCollection', + 'WebAppInstanceCollection', 'WebJob', - 'SitePaged', - 'BackupItemPaged', - 'SiteConfigResourcePaged', - 'SiteConfigurationSnapshotInfoPaged', - 'ContinuousWebJobPaged', - 'DeploymentPaged', - 'IdentifierPaged', - 'FunctionEnvelopePaged', - 'HostNameBindingPaged', - 'SiteInstancePaged', - 'ProcessInfoPaged', - 'ProcessModuleInfoPaged', - 'ProcessThreadInfoPaged', - 'ResourceMetricDefinitionPaged', - 'ResourceMetricPaged', - 'PerfMonResponsePaged', - 'PublicCertificatePaged', - 'SiteExtensionInfoPaged', - 'SlotDifferencePaged', - 'SnapshotPaged', - 'TriggeredWebJobPaged', - 'TriggeredJobHistoryPaged', - 'CsmUsageQuotaPaged', - 'WebJobPaged', - 'LogLevel', + 'WebJobCollection', + 'AutoHealActionType', + 'AzureResourceType', 'BackupItemStatus', - 'DatabaseType', - 'FrequencyUnit', 'BackupRestoreOperationType', + 'BuiltInAuthenticationProvider', + 'CloneAbilityResult', 'ConnectionStringType', 'ContinuousWebJobStatus', - 'WebJobType', - 'PublishingProfileFormat', - 'DnsVerificationTestResult', - 'AzureResourceType', 'CustomHostNameDnsRecordType', + 'DatabaseType', + 'DnsVerificationTestResult', + 'FrequencyUnit', 'HostNameType', - 'SslState', + 'HostType', + 'LogLevel', 'MSDeployLogEntryType', 'MSDeployProvisioningState', + 'ManagedPipelineMode', + 'ManagedServiceIdentityType', 'MySqlMigrationType', 'OperationStatus', - 'RouteType', 'PublicCertificateLocation', - 'UnauthenticatedClientAction', - 'BuiltInAuthenticationProvider', - 'CloneAbilityResult', + 'PublishingProfileFormat', + 'RouteType', 'ScmType', - 'ManagedPipelineMode', + 'SiteAvailabilityState', + 'SiteExtensionType', 'SiteLoadBalancing', - 'AutoHealActionType', + 'SslState', 'SupportedTlsVersions', - 'SiteExtensionType', - 'UsageState', - 'SiteAvailabilityState', - 'HostType', 'TriggeredWebJobStatus', - 'ManagedServiceIdentityType', - 'StatusOptions', - 'ProvisioningState', + 'UnauthenticatedClientAction', + 'UsageState', + 'WebJobType', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models.py index ce459a9f4c48..1aa1dbe11b02 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models.py @@ -1,18 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import msrest.serialization -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -23,19 +20,20 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = kwargs.get('url', None) -class ApplicationLogsConfig(Model): +class ApplicationLogsConfig(msrest.serialization.Model): """Application logs configuration. :param file_system: Application logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2016_08_01.models.FileSystemApplicationLogsConfig - :param azure_table_storage: Application logs to azure table storage - configuration. + :type file_system: ~azure.mgmt.web.v2016_08_01.models.FileSystemApplicationLogsConfig + :param azure_table_storage: Application logs to azure table storage configuration. :type azure_table_storage: ~azure.mgmt.web.v2016_08_01.models.AzureTableStorageApplicationLogsConfig :param azure_blob_storage: Application logs to blob storage configuration. @@ -49,228 +47,48 @@ class ApplicationLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageApplicationLogsConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationLogsConfig, self).__init__(**kwargs) self.file_system = kwargs.get('file_system', None) self.azure_table_storage = kwargs.get('azure_table_storage', None) self.azure_blob_storage = kwargs.get('azure_blob_storage', None) -class Resource(Model): - """Azure resource. This resource is tracked in Azure Resource Manager. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) - self.type = None - self.tags = kwargs.get('tags', None) - - -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2016_08_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param admin_site_name: App Service plan administration site. - :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_08_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2016_08_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, **kwargs): - super(AppServicePlan, self).__init__(**kwargs) - self.app_service_plan_name = kwargs.get('app_service_plan_name', None) - self.worker_tier_name = kwargs.get('worker_tier_name', None) - self.status = None - self.subscription = None - self.admin_site_name = kwargs.get('admin_site_name', None) - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = kwargs.get('per_site_scaling', False) - self.number_of_sites = None - self.is_spot = kwargs.get('is_spot', None) - self.spot_expiration_time = kwargs.get('spot_expiration_time', None) - self.resource_group = None - self.reserved = kwargs.get('reserved', False) - self.target_worker_count = kwargs.get('target_worker_count', None) - self.target_worker_size_id = kwargs.get('target_worker_size_id', None) - self.provisioning_state = None - self.sku = kwargs.get('sku', None) - - -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2016_08_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2016_08_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2016_08_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2016_08_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) self.custom_action = kwargs.get('custom_action', None) self.min_process_execution_time = kwargs.get('min_process_execution_time', None) -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -283,17 +101,19 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = kwargs.get('exe', None) self.parameters = kwargs.get('parameters', None) -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2016_08_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2016_08_01.models.AutoHealActions @@ -304,13 +124,16 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = kwargs.get('triggers', None) self.actions = kwargs.get('actions', None) -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -318,11 +141,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2016_08_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2016_08_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2016_08_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2016_08_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -332,7 +153,10 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = kwargs.get('requests', None) self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) @@ -340,14 +164,13 @@ def __init__(self, **kwargs): self.slow_requests = kwargs.get('slow_requests', None) -class AzureBlobStorageApplicationLogsConfig(Model): +class AzureBlobStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs azure blob storage configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2016_08_01.models.LogLevel - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. @@ -356,30 +179,32 @@ class AzureBlobStorageApplicationLogsConfig(Model): """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureBlobStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = kwargs.get('level', None) self.sas_url = kwargs.get('sas_url', None) self.retention_in_days = kwargs.get('retention_in_days', None) -class AzureBlobStorageHttpLogsConfig(Model): +class AzureBlobStorageHttpLogsConfig(msrest.serialization.Model): """Http logs to azure blob storage configuration. - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -389,23 +214,25 @@ class AzureBlobStorageHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureBlobStorageHttpLogsConfig, self).__init__(**kwargs) self.sas_url = kwargs.get('sas_url', None) self.retention_in_days = kwargs.get('retention_in_days', None) self.enabled = kwargs.get('enabled', None) -class AzureTableStorageApplicationLogsConfig(Model): +class AzureTableStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs to Azure table storage configuration. All required parameters must be populated in order to send to Azure. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2016_08_01.models.LogLevel - :param sas_url: Required. SAS URL to an Azure table with add/query/delete - permissions. + :param sas_url: Required. SAS URL to an Azure table with add/query/delete permissions. :type sas_url: str """ @@ -414,22 +241,23 @@ class AzureTableStorageApplicationLogsConfig(Model): } _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureTableStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = kwargs.get('level', None) - self.sas_url = kwargs.get('sas_url', None) + self.sas_url = kwargs['sas_url'] -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -454,7 +282,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -465,8 +296,7 @@ def __init__(self, **kwargs): class BackupItem(ProxyOnlyResource): """Backup description. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -478,40 +308,35 @@ class BackupItem(ProxyOnlyResource): :vartype type: str :ivar backup_id: Id of the backup. :vartype backup_id: int - :ivar storage_account_url: SAS URL for the storage account container which - contains this backup. + :ivar storage_account_url: SAS URL for the storage account container which contains this + backup. :vartype storage_account_url: str :ivar blob_name: Name of the blob which contains data for this backup. :vartype blob_name: str - :ivar backup_item_name: Name of this backup. - :vartype backup_item_name: str - :ivar status: Backup status. Possible values include: 'InProgress', - 'Failed', 'Succeeded', 'TimedOut', 'Created', 'Skipped', - 'PartiallySucceeded', 'DeleteInProgress', 'DeleteFailed', 'Deleted' - :vartype status: str or - ~azure.mgmt.web.v2016_08_01.models.BackupItemStatus + :ivar name_properties_name: Name of this backup. + :vartype name_properties_name: str + :ivar status: Backup status. Possible values include: "InProgress", "Failed", "Succeeded", + "TimedOut", "Created", "Skipped", "PartiallySucceeded", "DeleteInProgress", "DeleteFailed", + "Deleted". + :vartype status: str or ~azure.mgmt.web.v2016_08_01.models.BackupItemStatus :ivar size_in_bytes: Size of the backup in bytes. :vartype size_in_bytes: long :ivar created: Timestamp of the backup creation. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar log: Details regarding this backup. Might contain an error message. :vartype log: str :ivar databases: List of databases included in the backup. - :vartype databases: - list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] - :ivar scheduled: True if this backup has been created due to a schedule - being triggered. + :vartype databases: list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] + :ivar scheduled: True if this backup has been created due to a schedule being triggered. :vartype scheduled: bool - :ivar last_restore_time_stamp: Timestamp of a last restore operation which - used this backup. - :vartype last_restore_time_stamp: datetime + :ivar last_restore_time_stamp: Timestamp of a last restore operation which used this backup. + :vartype last_restore_time_stamp: ~datetime.datetime :ivar finished_time_stamp: Timestamp when this backup finished. - :vartype finished_time_stamp: datetime - :ivar correlation_id: Unique correlation identifier. Please use this along - with the timestamp while communicating with Azure support. + :vartype finished_time_stamp: ~datetime.datetime + :ivar correlation_id: Unique correlation identifier. Please use this along with the timestamp + while communicating with Azure support. :vartype correlation_id: str - :ivar website_size_in_bytes: Size of the original web app which has been - backed up. + :ivar website_size_in_bytes: Size of the original web app which has been backed up. :vartype website_size_in_bytes: long """ @@ -522,7 +347,7 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'readonly': True}, 'storage_account_url': {'readonly': True}, 'blob_name': {'readonly': True}, - 'backup_item_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'status': {'readonly': True}, 'size_in_bytes': {'readonly': True}, 'created': {'readonly': True}, @@ -543,8 +368,8 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'key': 'properties.id', 'type': 'int'}, 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'blob_name': {'key': 'properties.blobName', 'type': 'str'}, - 'backup_item_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'BackupItemStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, 'created': {'key': 'properties.created', 'type': 'iso-8601'}, 'log': {'key': 'properties.log', 'type': 'str'}, @@ -556,12 +381,15 @@ class BackupItem(ProxyOnlyResource): 'website_size_in_bytes': {'key': 'properties.websiteSizeInBytes', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupItem, self).__init__(**kwargs) self.backup_id = None self.storage_account_url = None self.blob_name = None - self.backup_item_name = None + self.name_properties_name = None self.status = None self.size_in_bytes = None self.created = None @@ -574,14 +402,43 @@ def __init__(self, **kwargs): self.website_size_in_bytes = None -class BackupRequest(ProxyOnlyResource): - """Description of a backup which will be performed. +class BackupItemCollection(msrest.serialization.Model): + """Collection of backup items. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.BackupItem] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BackupItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BackupItemCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class BackupRequest(ProxyOnlyResource): + """Description of a backup which will be performed. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -590,22 +447,20 @@ class BackupRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param backup_request_name: Required. Name of the backup. + :param backup_request_name: Name of the backup. :type backup_request_name: str - :param enabled: True if the backup schedule is enabled (must be included - in that case), false if the backup schedule should be disabled. + :param enabled: True if the backup schedule is enabled (must be included in that case), false + if the backup schedule should be disabled. :type enabled: bool - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str - :param backup_schedule: Schedule for the backup if it is executed - periodically. + :param backup_schedule: Schedule for the backup if it is executed periodically. :type backup_schedule: ~azure.mgmt.web.v2016_08_01.models.BackupSchedule :param databases: Databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] - :param backup_request_type: Type of the backup. Possible values include: - 'Default', 'Clone', 'Relocation', 'Snapshot' - :type backup_request_type: str or + :type databases: list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] + :param type_properties_type: Type of the backup. Possible values include: "Default", "Clone", + "Relocation", "Snapshot". + :type type_properties_type: str or ~azure.mgmt.web.v2016_08_01.models.BackupRestoreOperationType """ @@ -613,8 +468,6 @@ class BackupRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'backup_request_name': {'required': True}, - 'storage_account_url': {'required': True}, } _attribute_map = { @@ -627,49 +480,45 @@ class BackupRequest(ProxyOnlyResource): 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'backup_schedule': {'key': 'properties.backupSchedule', 'type': 'BackupSchedule'}, 'databases': {'key': 'properties.databases', 'type': '[DatabaseBackupSetting]'}, - 'backup_request_type': {'key': 'properties.type', 'type': 'BackupRestoreOperationType'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupRequest, self).__init__(**kwargs) self.backup_request_name = kwargs.get('backup_request_name', None) self.enabled = kwargs.get('enabled', None) self.storage_account_url = kwargs.get('storage_account_url', None) self.backup_schedule = kwargs.get('backup_schedule', None) self.databases = kwargs.get('databases', None) - self.backup_request_type = kwargs.get('backup_request_type', None) + self.type_properties_type = kwargs.get('type_properties_type', None) -class BackupSchedule(Model): - """Description of a backup schedule. Describes how often should be the backup - performed and what should be the retention policy. +class BackupSchedule(msrest.serialization.Model): + """Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param frequency_interval: Required. How often the backup should be - executed (e.g. for weekly backup, this should be set to 7 and - FrequencyUnit should be set to Day). Default value: 7 . + :param frequency_interval: Required. How often the backup should be executed (e.g. for weekly + backup, this should be set to 7 and FrequencyUnit should be set to Day). :type frequency_interval: int - :param frequency_unit: Required. The unit of time for how often the backup - should be executed (e.g. for weekly backup, this should be set to Day and - FrequencyInterval should be set to 7). Possible values include: 'Day', - 'Hour'. Default value: "Day" . - :type frequency_unit: str or - ~azure.mgmt.web.v2016_08_01.models.FrequencyUnit - :param keep_at_least_one_backup: Required. True if the retention policy - should always keep at least one backup in the storage account, regardless - how old it is; false otherwise. Default value: True . + :param frequency_unit: Required. The unit of time for how often the backup should be executed + (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). + Possible values include: "Day", "Hour". Default value: "Day". + :type frequency_unit: str or ~azure.mgmt.web.v2016_08_01.models.FrequencyUnit + :param keep_at_least_one_backup: Required. True if the retention policy should always keep at + least one backup in the storage account, regardless how old it is; false otherwise. :type keep_at_least_one_backup: bool - :param retention_period_in_days: Required. After how many days backups - should be deleted. Default value: 30 . + :param retention_period_in_days: Required. After how many days backups should be deleted. :type retention_period_in_days: int :param start_time: When the schedule should start working. - :type start_time: datetime + :type start_time: ~datetime.datetime :ivar last_execution_time: Last time when this schedule was triggered. - :vartype last_execution_time: datetime + :vartype last_execution_time: ~datetime.datetime """ _validation = { @@ -682,14 +531,17 @@ class BackupSchedule(Model): _attribute_map = { 'frequency_interval': {'key': 'frequencyInterval', 'type': 'int'}, - 'frequency_unit': {'key': 'frequencyUnit', 'type': 'FrequencyUnit'}, + 'frequency_unit': {'key': 'frequencyUnit', 'type': 'str'}, 'keep_at_least_one_backup': {'key': 'keepAtLeastOneBackup', 'type': 'bool'}, 'retention_period_in_days': {'key': 'retentionPeriodInDays', 'type': 'int'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupSchedule, self).__init__(**kwargs) self.frequency_interval = kwargs.get('frequency_interval', 7) self.frequency_unit = kwargs.get('frequency_unit', "Day") @@ -699,75 +551,49 @@ def __init__(self, **kwargs): self.last_execution_time = None -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Capability, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - self.reason = kwargs.get('reason', None) - - -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. + :param ignore_quotas: :code:`true` if quotas should be ignored; otherwise, + :code:`false`. :type ignore_quotas: bool """ @@ -789,13 +615,16 @@ class CloningInfo(Model): 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = kwargs.get('correlation_id', None) self.overwrite = kwargs.get('overwrite', None) self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) + self.source_web_app_id = kwargs['source_web_app_id'] self.hosting_environment = kwargs.get('hosting_environment', None) self.app_settings_overrides = kwargs.get('app_settings_overrides', None) self.configure_load_balancing = kwargs.get('configure_load_balancing', None) @@ -804,19 +633,10 @@ def __init__(self, **kwargs): self.ignore_quotas = kwargs.get('ignore_quotas', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class ConnectionStringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -827,8 +647,7 @@ class ConnectionStringDictionary(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2016_08_01.models.ConnStringValueTypePair] + :type properties: dict[str, ~azure.mgmt.web.v2016_08_01.models.ConnStringValueTypePair] """ _validation = { @@ -845,47 +664,53 @@ class ConnectionStringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{ConnStringValueTypePair}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnectionStringDictionary, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_08_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.connection_string = kwargs.get('connection_string', None) self.type = kwargs.get('type', None) -class ConnStringValueTypePair(Model): +class ConnStringValueTypePair(msrest.serialization.Model): """Database connection string value to type pair. All required parameters must be populated in order to send to Azure. :param value: Required. Value of pair. :type value: str - :param type: Required. Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Required. Type of database. Possible values include: "MySql", "SQLServer", + "SQLAzure", "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", + "RedisCache", "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_08_01.models.ConnectionStringType """ @@ -896,20 +721,22 @@ class ConnStringValueTypePair(Model): _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringValueTypePair, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = kwargs.get('type', None) + self.value = kwargs['value'] + self.type = kwargs['type'] class ContinuousWebJob(ProxyOnlyResource): """Continuous Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -919,29 +746,26 @@ class ContinuousWebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param status: Job status. Possible values include: 'Initializing', - 'Starting', 'Running', 'PendingRestart', 'Stopped' - :type status: str or - ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobStatus + :param status: Job status. Possible values include: "Initializing", "Starting", "Running", + "PendingRestart", "Stopped". + :type status: str or ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobStatus :param detailed_status: Detailed status. :type detailed_status: str :param log_url: Log URL. :type log_url: str - :ivar continuous_web_job_name: Job name. Used as job identifier in ARM - resource URI. - :vartype continuous_web_job_name: str + :ivar name_properties_name: Job name. Used as job identifier in ARM resource URI. + :vartype name_properties_name: str :param run_command: Run command. :type run_command: str :param url: Job URL. :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param job_type: Job type. Possible values include: "Continuous", "Triggered". :type job_type: str or ~azure.mgmt.web.v2016_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -951,7 +775,7 @@ class ContinuousWebJob(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'continuous_web_job_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -959,25 +783,28 @@ class ContinuousWebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ContinuousWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'detailed_status': {'key': 'properties.detailedStatus', 'type': 'str'}, 'log_url': {'key': 'properties.logUrl', 'type': 'str'}, - 'continuous_web_job_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'run_command': {'key': 'properties.runCommand', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extraInfoUrl', 'type': 'str'}, - 'job_type': {'key': 'properties.jobType', 'type': 'WebJobType'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.usingSdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContinuousWebJob, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.detailed_status = kwargs.get('detailed_status', None) self.log_url = kwargs.get('log_url', None) - self.continuous_web_job_name = None + self.name_properties_name = None self.run_command = kwargs.get('run_command', None) self.url = kwargs.get('url', None) self.extra_info_url = kwargs.get('extra_info_url', None) @@ -987,11 +814,40 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) -class CorsSettings(Model): +class ContinuousWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob] + :param next_link: Link to next page of resources. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContinuousWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ContinuousWebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] """ @@ -1000,41 +856,45 @@ class CorsSettings(Model): 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = kwargs.get('allowed_origins', None) -class CsmPublishingProfileOptions(Model): +class CsmPublishingProfileOptions(msrest.serialization.Model): """Publishing options for requested profile. :param format: Name of the format. Valid values are: FileZilla3 WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2016_08_01.models.PublishingProfileFormat + Ftp. Possible values include: "FileZilla3", "WebDeploy", "Ftp". + :type format: str or ~azure.mgmt.web.v2016_08_01.models.PublishingProfileFormat """ _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmPublishingProfileOptions, self).__init__(**kwargs) self.format = kwargs.get('format', None) -class CsmSlotEntity(Model): +class CsmSlotEntity(msrest.serialization.Model): """Deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during swap - operation. + :param target_slot: Required. Destination deployment slot during swap operation. :type target_slot: str - :param preserve_vnet: Required. true to preserve Virtual - Network to the slot during swap; otherwise, false. + :param preserve_vnet: Required. :code:`true` to preserve Virtual Network to the + slot during swap; otherwise, :code:`false`. :type preserve_vnet: bool """ @@ -1048,19 +908,22 @@ class CsmSlotEntity(Model): 'preserve_vnet': {'key': 'preserveVnet', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmSlotEntity, self).__init__(**kwargs) - self.target_slot = kwargs.get('target_slot', None) - self.preserve_vnet = kwargs.get('preserve_vnet', None) + self.target_slot = kwargs['target_slot'] + self.preserve_vnet = kwargs['preserve_vnet'] -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -1077,7 +940,10 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = kwargs.get('unit', None) self.next_reset_time = kwargs.get('next_reset_time', None) @@ -1086,11 +952,42 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class CustomHostnameAnalysisResult(ProxyOnlyResource): """Custom domain analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1100,25 +997,25 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar is_hostname_already_verified: true if hostname is - already verified; otherwise, false. + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. - Possible values include: 'Passed', 'Failed', 'Skipped' + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.web.v2016_08_01.models.DnsVerificationTestResult - :ivar custom_domain_verification_failure_info: Raw failure information if - DNS verification fails. + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. :vartype custom_domain_verification_failure_info: ~azure.mgmt.web.v2016_08_01.models.ErrorEntity - :ivar has_conflict_on_scale_unit: true if there is a conflict - on a scale unit; otherwise, false. + :ivar has_conflict_on_scale_unit: :code:`true` if there is a conflict on a scale + unit; otherwise, :code:`false`. :vartype has_conflict_on_scale_unit: bool - :ivar has_conflict_across_subscription: true if there is a - conflict across subscriptions; otherwise, false. + :ivar has_conflict_across_subscription: :code:`true` if there is a conflict across + subscriptions; otherwise, :code:`false`. :vartype has_conflict_across_subscription: bool - :ivar conflicting_app_resource_id: Name of the conflicting app on scale - unit if it's within the same subscription. + :ivar conflicting_app_resource_id: Name of the conflicting app on scale unit if it's within the + same subscription. :vartype conflicting_app_resource_id: str :param c_name_records: CName records controller can see for this hostname. :type c_name_records: list[str] @@ -1126,11 +1023,9 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type txt_records: list[str] :param a_records: A records controller can see for this hostname. :type a_records: list[str] - :param alternate_cname_records: Alternate CName records controller can see - for this hostname. - :type alternate_cname_records: list[str] - :param alternate_txt_records: Alternate TXT records controller can see for - this hostname. + :param alternate_c_name_records: Alternate CName records controller can see for this hostname. + :type alternate_c_name_records: list[str] + :param alternate_txt_records: Alternate TXT records controller can see for this hostname. :type alternate_txt_records: list[str] """ @@ -1152,7 +1047,7 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'DnsVerificationTestResult'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'ErrorEntity'}, 'has_conflict_on_scale_unit': {'key': 'properties.hasConflictOnScaleUnit', 'type': 'bool'}, 'has_conflict_across_subscription': {'key': 'properties.hasConflictAcrossSubscription', 'type': 'bool'}, @@ -1160,11 +1055,14 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_cname_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomHostnameAnalysisResult, self).__init__(**kwargs) self.is_hostname_already_verified = None self.custom_domain_verification_test = None @@ -1175,28 +1073,27 @@ def __init__(self, **kwargs): self.c_name_records = kwargs.get('c_name_records', None) self.txt_records = kwargs.get('txt_records', None) self.a_records = kwargs.get('a_records', None) - self.alternate_cname_records = kwargs.get('alternate_cname_records', None) + self.alternate_c_name_records = kwargs.get('alternate_c_name_records', None) self.alternate_txt_records = kwargs.get('alternate_txt_records', None) -class DatabaseBackupSetting(Model): +class DatabaseBackupSetting(msrest.serialization.Model): """Database backup settings. All required parameters must be populated in order to send to Azure. - :param database_type: Required. Database type (e.g. SqlAzure / MySql). - Possible values include: 'SqlAzure', 'MySql', 'LocalMySql', 'PostgreSql' - :type database_type: str or - ~azure.mgmt.web.v2016_08_01.models.DatabaseType + :param database_type: Required. Database type (e.g. SqlAzure / MySql). Possible values include: + "SqlAzure", "MySql", "LocalMySql", "PostgreSql". + :type database_type: str or ~azure.mgmt.web.v2016_08_01.models.DatabaseType :param name: :type name: str - :param connection_string_name: Contains a connection string name that is - linked to the SiteConfig.ConnectionStrings. + :param connection_string_name: Contains a connection string name that is linked to the + SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. :type connection_string_name: str - :param connection_string: Contains a connection string to a database which - is being backed up or restored. If the restore should happen to a new - database, the database name inside is the new one. + :param connection_string: Contains a connection string to a database which is being backed up + or restored. If the restore should happen to a new database, the database name inside is the + new one. :type connection_string: str """ @@ -1211,9 +1108,12 @@ class DatabaseBackupSetting(Model): 'connection_string': {'key': 'connectionString', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DatabaseBackupSetting, self).__init__(**kwargs) - self.database_type = kwargs.get('database_type', None) + self.database_type = kwargs['database_type'] self.name = kwargs.get('name', None) self.connection_string_name = kwargs.get('connection_string_name', None) self.connection_string = kwargs.get('connection_string', None) @@ -1222,8 +1122,7 @@ def __init__(self, **kwargs): class Deployment(ProxyOnlyResource): """User credentials used for publishing activity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1233,8 +1132,8 @@ class Deployment(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param deployment_id: Identifier for deployment. - :type deployment_id: str + :param id_properties_id: Identifier for deployment. + :type id_properties_id: str :param status: Deployment status. :type status: int :param message: Details about deployment status. @@ -1246,11 +1145,11 @@ class Deployment(ProxyOnlyResource): :param author_email: Author email. :type author_email: str :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime - :param active: True if deployment is currently active, false if completed - and null if not started. + :type end_time: ~datetime.datetime + :param active: True if deployment is currently active, false if completed and null if not + started. :type active: bool :param details: Details on deployment. :type details: str @@ -1267,7 +1166,7 @@ class Deployment(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'deployment_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'int'}, 'message': {'key': 'properties.message', 'type': 'str'}, 'author': {'key': 'properties.author', 'type': 'str'}, @@ -1279,9 +1178,12 @@ class Deployment(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Deployment, self).__init__(**kwargs) - self.deployment_id = kwargs.get('deployment_id', None) + self.id_properties_id = kwargs.get('id_properties_id', None) self.status = kwargs.get('status', None) self.message = kwargs.get('message', None) self.author = kwargs.get('author', None) @@ -1293,11 +1195,43 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class EnabledConfig(Model): +class DeploymentCollection(msrest.serialization.Model): + """Collection of app deployments. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Deployment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Deployment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class EnabledConfig(msrest.serialization.Model): """Enabled configuration. - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -1305,12 +1239,15 @@ class EnabledConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EnabledConfig, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -1336,7 +1273,10 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = kwargs.get('extended_code', None) self.message_template = kwargs.get('message_template', None) @@ -1346,7 +1286,7 @@ def __init__(self, **kwargs): self.message = kwargs.get('message', None) -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -1357,33 +1297,38 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = kwargs.get('ramp_up_rules', None) -class FileSystemApplicationLogsConfig(Model): +class FileSystemApplicationLogsConfig(msrest.serialization.Model): """Application logs to file system configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error'. Default value: "Off" . + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2016_08_01.models.LogLevel """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FileSystemApplicationLogsConfig, self).__init__(**kwargs) - self.level = kwargs.get('level', "Off") + self.level = kwargs.get('level', None) -class FileSystemHttpLogsConfig(Model): +class FileSystemHttpLogsConfig(msrest.serialization.Model): """Http logs to file system configuration. - :param retention_in_mb: Maximum size in megabytes that http log files can - use. + :param retention_in_mb: Maximum size in megabytes that http log files can use. When reached old log files will be removed to make space for new ones. Value can range between 25 and 100. :type retention_in_mb: int @@ -1391,8 +1336,8 @@ class FileSystemHttpLogsConfig(Model): Remove files older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -1406,7 +1351,10 @@ class FileSystemHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FileSystemHttpLogsConfig, self).__init__(**kwargs) self.retention_in_mb = kwargs.get('retention_in_mb', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -1416,8 +1364,7 @@ def __init__(self, **kwargs): class FunctionEnvelope(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1427,8 +1374,8 @@ class FunctionEnvelope(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar function_envelope_name: Function name. - :vartype function_envelope_name: str + :ivar name_properties_name: Function name. + :vartype name_properties_name: str :ivar function_app_id: Function App ID. :vartype function_app_id: str :param script_root_path_href: Script root path URI. @@ -1453,7 +1400,7 @@ class FunctionEnvelope(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'function_envelope_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'function_app_id': {'readonly': True}, } @@ -1462,7 +1409,7 @@ class FunctionEnvelope(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'function_envelope_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'function_app_id': {'key': 'properties.functionAppId', 'type': 'str'}, 'script_root_path_href': {'key': 'properties.scriptRootPathHref', 'type': 'str'}, 'script_href': {'key': 'properties.scriptHref', 'type': 'str'}, @@ -1474,9 +1421,12 @@ class FunctionEnvelope(ProxyOnlyResource): 'test_data': {'key': 'properties.testData', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FunctionEnvelope, self).__init__(**kwargs) - self.function_envelope_name = None + self.name_properties_name = None self.function_app_id = None self.script_root_path_href = kwargs.get('script_root_path_href', None) self.script_href = kwargs.get('script_href', None) @@ -1488,11 +1438,42 @@ def __init__(self, **kwargs): self.test_data = kwargs.get('test_data', None) +class FunctionEnvelopeCollection(msrest.serialization.Model): + """Collection of Kudu function information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FunctionEnvelopeCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class FunctionSecrets(ProxyOnlyResource): """Function secrets. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1523,25 +1504,25 @@ class FunctionSecrets(ProxyOnlyResource): 'trigger_url': {'key': 'properties.triggerUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FunctionSecrets, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.trigger_url = kwargs.get('trigger_url', None) -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -1551,18 +1532,20 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = kwargs.get('extension', None) self.script_processor = kwargs.get('script_processor', None) self.arguments = kwargs.get('arguments', None) -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -1583,7 +1566,10 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None @@ -1593,8 +1579,7 @@ def __init__(self, **kwargs): class HostNameBinding(ProxyOnlyResource): """A hostname binding object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1610,25 +1595,21 @@ class HostNameBinding(ProxyOnlyResource): :type domain_id: str :param azure_resource_name: Azure resource name. :type azure_resource_name: str - :param azure_resource_type: Azure resource type. Possible values include: - 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2016_08_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Custom DNS record type. Possible - values include: 'CName', 'A' + :param azure_resource_type: Azure resource type. Possible values include: "Website", + "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2016_08_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Custom DNS record type. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2016_08_01.models.CustomHostNameDnsRecordType - :param host_name_type: Hostname type. Possible values include: 'Verified', - 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2016_08_01.models.HostNameType - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param host_name_type: Hostname type. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2016_08_01.models.HostNameType + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_08_01.models.SslState - :param thumbprint: SSL certificate thumbprint + :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :vartype virtual_ip: str """ @@ -1647,15 +1628,18 @@ class HostNameBinding(ProxyOnlyResource): 'site_name': {'key': 'properties.siteName', 'type': 'str'}, 'domain_id': {'key': 'properties.domainId', 'type': 'str'}, 'azure_resource_name': {'key': 'properties.azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'properties.hostNameType', 'type': 'HostNameType'}, - 'ssl_state': {'key': 'properties.sslState', 'type': 'SslState'}, + 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'properties.hostNameType', 'type': 'str'}, + 'ssl_state': {'key': 'properties.sslState', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'virtual_ip': {'key': 'properties.virtualIP', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameBinding, self).__init__(**kwargs) self.site_name = kwargs.get('site_name', None) self.domain_id = kwargs.get('domain_id', None) @@ -1668,36 +1652,70 @@ def __init__(self, **kwargs): self.virtual_ip = None -class HostNameSslState(Model): +class HostNameBindingCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.HostNameBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostNameBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostNameBindingCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_08_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2016_08_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.ssl_state = kwargs.get('ssl_state', None) @@ -1707,15 +1725,13 @@ def __init__(self, **kwargs): self.host_type = kwargs.get('host_type', None) -class HttpLogsConfig(Model): +class HttpLogsConfig(msrest.serialization.Model): """Http logs configuration. :param file_system: Http logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2016_08_01.models.FileSystemHttpLogsConfig + :type file_system: ~azure.mgmt.web.v2016_08_01.models.FileSystemHttpLogsConfig :param azure_blob_storage: Http logs to azure blob storage configuration. - :type azure_blob_storage: - ~azure.mgmt.web.v2016_08_01.models.AzureBlobStorageHttpLogsConfig + :type azure_blob_storage: ~azure.mgmt.web.v2016_08_01.models.AzureBlobStorageHttpLogsConfig """ _attribute_map = { @@ -1723,7 +1739,10 @@ class HttpLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageHttpLogsConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HttpLogsConfig, self).__init__(**kwargs) self.file_system = kwargs.get('file_system', None) self.azure_blob_storage = kwargs.get('azure_blob_storage', None) @@ -1732,8 +1751,7 @@ def __init__(self, **kwargs): class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1753,15 +1771,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -1786,7 +1804,10 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnection, self).__init__(**kwargs) self.service_bus_namespace = kwargs.get('service_bus_namespace', None) self.relay_name = kwargs.get('relay_name', None) @@ -1799,11 +1820,9 @@ def __init__(self, **kwargs): class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1836,7 +1855,10 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionKey, self).__init__(**kwargs) self.send_key_name = None self.send_key_value = None @@ -1845,8 +1867,7 @@ def __init__(self, **kwargs): class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1856,8 +1877,8 @@ class Identifier(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str + :param id_properties_id: String representation of the identity. + :type id_properties_id: str """ _validation = { @@ -1871,24 +1892,57 @@ class Identifier(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) + self.id_properties_id = kwargs.get('id_properties_id', None) + + +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + def __init__( + self, + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class IpSecurityRestriction(Model): + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP address the security restriction is valid - for. + :param ip_address: Required. IP address the security restriction is valid for. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str """ @@ -1901,13 +1955,16 @@ class IpSecurityRestriction(Model): 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = kwargs.get('ip_address', None) + self.ip_address = kwargs['ip_address'] self.subnet_mask = kwargs.get('subnet_mask', None) -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -1921,22 +1978,22 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned". + :type type: str or ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. @@ -1954,7 +2011,10 @@ class ManagedServiceIdentity(Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.tenant_id = None @@ -1964,10 +2024,7 @@ def __init__(self, **kwargs): class MigrateMySqlRequest(ProxyOnlyResource): """MySQL migration request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1977,21 +2034,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param connection_string: Required. Connection string to the remote MySQL - database. + :param connection_string: Connection string to the remote MySQL database. :type connection_string: str - :param migration_type: Required. The type of migration operation to be - done. Possible values include: 'LocalToRemote', 'RemoteToLocal' - :type migration_type: str or - ~azure.mgmt.web.v2016_08_01.models.MySqlMigrationType + :param migration_type: The type of migration operation to be done. Possible values include: + "LocalToRemote", "RemoteToLocal". + :type migration_type: str or ~azure.mgmt.web.v2016_08_01.models.MySqlMigrationType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'connection_string': {'required': True}, - 'migration_type': {'required': True}, } _attribute_map = { @@ -2000,10 +2053,13 @@ class MigrateMySqlRequest(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'migration_type': {'key': 'properties.migrationType', 'type': 'MySqlMigrationType'}, + 'migration_type': {'key': 'properties.migrationType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MigrateMySqlRequest, self).__init__(**kwargs) self.connection_string = kwargs.get('connection_string', None) self.migration_type = kwargs.get('migration_type', None) @@ -2012,8 +2068,7 @@ def __init__(self, **kwargs): class MigrateMySqlStatus(ProxyOnlyResource): """MySQL migration status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2023,13 +2078,12 @@ class MigrateMySqlStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar migration_operation_status: Status of the migration task. Possible - values include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' - :vartype migration_operation_status: str or - ~azure.mgmt.web.v2016_08_01.models.OperationStatus + :ivar migration_operation_status: Status of the migration task. Possible values include: + "InProgress", "Failed", "Succeeded", "TimedOut", "Created". + :vartype migration_operation_status: str or ~azure.mgmt.web.v2016_08_01.models.OperationStatus :ivar operation_id: Operation ID for the migration task. :vartype operation_id: str - :ivar local_my_sql_enabled: True if the web app has in app MySql enabled + :ivar local_my_sql_enabled: True if the web app has in app MySql enabled. :vartype local_my_sql_enabled: bool """ @@ -2047,12 +2101,15 @@ class MigrateMySqlStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'OperationStatus'}, + 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'str'}, 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, 'local_my_sql_enabled': {'key': 'properties.localMySqlEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MigrateMySqlStatus, self).__init__(**kwargs) self.migration_operation_status = None self.operation_id = None @@ -2062,8 +2119,7 @@ def __init__(self, **kwargs): class MSDeploy(ProxyOnlyResource): """MSDeploy ARM PUT information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2073,29 +2129,24 @@ class MSDeploy(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param package_uri: Package URI + :param package_uri: Package URI. :type package_uri: str - :param connection_string: SQL Connection String + :param connection_string: SQL Connection String. :type connection_string: str - :param db_type: Database Type + :param db_type: Database Type. :type db_type: str - :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must - not be set if SetParameters is used. + :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must not be set if + SetParameters is used. :type set_parameters_xml_file_uri: str - :param set_parameters: MSDeploy Parameters. Must not be set if - SetParametersXmlFileUri is used. + :param set_parameters: MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. :type set_parameters: dict[str, str] - :param skip_app_data: Controls whether the MSDeploy operation skips the - App_Data directory. - If set to true, the existing App_Data directory on the - destination - will not be deleted, and any App_Data directory in the source will be - ignored. - Setting is false by default. + :param skip_app_data: Controls whether the MSDeploy operation skips the App_Data directory. + If set to :code:`true`, the existing App_Data directory on the destination + will not be deleted, and any App_Data directory in the source will be ignored. + Setting is :code:`false` by default. :type skip_app_data: bool - :param app_offline: Sets the AppOffline rule while the MSDeploy operation - executes. - Setting is false by default. + :param app_offline: Sets the AppOffline rule while the MSDeploy operation executes. + Setting is :code:`false` by default. :type app_offline: bool """ @@ -2119,7 +2170,10 @@ class MSDeploy(ProxyOnlyResource): 'app_offline': {'key': 'properties.appOffline', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeploy, self).__init__(**kwargs) self.package_uri = kwargs.get('package_uri', None) self.connection_string = kwargs.get('connection_string', None) @@ -2133,8 +2187,7 @@ def __init__(self, **kwargs): class MSDeployLog(ProxyOnlyResource): """MSDeploy log. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2144,9 +2197,8 @@ class MSDeployLog(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar entries: List of log entry messages - :vartype entries: - list[~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntry] + :ivar entries: List of log entry messages. + :vartype entries: list[~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntry] """ _validation = { @@ -2164,24 +2216,24 @@ class MSDeployLog(ProxyOnlyResource): 'entries': {'key': 'properties.entries', 'type': '[MSDeployLogEntry]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployLog, self).__init__(**kwargs) self.entries = None -class MSDeployLogEntry(Model): +class MSDeployLogEntry(msrest.serialization.Model): """MSDeploy log entry. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar time: Timestamp of log entry - :vartype time: datetime - :ivar type: Log entry type. Possible values include: 'Message', 'Warning', - 'Error' - :vartype type: str or - ~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntryType - :ivar message: Log entry message + :ivar time: Timestamp of log entry. + :vartype time: ~datetime.datetime + :ivar type: Log entry type. Possible values include: "Message", "Warning", "Error". + :vartype type: str or ~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntryType + :ivar message: Log entry message. :vartype message: str """ @@ -2193,11 +2245,14 @@ class MSDeployLogEntry(Model): _attribute_map = { 'time': {'key': 'time', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'MSDeployLogEntryType'}, + 'type': {'key': 'type', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployLogEntry, self).__init__(**kwargs) self.time = None self.type = None @@ -2207,8 +2262,7 @@ def __init__(self, **kwargs): class MSDeployStatus(ProxyOnlyResource): """MSDeploy ARM response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2218,17 +2272,17 @@ class MSDeployStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deployer: Username of deployer + :ivar deployer: Username of deployer. :vartype deployer: str - :ivar provisioning_state: Provisioning state. Possible values include: - 'accepted', 'running', 'succeeded', 'failed', 'canceled' + :ivar provisioning_state: Provisioning state. Possible values include: "accepted", "running", + "succeeded", "failed", "canceled". :vartype provisioning_state: str or ~azure.mgmt.web.v2016_08_01.models.MSDeployProvisioningState - :ivar start_time: Start time of deploy operation - :vartype start_time: datetime - :ivar end_time: End time of deploy operation - :vartype end_time: datetime - :ivar complete: Whether the deployment operation has completed + :ivar start_time: Start time of deploy operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of deploy operation. + :vartype end_time: ~datetime.datetime + :ivar complete: Whether the deployment operation has completed. :vartype complete: bool """ @@ -2249,13 +2303,16 @@ class MSDeployStatus(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'deployer': {'key': 'properties.deployer', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'MSDeployProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'complete': {'key': 'properties.complete', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployStatus, self).__init__(**kwargs) self.deployer = None self.provisioning_state = None @@ -2264,7 +2321,7 @@ def __init__(self, **kwargs): self.complete = None -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -2278,18 +2335,19 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) class NetworkFeatures(ProxyOnlyResource): - """Full view of network features for an app (presently VNET integration and - Hybrid Connections). + """Full view of network features for an app (presently VNET integration and Hybrid Connections). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2302,14 +2360,12 @@ class NetworkFeatures(ProxyOnlyResource): :ivar virtual_network_name: The Virtual Network name. :vartype virtual_network_name: str :ivar virtual_network_connection: The Virtual Network summary view. - :vartype virtual_network_connection: - ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :vartype virtual_network_connection: ~azure.mgmt.web.v2016_08_01.models.VnetInfo :ivar hybrid_connections: The Hybrid Connections summary view. :vartype hybrid_connections: list[~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity] :ivar hybrid_connections_v2: The Hybrid Connection V2 (Service Bus) view. - :vartype hybrid_connections_v2: - list[~azure.mgmt.web.v2016_08_01.models.HybridConnection] + :vartype hybrid_connections_v2: list[~azure.mgmt.web.v2016_08_01.models.HybridConnection] """ _validation = { @@ -2333,7 +2389,10 @@ class NetworkFeatures(ProxyOnlyResource): 'hybrid_connections_v2': {'key': 'properties.hybridConnectionsV2', 'type': '[HybridConnection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkFeatures, self).__init__(**kwargs) self.virtual_network_name = None self.virtual_network_connection = None @@ -2341,24 +2400,24 @@ def __init__(self, **kwargs): self.hybrid_connections_v2 = None -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2016_08_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2016_08_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -2366,7 +2425,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -2374,7 +2433,10 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -2386,7 +2448,39 @@ def __init__(self, **kwargs): self.geo_master_operation_id = kwargs.get('geo_master_operation_id', None) -class PerfMonResponse(Model): +class PerfMonCounterCollection(msrest.serialization.Model): + """Collection of performance monitor counters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.PerfMonResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PerfMonResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PerfMonCounterCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PerfMonResponse(msrest.serialization.Model): """Performance monitor API response. :param code: The response code. @@ -2403,23 +2497,26 @@ class PerfMonResponse(Model): 'data': {'key': 'data', 'type': 'PerfMonSet'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) self.data = kwargs.get('data', None) -class PerfMonSample(Model): +class PerfMonSample(msrest.serialization.Model): """Performance monitor sample in a set. :param time: Point in time for which counter was measured. - :type time: datetime + :type time: ~datetime.datetime :param instance_name: Name of the server on which the measurement is made. :type instance_name: str :param value: Value of counter at a certain time. :type value: float - :param core_count: Core Count of worker. Not a data member + :param core_count: Core Count of worker. Not a data member. :type core_count: int """ @@ -2430,7 +2527,10 @@ class PerfMonSample(Model): 'core_count': {'key': 'coreCount', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonSample, self).__init__(**kwargs) self.time = kwargs.get('time', None) self.instance_name = kwargs.get('instance_name', None) @@ -2438,15 +2538,15 @@ def __init__(self, **kwargs): self.core_count = kwargs.get('core_count', None) -class PerfMonSet(Model): +class PerfMonSet(msrest.serialization.Model): """Metric information. :param name: Unique key name of the counter. :type name: str :param start_time: Start time of the period. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time of the period. - :type end_time: datetime + :type end_time: ~datetime.datetime :param time_grain: Presented time grain. :type time_grain: str :param values: Collection of workers that are active during this time. @@ -2461,7 +2561,10 @@ class PerfMonSet(Model): 'values': {'key': 'values', 'type': '[PerfMonSample]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.start_time = kwargs.get('start_time', None) @@ -2470,11 +2573,60 @@ def __init__(self, **kwargs): self.values = kwargs.get('values', None) +class Resource(msrest.serialization.Model): + """Azure resource. This resource is tracked in Azure Resource Manager. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :param location: Required. Resource Location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = kwargs.get('kind', None) + self.location = kwargs['location'] + self.type = None + self.tags = kwargs.get('tags', None) + + class PremierAddOn(Resource): """Premier add-on. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2488,7 +2640,7 @@ class PremierAddOn(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Premier add on SKU. :type sku: str @@ -2498,10 +2650,10 @@ class PremierAddOn(Resource): :type vendor: str :param premier_add_on_name: Premier add on Name. :type premier_add_on_name: str - :param premier_add_on_location: Premier add on Location. - :type premier_add_on_location: str - :param premier_add_on_tags: Premier add on Tags. - :type premier_add_on_tags: dict[str, str] + :param location_properties_location: Premier add on Location. + :type location_properties_location: str + :param tags_properties_tags: Premier add on Tags. + :type tags_properties_tags: dict[str, str] :param marketplace_publisher: Premier add on Marketplace publisher. :type marketplace_publisher: str :param marketplace_offer: Premier add on Marketplace offer. @@ -2526,20 +2678,23 @@ class PremierAddOn(Resource): 'product': {'key': 'properties.product', 'type': 'str'}, 'vendor': {'key': 'properties.vendor', 'type': 'str'}, 'premier_add_on_name': {'key': 'properties.name', 'type': 'str'}, - 'premier_add_on_location': {'key': 'properties.location', 'type': 'str'}, - 'premier_add_on_tags': {'key': 'properties.tags', 'type': '{str}'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'tags_properties_tags': {'key': 'properties.tags', 'type': '{str}'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOn, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) self.vendor = kwargs.get('vendor', None) self.premier_add_on_name = kwargs.get('premier_add_on_name', None) - self.premier_add_on_location = kwargs.get('premier_add_on_location', None) - self.premier_add_on_tags = kwargs.get('premier_add_on_tags', None) + self.location_properties_location = kwargs.get('location_properties_location', None) + self.tags_properties_tags = kwargs.get('tags_properties_tags', None) self.marketplace_publisher = kwargs.get('marketplace_publisher', None) self.marketplace_offer = kwargs.get('marketplace_offer', None) @@ -2547,8 +2702,7 @@ def __init__(self, **kwargs): class ProcessInfo(ProxyOnlyResource): """Process Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2558,17 +2712,17 @@ class ProcessInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param process_info_id: ARM Identifier for deployment. - :type process_info_id: int - :param process_info_name: Deployment name. - :type process_info_name: str + :param id_properties_id: ARM Identifier for deployment. + :type id_properties_id: int + :param name_properties_name: Deployment name. + :type name_properties_name: str :param href: HRef URI. :type href: str :param mini_dump: Minidump URI. :type mini_dump: str - :param is_profile_running: Is profile running? + :param is_profile_running: Is profile running?. :type is_profile_running: bool - :param is_iis_profile_running: Is the IIS Profile running? + :param is_iis_profile_running: Is the IIS Profile running?. :type is_iis_profile_running: bool :param iis_profile_timeout_in_seconds: IIS Profile timeout (seconds). :type iis_profile_timeout_in_seconds: float @@ -2595,7 +2749,7 @@ class ProcessInfo(ProxyOnlyResource): :param thread_count: Thread count. :type thread_count: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total CPU time. :type total_processor_time: str :param user_processor_time: User CPU time. @@ -2621,12 +2775,12 @@ class ProcessInfo(ProxyOnlyResource): :param peak_paged_memory_size64: Peak paged memory. :type peak_paged_memory_size64: long :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime :param environment_variables: List of environment variables. :type environment_variables: dict[str, str] - :param is_scm_site: Is this the SCM site? + :param is_scm_site: Is this the SCM site?. :type is_scm_site: bool - :param is_web_job: Is this a Web Job? + :param is_web_job: Is this a Web Job?. :type is_web_job: bool :param description: Description of process. :type description: str @@ -2643,8 +2797,8 @@ class ProcessInfo(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'process_info_id': {'key': 'properties.id', 'type': 'int'}, - 'process_info_name': {'key': 'properties.name', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'int'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'href': {'key': 'properties.href', 'type': 'str'}, 'mini_dump': {'key': 'properties.miniDump', 'type': 'str'}, 'is_profile_running': {'key': 'properties.isProfileRunning', 'type': 'bool'}, @@ -2681,10 +2835,13 @@ class ProcessInfo(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessInfo, self).__init__(**kwargs) - self.process_info_id = kwargs.get('process_info_id', None) - self.process_info_name = kwargs.get('process_info_name', None) + self.id_properties_id = kwargs.get('id_properties_id', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.href = kwargs.get('href', None) self.mini_dump = kwargs.get('mini_dump', None) self.is_profile_running = kwargs.get('is_profile_running', None) @@ -2721,11 +2878,42 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class ProcessInfoCollection(msrest.serialization.Model): + """Collection of Kudu process information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ProcessInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ProcessModuleInfo(ProxyOnlyResource): """Process Module Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2735,8 +2923,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param base_address: Base address. Used as module identifier in ARM - resource URI. + :param base_address: Base address. Used as module identifier in ARM resource URI. :type base_address: str :param file_name: File name. :type file_name: str @@ -2754,7 +2941,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type product: str :param product_version: Product version. :type product_version: str - :param is_debug: Is debug? + :param is_debug: Is debug?. :type is_debug: bool :param language: Module language (locale). :type language: str @@ -2784,7 +2971,10 @@ class ProcessModuleInfo(ProxyOnlyResource): 'language': {'key': 'properties.language', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessModuleInfo, self).__init__(**kwargs) self.base_address = kwargs.get('base_address', None) self.file_name = kwargs.get('file_name', None) @@ -2799,11 +2989,42 @@ def __init__(self, **kwargs): self.language = kwargs.get('language', None) +class ProcessModuleInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessModuleInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessModuleInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ProcessThreadInfo(ProxyOnlyResource): """Process Thread Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2813,8 +3034,8 @@ class ProcessThreadInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param process_thread_info_id: ARM Identifier for deployment. - :type process_thread_info_id: int + :param id_properties_id: ARM Identifier for deployment. + :type id_properties_id: int :param href: HRef URI. :type href: str :param process: Process URI. @@ -2828,7 +3049,7 @@ class ProcessThreadInfo(ProxyOnlyResource): :param base_priority: Base priority. :type base_priority: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total processor time. :type total_processor_time: str :param user_processor_time: User processor time. @@ -2852,7 +3073,7 @@ class ProcessThreadInfo(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'process_thread_info_id': {'key': 'properties.id', 'type': 'int'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'int'}, 'href': {'key': 'properties.href', 'type': 'str'}, 'process': {'key': 'properties.process', 'type': 'str'}, 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, @@ -2867,9 +3088,12 @@ class ProcessThreadInfo(ProxyOnlyResource): 'wait_reason': {'key': 'properties.waitReason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessThreadInfo, self).__init__(**kwargs) - self.process_thread_info_id = kwargs.get('process_thread_info_id', None) + self.id_properties_id = kwargs.get('id_properties_id', None) self.href = kwargs.get('href', None) self.process = kwargs.get('process', None) self.start_address = kwargs.get('start_address', None) @@ -2884,11 +3108,42 @@ def __init__(self, **kwargs): self.wait_reason = kwargs.get('wait_reason', None) +class ProcessThreadInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessThreadInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessThreadInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class PublicCertificate(ProxyOnlyResource): """Public certificate object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2898,13 +3153,13 @@ class PublicCertificate(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param blob: Public Certificate byte array + :param blob: Public Certificate byte array. :type blob: bytearray - :param public_certificate_location: Public Certificate Location. Possible - values include: 'CurrentUserMy', 'LocalMachineMy', 'Unknown' + :param public_certificate_location: Public Certificate Location. Possible values include: + "CurrentUserMy", "LocalMachineMy", "Unknown". :type public_certificate_location: str or ~azure.mgmt.web.v2016_08_01.models.PublicCertificateLocation - :ivar thumbprint: Certificate Thumbprint + :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str """ @@ -2921,25 +3176,57 @@ class PublicCertificate(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, - 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'PublicCertificateLocation'}, + 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PublicCertificate, self).__init__(**kwargs) self.blob = kwargs.get('blob', None) self.public_certificate_location = kwargs.get('public_certificate_location', None) self.thumbprint = None -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PublicCertificateCollection(msrest.serialization.Model): + """Collection of public certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.PublicCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublicCertificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublicCertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2948,22 +3235,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -2971,7 +3255,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -2985,7 +3268,10 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PushSettings, self).__init__(**kwargs) self.is_push_enabled = kwargs.get('is_push_enabled', None) self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) @@ -2993,40 +3279,38 @@ def __init__(self, **kwargs): self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -3041,7 +3325,10 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = kwargs.get('action_host_name', None) self.reroute_percentage = kwargs.get('reroute_percentage', None) @@ -3056,8 +3343,7 @@ def __init__(self, **kwargs): class RelayServiceConnectionEntity(ProxyOnlyResource): """Hybrid Connection for an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3103,7 +3389,10 @@ class RelayServiceConnectionEntity(ProxyOnlyResource): 'biztalk_uri': {'key': 'properties.biztalkUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RelayServiceConnectionEntity, self).__init__(**kwargs) self.entity_name = kwargs.get('entity_name', None) self.entity_connection_string = kwargs.get('entity_connection_string', None) @@ -3114,7 +3403,7 @@ def __init__(self, **kwargs): self.biztalk_uri = kwargs.get('biztalk_uri', None) -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -3128,38 +3417,38 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = kwargs.get('count', None) self.time_interval = kwargs.get('time_interval', None) -class ResourceMetric(Model): +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2016_08_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] """ _validation = { @@ -3186,7 +3475,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -3199,11 +3491,10 @@ def __init__(self, **kwargs): self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -3221,17 +3512,51 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None +class ResourceMetricCollection(msrest.serialization.Model): + """Collection of metric responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetric] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetric]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3241,21 +3566,20 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2016_08_01.models.ResourceMetricName + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: ~azure.mgmt.web.v2016_08_01.models.ResourceMetricName :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str + :ivar id_properties_id: Resource ID. + :vartype id_properties_id: str :ivar properties: Resource metric definition properties. :vartype properties: dict[str, str] """ @@ -3264,12 +3588,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, 'properties': {'readonly': True}, } @@ -3278,31 +3602,65 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(**kwargs) - self.resource_metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.resource_uri = None - self.resource_metric_definition_id = None + self.id_properties_id = None self.properties = None -class ResourceMetricName(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -3320,13 +3678,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -3340,17 +3701,19 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.value = kwargs.get('value', None) -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -3365,8 +3728,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] """ _validation = { @@ -3389,7 +3751,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -3403,10 +3768,7 @@ def __init__(self, **kwargs): class RestoreRequest(ProxyOnlyResource): """Description of a restore request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3416,42 +3778,37 @@ class RestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str :param blob_name: Name of a blob which contains the backup. :type blob_name: str - :param overwrite: Required. true if the restore operation can - overwrite target app; otherwise, false. true is - needed if trying to restore over an existing app. + :param overwrite: :code:`true` if the restore operation can overwrite target app; + otherwise, :code:`false`. :code:`true` is needed if trying to restore + over an existing app. :type overwrite: bool :param site_name: Name of an app. :type site_name: str - :param databases: Collection of databases which should be restored. This - list has to match the list of databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] - :param ignore_conflicting_host_names: Changes a logic when restoring an - app with custom domains. true to remove custom domains - automatically. If false, custom domains are added to - the app's object when it is being restored, but that might fail due to - conflicts during the operation. Default value: False . + :param databases: Collection of databases which should be restored. This list has to match the + list of databases included in the backup. + :type databases: list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] + :param ignore_conflicting_host_names: Changes a logic when restoring an app with custom + domains. :code:`true` to remove custom domains automatically. If + :code:`false`, custom domains are added to + the app's object when it is being restored, but that might fail due to conflicts during the + operation. :type ignore_conflicting_host_names: bool - :param ignore_databases: Ignore the databases and only restore the site - content. Default value: False . + :param ignore_databases: Ignore the databases and only restore the site content. :type ignore_databases: bool - :param app_service_plan: Specify app service plan that will own restored - site. + :param app_service_plan: Specify app service plan that will own restored site. :type app_service_plan: str - :param operation_type: Operation type. Possible values include: 'Default', - 'Clone', 'Relocation', 'Snapshot'. Default value: "Default" . - :type operation_type: str or - ~azure.mgmt.web.v2016_08_01.models.BackupRestoreOperationType - :param adjust_connection_strings: true if - SiteConfig.ConnectionStrings should be set in new app; otherwise, - false. + :param operation_type: Operation type. Possible values include: "Default", "Clone", + "Relocation", "Snapshot". + :type operation_type: str or ~azure.mgmt.web.v2016_08_01.models.BackupRestoreOperationType + :param adjust_connection_strings: :code:`true` if SiteConfig.ConnectionStrings + should be set in new app; otherwise, :code:`false`. :type adjust_connection_strings: bool - :param hosting_environment: App Service Environment name, if needed (only - when restoring an app to an App Service Environment). + :param hosting_environment: App Service Environment name, if needed (only when restoring an app + to an App Service Environment). :type hosting_environment: str """ @@ -3459,8 +3816,6 @@ class RestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -3476,12 +3831,15 @@ class RestoreRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, 'ignore_databases': {'key': 'properties.ignoreDatabases', 'type': 'bool'}, 'app_service_plan': {'key': 'properties.appServicePlan', 'type': 'str'}, - 'operation_type': {'key': 'properties.operationType', 'type': 'BackupRestoreOperationType'}, + 'operation_type': {'key': 'properties.operationType', 'type': 'str'}, 'adjust_connection_strings': {'key': 'properties.adjustConnectionStrings', 'type': 'bool'}, 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RestoreRequest, self).__init__(**kwargs) self.storage_account_url = kwargs.get('storage_account_url', None) self.blob_name = kwargs.get('blob_name', None) @@ -3491,7 +3849,7 @@ def __init__(self, **kwargs): self.ignore_conflicting_host_names = kwargs.get('ignore_conflicting_host_names', False) self.ignore_databases = kwargs.get('ignore_databases', False) self.app_service_plan = kwargs.get('app_service_plan', None) - self.operation_type = kwargs.get('operation_type', "Default") + self.operation_type = kwargs.get('operation_type', None) self.adjust_connection_strings = kwargs.get('adjust_connection_strings', None) self.hosting_environment = kwargs.get('hosting_environment', None) @@ -3499,8 +3857,7 @@ def __init__(self, **kwargs): class RestoreResponse(ProxyOnlyResource): """Response for an app restore request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3510,8 +3867,8 @@ class RestoreResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the restore process, it will return - an operation ID identifying that particular restore operation. + :ivar operation_id: When server starts the restore process, it will return an operation ID + identifying that particular restore operation. :vartype operation_id: str """ @@ -3530,7 +3887,10 @@ class RestoreResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RestoreResponse, self).__init__(**kwargs) self.operation_id = None @@ -3538,8 +3898,7 @@ def __init__(self, **kwargs): class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3553,117 +3912,99 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_08_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentity """ _validation = { @@ -3697,13 +4038,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -3729,11 +4071,14 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Site, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -3766,15 +4111,12 @@ def __init__(self, **kwargs): self.default_host_name = None self.slot_swap_status = None self.https_only = kwargs.get('https_only', None) - self.identity = kwargs.get('identity', None) class SiteAuthSettings(ProxyOnlyResource): - """Configuration settings for the Azure App Service Authentication / - Authorization feature. + """Configuration settings for the Azure App Service Authentication / Authorization feature. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3784,144 +4126,121 @@ class SiteAuthSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param enabled: true if the Authentication / Authorization - feature is enabled for the current app; otherwise, false. + :param enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. :type enabled: bool - :param runtime_version: The RuntimeVersion of the Authentication / - Authorization feature in use for the current app. - The setting in this value can control the behavior of certain features in - the Authentication / Authorization module. + :param runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. :type runtime_version: str - :param unauthenticated_client_action: The action to take when an - unauthenticated client attempts to access the app. Possible values - include: 'RedirectToLoginPage', 'AllowAnonymous' + :param unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous". :type unauthenticated_client_action: str or ~azure.mgmt.web.v2016_08_01.models.UnauthenticatedClientAction - :param token_store_enabled: true to durably store - platform-specific security tokens that are obtained during login flows; - otherwise, false. - The default is false. + :param token_store_enabled: :code:`true` to durably store platform-specific + security tokens that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. :type token_store_enabled: bool - :param allowed_external_redirect_urls: External URLs that can be - redirected to as part of logging in or logging out of the app. Note that - the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store - application backends. + :param allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. :type allowed_external_redirect_urls: list[str] - :param default_provider: The default authentication provider to use when - multiple providers are configured. - This setting is only needed if multiple providers are configured and the - unauthenticated client - action is set to "RedirectToLoginPage". Possible values include: - 'AzureActiveDirectory', 'Facebook', 'Google', 'MicrosoftAccount', - 'Twitter' - :type default_provider: str or - ~azure.mgmt.web.v2016_08_01.models.BuiltInAuthenticationProvider - :param token_refresh_extension_hours: The number of hours after session - token expiration that a session token can be used to + :param default_provider: The default authentication provider to use when multiple providers are + configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". Possible values include: "AzureActiveDirectory", + "Facebook", "Google", "MicrosoftAccount", "Twitter". + :type default_provider: str or ~azure.mgmt.web.v2016_08_01.models.BuiltInAuthenticationProvider + :param token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to call the token refresh API. The default is 72 hours. :type token_refresh_extension_hours: float - :param client_id: The Client ID of this relying party application, known - as the client_id. - This setting is required for enabling OpenID Connection authentication - with Azure Active Directory or + :param client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or other 3rd party OpenID Connect providers. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_id: str - :param client_secret: The Client Secret of this relying party application - (in Azure Active Directory, this is also referred to as the Key). - This setting is optional. If no client secret is configured, the OpenID - Connect implicit auth flow is used to authenticate end users. - Otherwise, the OpenID Connect Authorization Code Flow is used to - authenticate end users. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + :param client_secret: The Client Secret of this relying party application (in Azure Active + Directory, this is also referred to as the Key). + This setting is optional. If no client secret is configured, the OpenID Connect implicit auth + flow is used to authenticate end users. + Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_secret: str - :param issuer: The OpenID Connect Issuer URI that represents the entity - which issues access tokens for this application. - When using Azure Active Directory, this value is the URI of the directory - tenant, e.g. https://sts.windows.net/{tenant-guid}/. + :param issuer: The OpenID Connect Issuer URI that represents the entity which issues access + tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://sts.windows.net/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. - More information on OpenID Connect Discovery: - http://openid.net/specs/openid-connect-discovery-1_0.html + More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect- + discovery-1_0.html. :type issuer: str - :param allowed_audiences: Allowed audience values to consider when - validating JWTs issued by - Azure Active Directory. Note that the ClientID value is - always considered an + :param allowed_audiences: Allowed audience values to consider when validating JWTs issued by + Azure Active Directory. Note that the :code:`ClientID` value is always considered + an allowed audience, regardless of this setting. :type allowed_audiences: list[str] - :param additional_login_params: Login parameters to send to the OpenID - Connect authorization endpoint when + :param additional_login_params: Login parameters to send to the OpenID Connect authorization + endpoint when a user logs in. Each parameter must be in the form "key=value". :type additional_login_params: list[str] - :param google_client_id: The OpenID Connect Client ID for the Google web - application. + :param google_client_id: The OpenID Connect Client ID for the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_id: str - :param google_client_secret: The client secret associated with the Google - web application. + :param google_client_secret: The client secret associated with the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_secret: str - :param google_oauth_scopes: The OAuth 2.0 scopes that will be requested as - part of Google Sign-In authentication. - This setting is optional. If not specified, "openid", "profile", and - "email" are used as default scopes. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ - :type google_oauth_scopes: list[str] + :param google_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Google + Sign-In authentication. + This setting is optional. If not specified, "openid", "profile", and "email" are used as + default scopes. + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. + :type google_o_auth_scopes: list[str] :param facebook_app_id: The App ID of the Facebook app used for login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_id: str - :param facebook_app_secret: The App Secret of the Facebook app used for - Facebook Login. + :param facebook_app_secret: The App Secret of the Facebook app used for Facebook Login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_secret: str - :param facebook_oauth_scopes: The OAuth 2.0 scopes that will be requested - as part of Facebook Login authentication. + :param facebook_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Facebook + Login authentication. This setting is optional. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login - :type facebook_oauth_scopes: list[str] - :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter - application used for sign-in. + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. + :type facebook_o_auth_scopes: list[str] + :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter application used for + sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_key: str - :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the - Twitter application used for sign-in. + :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the Twitter application used + for sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_secret: str - :param microsoft_account_client_id: The OAuth 2.0 client ID that was - created for the app used for authentication. + :param microsoft_account_client_id: The OAuth 2.0 client ID that was created for the app used + for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_id: str - :param microsoft_account_client_secret: The OAuth 2.0 client secret that - was created for the app used for authentication. + :param microsoft_account_client_secret: The OAuth 2.0 client secret that was created for the + app used for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_secret: str - :param microsoft_account_oauth_scopes: The OAuth 2.0 scopes that will be - requested as part of Microsoft Account authentication. - This setting is optional. If not specified, "wl.basic" is used as the - default scope. - Microsoft Account Scopes and permissions documentation: - https://msdn.microsoft.com/en-us/library/dn631845.aspx - :type microsoft_account_oauth_scopes: list[str] + :param microsoft_account_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of + Microsoft Account authentication. + This setting is optional. If not specified, "wl.basic" is used as the default scope. + Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en- + us/library/dn631845.aspx. + :type microsoft_account_o_auth_scopes: list[str] """ _validation = { @@ -3937,10 +4256,10 @@ class SiteAuthSettings(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, - 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'UnauthenticatedClientAction'}, + 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'str'}, 'token_store_enabled': {'key': 'properties.tokenStoreEnabled', 'type': 'bool'}, 'allowed_external_redirect_urls': {'key': 'properties.allowedExternalRedirectUrls', 'type': '[str]'}, - 'default_provider': {'key': 'properties.defaultProvider', 'type': 'BuiltInAuthenticationProvider'}, + 'default_provider': {'key': 'properties.defaultProvider', 'type': 'str'}, 'token_refresh_extension_hours': {'key': 'properties.tokenRefreshExtensionHours', 'type': 'float'}, 'client_id': {'key': 'properties.clientId', 'type': 'str'}, 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, @@ -3949,18 +4268,21 @@ class SiteAuthSettings(ProxyOnlyResource): 'additional_login_params': {'key': 'properties.additionalLoginParams', 'type': '[str]'}, 'google_client_id': {'key': 'properties.googleClientId', 'type': 'str'}, 'google_client_secret': {'key': 'properties.googleClientSecret', 'type': 'str'}, - 'google_oauth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, + 'google_o_auth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, 'facebook_app_id': {'key': 'properties.facebookAppId', 'type': 'str'}, 'facebook_app_secret': {'key': 'properties.facebookAppSecret', 'type': 'str'}, - 'facebook_oauth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, + 'facebook_o_auth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, 'twitter_consumer_key': {'key': 'properties.twitterConsumerKey', 'type': 'str'}, 'twitter_consumer_secret': {'key': 'properties.twitterConsumerSecret', 'type': 'str'}, 'microsoft_account_client_id': {'key': 'properties.microsoftAccountClientId', 'type': 'str'}, 'microsoft_account_client_secret': {'key': 'properties.microsoftAccountClientSecret', 'type': 'str'}, - 'microsoft_account_oauth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, + 'microsoft_account_o_auth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteAuthSettings, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -3976,46 +4298,45 @@ def __init__(self, **kwargs): self.additional_login_params = kwargs.get('additional_login_params', None) self.google_client_id = kwargs.get('google_client_id', None) self.google_client_secret = kwargs.get('google_client_secret', None) - self.google_oauth_scopes = kwargs.get('google_oauth_scopes', None) + self.google_o_auth_scopes = kwargs.get('google_o_auth_scopes', None) self.facebook_app_id = kwargs.get('facebook_app_id', None) self.facebook_app_secret = kwargs.get('facebook_app_secret', None) - self.facebook_oauth_scopes = kwargs.get('facebook_oauth_scopes', None) + self.facebook_o_auth_scopes = kwargs.get('facebook_o_auth_scopes', None) self.twitter_consumer_key = kwargs.get('twitter_consumer_key', None) self.twitter_consumer_secret = kwargs.get('twitter_consumer_secret', None) self.microsoft_account_client_id = kwargs.get('microsoft_account_client_id', None) self.microsoft_account_client_secret = kwargs.get('microsoft_account_client_secret', None) - self.microsoft_account_oauth_scopes = kwargs.get('microsoft_account_oauth_scopes', None) + self.microsoft_account_o_auth_scopes = kwargs.get('microsoft_account_o_auth_scopes', None) -class SiteCloneability(Model): +class SiteCloneability(msrest.serialization.Model): """Represents whether or not an app is cloneable. - :param result: Name of app. Possible values include: 'Cloneable', - 'PartiallyCloneable', 'NotCloneable' + :param result: Name of app. Possible values include: "Cloneable", "PartiallyCloneable", + "NotCloneable". :type result: str or ~azure.mgmt.web.v2016_08_01.models.CloneAbilityResult - :param blocking_features: List of features enabled on app that prevent - cloning. - :type blocking_features: - list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] - :param unsupported_features: List of features enabled on app that are - non-blocking but cannot be cloned. The app can still be cloned + :param blocking_features: List of features enabled on app that prevent cloning. + :type blocking_features: list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] + :param unsupported_features: List of features enabled on app that are non-blocking but cannot + be cloned. The app can still be cloned but the features in this list will not be set up on cloned app. - :type unsupported_features: - list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] - :param blocking_characteristics: List of blocking application - characteristics. + :type unsupported_features: list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] + :param blocking_characteristics: List of blocking application characteristics. :type blocking_characteristics: list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] """ _attribute_map = { - 'result': {'key': 'result', 'type': 'CloneAbilityResult'}, + 'result': {'key': 'result', 'type': 'str'}, 'blocking_features': {'key': 'blockingFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'unsupported_features': {'key': 'unsupportedFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'blocking_characteristics': {'key': 'blockingCharacteristics', 'type': '[SiteCloneabilityCriterion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteCloneability, self).__init__(**kwargs) self.result = kwargs.get('result', None) self.blocking_features = kwargs.get('blocking_features', None) @@ -4023,7 +4344,7 @@ def __init__(self, **kwargs): self.blocking_characteristics = kwargs.get('blocking_characteristics', None) -class SiteCloneabilityCriterion(Model): +class SiteCloneabilityCriterion(msrest.serialization.Model): """An app cloneability criterion. :param name: Name of criterion. @@ -4037,24 +4358,25 @@ class SiteCloneabilityCriterion(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteCloneabilityCriterion, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -4062,52 +4384,50 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -4117,24 +4437,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_08_01.models.AutoHealRules @@ -4146,25 +4462,21 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2016_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_08_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions """ _validation = { @@ -4200,9 +4512,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -4219,7 +4531,10 @@ class SiteConfig(Model): 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -4271,8 +4586,7 @@ def __init__(self, **kwargs): class SiteConfigResource(ProxyOnlyResource): """Web app configuration ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4286,8 +4600,7 @@ class SiteConfigResource(ProxyOnlyResource): :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -4295,52 +4608,50 @@ class SiteConfigResource(ProxyOnlyResource): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -4350,24 +4661,20 @@ class SiteConfigResource(ProxyOnlyResource): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_08_01.models.AutoHealRules @@ -4379,25 +4686,21 @@ class SiteConfigResource(ProxyOnlyResource): :type cors: ~azure.mgmt.web.v2016_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_08_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions """ _validation = { @@ -4440,9 +4743,9 @@ class SiteConfigResource(ProxyOnlyResource): 'java_container': {'key': 'properties.javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'properties.javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'properties.appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'properties.virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'str'}, 'experiments': {'key': 'properties.experiments', 'type': 'Experiments'}, 'limits': {'key': 'properties.limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'properties.autoHealEnabled', 'type': 'bool'}, @@ -4459,7 +4762,10 @@ class SiteConfigResource(ProxyOnlyResource): 'min_tls_version': {'key': 'properties.minTlsVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfigResource, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -4508,11 +4814,42 @@ def __init__(self, **kwargs): self.min_tls_version = kwargs.get('min_tls_version', None) +class SiteConfigResourceCollection(msrest.serialization.Model): + """Collection of site configurations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteConfigResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteConfigResourceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteConfigurationSnapshotInfo(ProxyOnlyResource): """A snapshot of a web app configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4523,9 +4860,9 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :ivar time: The time the snapshot was taken. - :vartype time: datetime - :ivar site_configuration_snapshot_info_id: The id of the snapshot - :vartype site_configuration_snapshot_info_id: int + :vartype time: ~datetime.datetime + :ivar id_properties_id: The id of the snapshot. + :vartype id_properties_id: int """ _validation = { @@ -4533,7 +4870,7 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'time': {'readonly': True}, - 'site_configuration_snapshot_info_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, } _attribute_map = { @@ -4542,20 +4879,54 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'time': {'key': 'properties.time', 'type': 'iso-8601'}, - 'site_configuration_snapshot_info_id': {'key': 'properties.id', 'type': 'int'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfigurationSnapshotInfo, self).__init__(**kwargs) self.time = None - self.site_configuration_snapshot_info_id = None + self.id_properties_id = None + + +class SiteConfigurationSnapshotInfoCollection(msrest.serialization.Model): + """Collection of metadata for the app configuration snapshots that can be restored. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteConfigurationSnapshotInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None class SiteExtensionInfo(ProxyOnlyResource): """Site Extension Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4565,14 +4936,13 @@ class SiteExtensionInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param site_extension_info_id: Site extension ID. - :type site_extension_info_id: str + :param id_properties_id: Site extension ID. + :type id_properties_id: str :param title: Site extension title. :type title: str - :param site_extension_info_type: Site extension type. Possible values - include: 'Gallery', 'WebRoot' - :type site_extension_info_type: str or - ~azure.mgmt.web.v2016_08_01.models.SiteExtensionType + :param type_properties_type: Site extension type. Possible values include: "Gallery", + "WebRoot". + :type type_properties_type: str or ~azure.mgmt.web.v2016_08_01.models.SiteExtensionType :param summary: Summary description. :type summary: str :param description: Detailed description. @@ -4594,16 +4964,16 @@ class SiteExtensionInfo(ProxyOnlyResource): :param installation_args: Installer command line parameters. :type installation_args: str :param published_date_time: Published timestamp. - :type published_date_time: datetime + :type published_date_time: ~datetime.datetime :param download_count: Count of downloads. :type download_count: int - :param local_is_latest_version: true if the local version is - the latest version; false otherwise. + :param local_is_latest_version: :code:`true` if the local version is the latest + version; :code:`false` otherwise. :type local_is_latest_version: bool :param local_path: Local path. :type local_path: str :param installed_date_time: Installed timestamp. - :type installed_date_time: datetime + :type installed_date_time: ~datetime.datetime :param provisioning_state: Provisioning state. :type provisioning_state: str :param comment: Site Extension comment. @@ -4621,9 +4991,9 @@ class SiteExtensionInfo(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'site_extension_info_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'title': {'key': 'properties.title', 'type': 'str'}, - 'site_extension_info_type': {'key': 'properties.type', 'type': 'SiteExtensionType'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'summary': {'key': 'properties.summary', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'str'}, @@ -4643,11 +5013,14 @@ class SiteExtensionInfo(ProxyOnlyResource): 'comment': {'key': 'properties.comment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteExtensionInfo, self).__init__(**kwargs) - self.site_extension_info_id = kwargs.get('site_extension_info_id', None) + self.id_properties_id = kwargs.get('id_properties_id', None) self.title = kwargs.get('title', None) - self.site_extension_info_type = kwargs.get('site_extension_info_type', None) + self.type_properties_type = kwargs.get('type_properties_type', None) self.summary = kwargs.get('summary', None) self.description = kwargs.get('description', None) self.version = kwargs.get('version', None) @@ -4667,11 +5040,42 @@ def __init__(self, **kwargs): self.comment = kwargs.get('comment', None) +class SiteExtensionInfoCollection(msrest.serialization.Model): + """Collection of Kudu site extension information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteExtensionInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteExtensionInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteInstance(ProxyOnlyResource): """Instance of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4681,15 +5085,15 @@ class SiteInstance(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar site_instance_name: Name of instance. - :vartype site_instance_name: str + :ivar name_properties_name: Name of instance. + :vartype name_properties_name: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'site_instance_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -4697,15 +5101,18 @@ class SiteInstance(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'site_instance_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteInstance, self).__init__(**kwargs) - self.site_instance_name = None + self.name_properties_name = None -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -4722,7 +5129,10 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) @@ -4732,8 +5142,7 @@ def __init__(self, **kwargs): class SiteLogsConfig(ProxyOnlyResource): """Configuration of App Service site logs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4744,16 +5153,13 @@ class SiteLogsConfig(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param application_logs: Application logs configuration. - :type application_logs: - ~azure.mgmt.web.v2016_08_01.models.ApplicationLogsConfig + :type application_logs: ~azure.mgmt.web.v2016_08_01.models.ApplicationLogsConfig :param http_logs: HTTP logs configuration. :type http_logs: ~azure.mgmt.web.v2016_08_01.models.HttpLogsConfig :param failed_requests_tracing: Failed requests tracing configuration. - :type failed_requests_tracing: - ~azure.mgmt.web.v2016_08_01.models.EnabledConfig + :type failed_requests_tracing: ~azure.mgmt.web.v2016_08_01.models.EnabledConfig :param detailed_error_messages: Detailed error messages configuration. - :type detailed_error_messages: - ~azure.mgmt.web.v2016_08_01.models.EnabledConfig + :type detailed_error_messages: ~azure.mgmt.web.v2016_08_01.models.EnabledConfig """ _validation = { @@ -4773,7 +5179,10 @@ class SiteLogsConfig(ProxyOnlyResource): 'detailed_error_messages': {'key': 'properties.detailedErrorMessages', 'type': 'EnabledConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLogsConfig, self).__init__(**kwargs) self.application_logs = kwargs.get('application_logs', None) self.http_logs = kwargs.get('http_logs', None) @@ -4781,7 +5190,7 @@ def __init__(self, **kwargs): self.detailed_error_messages = kwargs.get('detailed_error_messages', None) -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -4801,7 +5210,10 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = kwargs.get('validation', None) self.validation_key = kwargs.get('validation_key', None) @@ -4812,8 +5224,7 @@ def __init__(self, **kwargs): class SitePatchResource(ProxyOnlyResource): """ARM resource for a site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4829,106 +5240,88 @@ class SitePatchResource(ProxyOnlyResource): :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_08_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool """ @@ -4963,10 +5356,10 @@ class SitePatchResource(ProxyOnlyResource): 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -4994,7 +5387,10 @@ class SitePatchResource(ProxyOnlyResource): 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SitePatchResource, self).__init__(**kwargs) self.state = None self.host_names = None @@ -5033,8 +5429,7 @@ def __init__(self, **kwargs): class SitePhpErrorLogFlag(ProxyOnlyResource): """Used for getting PHP error logging flag. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5071,7 +5466,10 @@ class SitePhpErrorLogFlag(ProxyOnlyResource): 'master_log_errors_max_length': {'key': 'properties.masterLogErrorsMaxLength', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SitePhpErrorLogFlag, self).__init__(**kwargs) self.local_log_errors = kwargs.get('local_log_errors', None) self.master_log_errors = kwargs.get('master_log_errors', None) @@ -5082,8 +5480,7 @@ def __init__(self, **kwargs): class SiteSourceControl(ProxyOnlyResource): """Source control configuration for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5097,15 +5494,15 @@ class SiteSourceControl(ProxyOnlyResource): :type repo_url: str :param branch: Name of branch to use for deployment. :type branch: str - :param is_manual_integration: true to limit to manual - integration; false to enable continuous integration (which - configures webhooks into online repos like GitHub). + :param is_manual_integration: :code:`true` to limit to manual integration; + :code:`false` to enable continuous integration (which configures webhooks into + online repos like GitHub). :type is_manual_integration: bool - :param deployment_rollback_enabled: true to enable deployment - rollback; otherwise, false. + :param deployment_rollback_enabled: :code:`true` to enable deployment rollback; + otherwise, :code:`false`. :type deployment_rollback_enabled: bool - :param is_mercurial: true for a Mercurial repository; - false for a Git repository. + :param is_mercurial: :code:`true` for a Mercurial repository; + :code:`false` for a Git repository. :type is_mercurial: bool """ @@ -5127,7 +5524,10 @@ class SiteSourceControl(ProxyOnlyResource): 'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSourceControl, self).__init__(**kwargs) self.repo_url = kwargs.get('repo_url', None) self.branch = kwargs.get('branch', None) @@ -5136,84 +5536,10 @@ def __init__(self, **kwargs): self.is_mercurial = kwargs.get('is_mercurial', None) -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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, **kwargs): - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) - self.maximum = kwargs.get('maximum', None) - self.default = kwargs.get('default', None) - self.scale_type = kwargs.get('scale_type', None) - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2016_08_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2016_08_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, **kwargs): - super(SkuDescription, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - self.sku_capacity = kwargs.get('sku_capacity', None) - self.locations = kwargs.get('locations', None) - self.capabilities = kwargs.get('capabilities', None) - - class SlotConfigNamesResource(ProxyOnlyResource): """Slot Config names azure resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5244,7 +5570,10 @@ class SlotConfigNamesResource(ProxyOnlyResource): 'app_setting_names': {'key': 'properties.appSettingNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotConfigNamesResource, self).__init__(**kwargs) self.connection_string_names = kwargs.get('connection_string_names', None) self.app_setting_names = kwargs.get('app_setting_names', None) @@ -5253,8 +5582,7 @@ def __init__(self, **kwargs): class SlotDifference(ProxyOnlyResource): """A setting difference between two deployment slots of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5264,14 +5592,11 @@ class SlotDifference(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar slot_difference_type: Type of the difference: Information, Warning - or Error. - :vartype slot_difference_type: str - :ivar setting_type: The type of the setting: General, AppSetting or - ConnectionString. + :ivar type_properties_type: Type of the difference: Information, Warning or Error. + :vartype type_properties_type: str + :ivar setting_type: The type of the setting: General, AppSetting or ConnectionString. :vartype setting_type: str - :ivar diff_rule: Rule that describes how to process the setting difference - during a slot swap. + :ivar diff_rule: Rule that describes how to process the setting difference during a slot swap. :vartype diff_rule: str :ivar setting_name: Name of the setting. :vartype setting_name: str @@ -5287,7 +5612,7 @@ class SlotDifference(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'slot_difference_type': {'readonly': True}, + 'type_properties_type': {'readonly': True}, 'setting_type': {'readonly': True}, 'diff_rule': {'readonly': True}, 'setting_name': {'readonly': True}, @@ -5301,7 +5626,7 @@ class SlotDifference(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'slot_difference_type': {'key': 'properties.type', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'setting_type': {'key': 'properties.settingType', 'type': 'str'}, 'diff_rule': {'key': 'properties.diffRule', 'type': 'str'}, 'setting_name': {'key': 'properties.settingName', 'type': 'str'}, @@ -5310,9 +5635,12 @@ class SlotDifference(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotDifference, self).__init__(**kwargs) - self.slot_difference_type = None + self.type_properties_type = None self.setting_type = None self.diff_rule = None self.setting_name = None @@ -5321,18 +5649,48 @@ def __init__(self, **kwargs): self.description = None -class SlotSwapStatus(Model): +class SlotDifferenceCollection(msrest.serialization.Model): + """Collection of slot differences. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SlotDifference] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SlotDifference]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SlotDifferenceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -5348,14 +5706,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -5372,7 +5733,10 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = kwargs.get('time_taken', None) self.count = kwargs.get('count', None) @@ -5382,8 +5746,7 @@ def __init__(self, **kwargs): class Snapshot(ProxyOnlyResource): """A snapshot of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5412,19 +5775,51 @@ class Snapshot(ProxyOnlyResource): 'time': {'key': 'properties.time', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Snapshot, self).__init__(**kwargs) self.time = None -class SnapshotRecoveryRequest(ProxyOnlyResource): - """Details about app recovery operation. +class SnapshotCollection(msrest.serialization.Model): + """Collection of snapshots which can be used to revert an app to a previous time. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Snapshot] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SnapshotCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SnapshotRecoveryRequest(ProxyOnlyResource): + """Details about app recovery operation. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -5433,21 +5828,19 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app recovery should be attempted, formatted as + a DateTime string. :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. + :param recovery_target: Specifies the web app that snapshot contents will be written to. + :type recovery_target: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryTarget + :param overwrite: If :code:`true` the recovery operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool """ @@ -5456,7 +5849,6 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -5471,7 +5863,10 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoveryRequest, self).__init__(**kwargs) self.snapshot_time = kwargs.get('snapshot_time', None) self.recovery_target = kwargs.get('recovery_target', None) @@ -5480,16 +5875,16 @@ def __init__(self, **kwargs): self.ignore_conflicting_host_names = kwargs.get('ignore_conflicting_host_names', None) -class SnapshotRecoveryTarget(Model): +class SnapshotRecoveryTarget(msrest.serialization.Model): """Specifies the web app that snapshot contents will be written to. - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the target web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -5499,13 +5894,16 @@ class SnapshotRecoveryTarget(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoveryTarget, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.id = kwargs.get('id', None) -class StatusCodesBasedTrigger(Model): +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -5528,7 +5926,10 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.sub_status = kwargs.get('sub_status', None) @@ -5540,10 +5941,7 @@ def __init__(self, **kwargs): class StorageMigrationOptions(ProxyOnlyResource): """Options for app content migration. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5553,17 +5951,15 @@ class StorageMigrationOptions(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param azurefiles_connection_string: Required. AzureFiles connection - string. + :param azurefiles_connection_string: AzureFiles connection string. :type azurefiles_connection_string: str - :param azurefiles_share: Required. AzureFiles share. + :param azurefiles_share: AzureFiles share. :type azurefiles_share: str - :param switch_site_after_migration: trueif the app should be - switched over; otherwise, false. Default value: False . + :param switch_site_after_migration: :code:`true`if the app should be switched + over; otherwise, :code:`false`. :type switch_site_after_migration: bool - :param block_write_access_to_site: true if the app should be - read only during copy operation; otherwise, false. Default - value: False . + :param block_write_access_to_site: :code:`true` if the app should be read only + during copy operation; otherwise, :code:`false`. :type block_write_access_to_site: bool """ @@ -5571,8 +5967,6 @@ class StorageMigrationOptions(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'azurefiles_connection_string': {'required': True}, - 'azurefiles_share': {'required': True}, } _attribute_map = { @@ -5586,7 +5980,10 @@ class StorageMigrationOptions(ProxyOnlyResource): 'block_write_access_to_site': {'key': 'properties.blockWriteAccessToSite', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageMigrationOptions, self).__init__(**kwargs) self.azurefiles_connection_string = kwargs.get('azurefiles_connection_string', None) self.azurefiles_share = kwargs.get('azurefiles_share', None) @@ -5597,8 +5994,7 @@ def __init__(self, **kwargs): class StorageMigrationResponse(ProxyOnlyResource): """Response for a migration of app content request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5608,8 +6004,8 @@ class StorageMigrationResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the migration process, it will - return an operation ID identifying that particular migration operation. + :ivar operation_id: When server starts the migration process, it will return an operation ID + identifying that particular migration operation. :vartype operation_id: str """ @@ -5628,7 +6024,10 @@ class StorageMigrationResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageMigrationResponse, self).__init__(**kwargs) self.operation_id = None @@ -5636,8 +6035,7 @@ def __init__(self, **kwargs): class StringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5665,17 +6063,18 @@ class StringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringDictionary, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) class TriggeredJobHistory(ProxyOnlyResource): - """Triggered Web Job History. List of Triggered Web Job Run Information - elements. + """Triggered Web Job History. List of Triggered Web Job Run Information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5686,8 +6085,7 @@ class TriggeredJobHistory(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param triggered_job_runs: List of triggered web job runs. - :type triggered_job_runs: - list[~azure.mgmt.web.v2016_08_01.models.TriggeredJobRun] + :type triggered_job_runs: list[~azure.mgmt.web.v2016_08_01.models.TriggeredJobRun] """ _validation = { @@ -5704,16 +6102,50 @@ class TriggeredJobHistory(ProxyOnlyResource): 'triggered_job_runs': {'key': 'properties.triggeredJobRuns', 'type': '[TriggeredJobRun]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredJobHistory, self).__init__(**kwargs) self.triggered_job_runs = kwargs.get('triggered_job_runs', None) +class TriggeredJobHistoryCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredJobHistory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TriggeredJobHistoryCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TriggeredJobRun(ProxyOnlyResource): """Triggered Web Job Run Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5723,18 +6155,16 @@ class TriggeredJobRun(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param triggered_job_run_id: Job ID. - :type triggered_job_run_id: str - :ivar triggered_job_run_name: Job name. - :vartype triggered_job_run_name: str - :param status: Job status. Possible values include: 'Success', 'Failed', - 'Error' - :type status: str or - ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobStatus + :param id_properties_id: Job ID. + :type id_properties_id: str + :ivar name_properties_name: Job name. + :vartype name_properties_name: str + :param status: Job status. Possible values include: "Success", "Failed", "Error". + :type status: str or ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobStatus :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime + :type end_time: ~datetime.datetime :param duration: Job duration. :type duration: str :param output_url: Output URL. @@ -5753,7 +6183,7 @@ class TriggeredJobRun(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'triggered_job_run_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -5761,9 +6191,9 @@ class TriggeredJobRun(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'triggered_job_run_id': {'key': 'properties.id', 'type': 'str'}, - 'triggered_job_run_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TriggeredWebJobStatus'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'duration': {'key': 'properties.duration', 'type': 'str'}, @@ -5774,10 +6204,13 @@ class TriggeredJobRun(ProxyOnlyResource): 'trigger': {'key': 'properties.trigger', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredJobRun, self).__init__(**kwargs) - self.triggered_job_run_id = kwargs.get('triggered_job_run_id', None) - self.triggered_job_run_name = None + self.id_properties_id = kwargs.get('id_properties_id', None) + self.name_properties_name = None self.status = kwargs.get('status', None) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -5792,8 +6225,7 @@ def __init__(self, **kwargs): class TriggeredWebJob(ProxyOnlyResource): """Triggered Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5809,21 +6241,19 @@ class TriggeredWebJob(ProxyOnlyResource): :type history_url: str :param scheduler_logs_url: Scheduler Logs URL. :type scheduler_logs_url: str - :ivar triggered_web_job_name: Job name. Used as job identifier in ARM - resource URI. - :vartype triggered_web_job_name: str + :ivar name_properties_name: Job name. Used as job identifier in ARM resource URI. + :vartype name_properties_name: str :param run_command: Run command. :type run_command: str :param url: Job URL. :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param job_type: Job type. Possible values include: "Continuous", "Triggered". :type job_type: str or ~azure.mgmt.web.v2016_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -5833,7 +6263,7 @@ class TriggeredWebJob(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'triggered_web_job_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -5844,22 +6274,25 @@ class TriggeredWebJob(ProxyOnlyResource): 'latest_run': {'key': 'properties.latestRun', 'type': 'TriggeredJobRun'}, 'history_url': {'key': 'properties.historyUrl', 'type': 'str'}, 'scheduler_logs_url': {'key': 'properties.schedulerLogsUrl', 'type': 'str'}, - 'triggered_web_job_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'run_command': {'key': 'properties.runCommand', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extraInfoUrl', 'type': 'str'}, - 'job_type': {'key': 'properties.jobType', 'type': 'WebJobType'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.usingSdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredWebJob, self).__init__(**kwargs) self.latest_run = kwargs.get('latest_run', None) self.history_url = kwargs.get('history_url', None) self.scheduler_logs_url = kwargs.get('scheduler_logs_url', None) - self.triggered_web_job_name = None + self.name_properties_name = None self.run_command = kwargs.get('run_command', None) self.url = kwargs.get('url', None) self.extra_info_url = kwargs.get('extra_info_url', None) @@ -5869,14 +6302,43 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class TriggeredWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TriggeredWebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class User(ProxyOnlyResource): + """User credentials used for publishing activity. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -5885,16 +6347,15 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param user_name: Username + :param user_name: Username. :type user_name: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str """ @@ -5902,7 +6363,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -5917,7 +6377,10 @@ class User(ProxyOnlyResource): 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(User, self).__init__(**kwargs) self.user_name = kwargs.get('user_name', None) self.publishing_user_name = kwargs.get('publishing_user_name', None) @@ -5926,19 +6389,18 @@ def __init__(self, **kwargs): self.publishing_password_hash_salt = kwargs.get('publishing_password_hash_salt', None) -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2016_08_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2016_08_01.models.VirtualDirectory] """ _attribute_map = { @@ -5948,7 +6410,10 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) @@ -5956,7 +6421,7 @@ def __init__(self, **kwargs): self.virtual_directories = kwargs.get('virtual_directories', None) -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -5970,20 +6435,19 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5995,8 +6459,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -6004,7 +6467,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -6016,7 +6478,10 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetGateway, self).__init__(**kwargs) self.vnet_name = kwargs.get('vnet_name', None) self.vpn_package_uri = kwargs.get('vpn_package_uri', None) @@ -6025,8 +6490,7 @@ def __init__(self, **kwargs): class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6040,17 +6504,17 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: bytearray :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2016_08_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str """ @@ -6076,7 +6540,10 @@ class VnetInfo(ProxyOnlyResource): 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetInfo, self).__init__(**kwargs) self.vnet_resource_id = kwargs.get('vnet_resource_id', None) self.cert_thumbprint = None @@ -6087,11 +6554,9 @@ def __init__(self, **kwargs): class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6101,23 +6566,22 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. + :param vnet_route_name: The name of this route. This is only returned by the server and does + not need to be set by the client. :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2016_08_01.models.RouteType """ @@ -6138,7 +6602,10 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetRoute, self).__init__(**kwargs) self.vnet_route_name = kwargs.get('vnet_route_name', None) self.start_address = kwargs.get('start_address', None) @@ -6146,11 +6613,74 @@ def __init__(self, **kwargs): self.route_type = kwargs.get('route_type', None) +class WebAppCollection(msrest.serialization.Model): + """Collection of App Service apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Site] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Site]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebAppCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class WebAppInstanceCollection(msrest.serialization.Model): + """Collection of app instances. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteInstance] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebAppInstanceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class WebJob(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6160,20 +6690,19 @@ class WebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar web_job_name: Job name. Used as job identifier in ARM resource URI. - :vartype web_job_name: str + :ivar name_properties_name: Job name. Used as job identifier in ARM resource URI. + :vartype name_properties_name: str :param run_command: Run command. :type run_command: str :param url: Job URL. :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param job_type: Job type. Possible values include: "Continuous", "Triggered". :type job_type: str or ~azure.mgmt.web.v2016_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -6183,7 +6712,7 @@ class WebJob(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'web_job_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -6191,19 +6720,22 @@ class WebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'web_job_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'run_command': {'key': 'properties.runCommand', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extraInfoUrl', 'type': 'str'}, - 'job_type': {'key': 'properties.jobType', 'type': 'WebJobType'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.usingSdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebJob, self).__init__(**kwargs) - self.web_job_name = None + self.name_properties_name = None self.run_command = kwargs.get('run_command', None) self.url = kwargs.get('url', None) self.extra_info_url = kwargs.get('extra_info_url', None) @@ -6211,3 +6743,35 @@ def __init__(self, **kwargs): self.error = kwargs.get('error', None) self.using_sdk = kwargs.get('using_sdk', None) self.settings = kwargs.get('settings', None) + + +class WebJobCollection(msrest.serialization.Model): + """Collection of Kudu web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.WebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models_py3.py index a14b423c9953..7f543c19ab23 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_models_py3.py @@ -1,18 +1,20 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import datetime +from typing import Dict, List, Optional, Union +import msrest.serialization -class ApiDefinitionInfo(Model): +from ._web_site_management_client_enums import * + + +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -23,19 +25,22 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = url -class ApplicationLogsConfig(Model): +class ApplicationLogsConfig(msrest.serialization.Model): """Application logs configuration. :param file_system: Application logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2016_08_01.models.FileSystemApplicationLogsConfig - :param azure_table_storage: Application logs to azure table storage - configuration. + :type file_system: ~azure.mgmt.web.v2016_08_01.models.FileSystemApplicationLogsConfig + :param azure_table_storage: Application logs to azure table storage configuration. :type azure_table_storage: ~azure.mgmt.web.v2016_08_01.models.AzureTableStorageApplicationLogsConfig :param azure_blob_storage: Application logs to blob storage configuration. @@ -49,228 +54,56 @@ class ApplicationLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageApplicationLogsConfig'}, } - def __init__(self, *, file_system=None, azure_table_storage=None, azure_blob_storage=None, **kwargs) -> None: + def __init__( + self, + *, + file_system: Optional["FileSystemApplicationLogsConfig"] = None, + azure_table_storage: Optional["AzureTableStorageApplicationLogsConfig"] = None, + azure_blob_storage: Optional["AzureBlobStorageApplicationLogsConfig"] = None, + **kwargs + ): super(ApplicationLogsConfig, self).__init__(**kwargs) self.file_system = file_system self.azure_table_storage = azure_table_storage self.azure_blob_storage = azure_blob_storage -class Resource(Model): - """Azure resource. This resource is tracked in Azure Resource Manager. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.kind = kind - self.location = location - self.type = None - self.tags = tags - - -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2016_08_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param admin_site_name: App Service plan administration site. - :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_08_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2016_08_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, tags=None, worker_tier_name: str=None, admin_site_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, is_spot: bool=None, spot_expiration_time=None, reserved: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: - super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_plan_name = app_service_plan_name - self.worker_tier_name = worker_tier_name - self.status = None - self.subscription = None - self.admin_site_name = admin_site_name - self.hosting_environment_profile = hosting_environment_profile - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = per_site_scaling - self.number_of_sites = None - self.is_spot = is_spot - self.spot_expiration_time = spot_expiration_time - self.resource_group = None - self.reserved = reserved - self.target_worker_count = target_worker_count - self.target_worker_size_id = target_worker_size_id - self.provisioning_state = None - self.sku = sku - - -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2016_08_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2016_08_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2016_08_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2016_08_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "AutoHealActionType"]] = None, + custom_action: Optional["AutoHealCustomAction"] = None, + min_process_execution_time: Optional[str] = None, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = action_type self.custom_action = custom_action self.min_process_execution_time = min_process_execution_time -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -283,17 +116,22 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: + def __init__( + self, + *, + exe: Optional[str] = None, + parameters: Optional[str] = None, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = exe self.parameters = parameters -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2016_08_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2016_08_01.models.AutoHealActions @@ -304,13 +142,19 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + triggers: Optional["AutoHealTriggers"] = None, + actions: Optional["AutoHealActions"] = None, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = triggers self.actions = actions -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -318,11 +162,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2016_08_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2016_08_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2016_08_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2016_08_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -332,7 +174,15 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: + def __init__( + self, + *, + requests: Optional["RequestsBasedTrigger"] = None, + private_bytes_in_kb: Optional[int] = None, + status_codes: Optional[List["StatusCodesBasedTrigger"]] = None, + slow_requests: Optional["SlowRequestsBasedTrigger"] = None, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = requests self.private_bytes_in_kb = private_bytes_in_kb @@ -340,14 +190,13 @@ def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes self.slow_requests = slow_requests -class AzureBlobStorageApplicationLogsConfig(Model): +class AzureBlobStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs azure blob storage configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2016_08_01.models.LogLevel - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. @@ -356,30 +205,36 @@ class AzureBlobStorageApplicationLogsConfig(Model): """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, } - def __init__(self, *, level=None, sas_url: str=None, retention_in_days: int=None, **kwargs) -> None: + def __init__( + self, + *, + level: Optional[Union[str, "LogLevel"]] = None, + sas_url: Optional[str] = None, + retention_in_days: Optional[int] = None, + **kwargs + ): super(AzureBlobStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = level self.sas_url = sas_url self.retention_in_days = retention_in_days -class AzureBlobStorageHttpLogsConfig(Model): +class AzureBlobStorageHttpLogsConfig(msrest.serialization.Model): """Http logs to azure blob storage configuration. - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -389,23 +244,29 @@ class AzureBlobStorageHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, sas_url: str=None, retention_in_days: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + sas_url: Optional[str] = None, + retention_in_days: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(AzureBlobStorageHttpLogsConfig, self).__init__(**kwargs) self.sas_url = sas_url self.retention_in_days = retention_in_days self.enabled = enabled -class AzureTableStorageApplicationLogsConfig(Model): +class AzureTableStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs to Azure table storage configuration. All required parameters must be populated in order to send to Azure. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2016_08_01.models.LogLevel - :param sas_url: Required. SAS URL to an Azure table with add/query/delete - permissions. + :param sas_url: Required. SAS URL to an Azure table with add/query/delete permissions. :type sas_url: str """ @@ -414,22 +275,26 @@ class AzureTableStorageApplicationLogsConfig(Model): } _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } - def __init__(self, *, sas_url: str, level=None, **kwargs) -> None: + def __init__( + self, + *, + sas_url: str, + level: Optional[Union[str, "LogLevel"]] = None, + **kwargs + ): super(AzureTableStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = level self.sas_url = sas_url -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -454,7 +319,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -465,8 +335,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class BackupItem(ProxyOnlyResource): """Backup description. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -478,40 +347,35 @@ class BackupItem(ProxyOnlyResource): :vartype type: str :ivar backup_id: Id of the backup. :vartype backup_id: int - :ivar storage_account_url: SAS URL for the storage account container which - contains this backup. + :ivar storage_account_url: SAS URL for the storage account container which contains this + backup. :vartype storage_account_url: str :ivar blob_name: Name of the blob which contains data for this backup. :vartype blob_name: str - :ivar backup_item_name: Name of this backup. - :vartype backup_item_name: str - :ivar status: Backup status. Possible values include: 'InProgress', - 'Failed', 'Succeeded', 'TimedOut', 'Created', 'Skipped', - 'PartiallySucceeded', 'DeleteInProgress', 'DeleteFailed', 'Deleted' - :vartype status: str or - ~azure.mgmt.web.v2016_08_01.models.BackupItemStatus + :ivar name_properties_name: Name of this backup. + :vartype name_properties_name: str + :ivar status: Backup status. Possible values include: "InProgress", "Failed", "Succeeded", + "TimedOut", "Created", "Skipped", "PartiallySucceeded", "DeleteInProgress", "DeleteFailed", + "Deleted". + :vartype status: str or ~azure.mgmt.web.v2016_08_01.models.BackupItemStatus :ivar size_in_bytes: Size of the backup in bytes. :vartype size_in_bytes: long :ivar created: Timestamp of the backup creation. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar log: Details regarding this backup. Might contain an error message. :vartype log: str :ivar databases: List of databases included in the backup. - :vartype databases: - list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] - :ivar scheduled: True if this backup has been created due to a schedule - being triggered. + :vartype databases: list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] + :ivar scheduled: True if this backup has been created due to a schedule being triggered. :vartype scheduled: bool - :ivar last_restore_time_stamp: Timestamp of a last restore operation which - used this backup. - :vartype last_restore_time_stamp: datetime + :ivar last_restore_time_stamp: Timestamp of a last restore operation which used this backup. + :vartype last_restore_time_stamp: ~datetime.datetime :ivar finished_time_stamp: Timestamp when this backup finished. - :vartype finished_time_stamp: datetime - :ivar correlation_id: Unique correlation identifier. Please use this along - with the timestamp while communicating with Azure support. + :vartype finished_time_stamp: ~datetime.datetime + :ivar correlation_id: Unique correlation identifier. Please use this along with the timestamp + while communicating with Azure support. :vartype correlation_id: str - :ivar website_size_in_bytes: Size of the original web app which has been - backed up. + :ivar website_size_in_bytes: Size of the original web app which has been backed up. :vartype website_size_in_bytes: long """ @@ -522,7 +386,7 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'readonly': True}, 'storage_account_url': {'readonly': True}, 'blob_name': {'readonly': True}, - 'backup_item_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'status': {'readonly': True}, 'size_in_bytes': {'readonly': True}, 'created': {'readonly': True}, @@ -543,8 +407,8 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'key': 'properties.id', 'type': 'int'}, 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'blob_name': {'key': 'properties.blobName', 'type': 'str'}, - 'backup_item_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'BackupItemStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, 'created': {'key': 'properties.created', 'type': 'iso-8601'}, 'log': {'key': 'properties.log', 'type': 'str'}, @@ -556,12 +420,17 @@ class BackupItem(ProxyOnlyResource): 'website_size_in_bytes': {'key': 'properties.websiteSizeInBytes', 'type': 'long'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(BackupItem, self).__init__(kind=kind, **kwargs) self.backup_id = None self.storage_account_url = None self.blob_name = None - self.backup_item_name = None + self.name_properties_name = None self.status = None self.size_in_bytes = None self.created = None @@ -574,14 +443,45 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.website_size_in_bytes = None -class BackupRequest(ProxyOnlyResource): - """Description of a backup which will be performed. +class BackupItemCollection(msrest.serialization.Model): + """Collection of backup items. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.BackupItem] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BackupItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["BackupItem"], + **kwargs + ): + super(BackupItemCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class BackupRequest(ProxyOnlyResource): + """Description of a backup which will be performed. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -590,22 +490,20 @@ class BackupRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param backup_request_name: Required. Name of the backup. + :param backup_request_name: Name of the backup. :type backup_request_name: str - :param enabled: True if the backup schedule is enabled (must be included - in that case), false if the backup schedule should be disabled. + :param enabled: True if the backup schedule is enabled (must be included in that case), false + if the backup schedule should be disabled. :type enabled: bool - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str - :param backup_schedule: Schedule for the backup if it is executed - periodically. + :param backup_schedule: Schedule for the backup if it is executed periodically. :type backup_schedule: ~azure.mgmt.web.v2016_08_01.models.BackupSchedule :param databases: Databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] - :param backup_request_type: Type of the backup. Possible values include: - 'Default', 'Clone', 'Relocation', 'Snapshot' - :type backup_request_type: str or + :type databases: list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] + :param type_properties_type: Type of the backup. Possible values include: "Default", "Clone", + "Relocation", "Snapshot". + :type type_properties_type: str or ~azure.mgmt.web.v2016_08_01.models.BackupRestoreOperationType """ @@ -613,8 +511,6 @@ class BackupRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'backup_request_name': {'required': True}, - 'storage_account_url': {'required': True}, } _attribute_map = { @@ -627,49 +523,53 @@ class BackupRequest(ProxyOnlyResource): 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'backup_schedule': {'key': 'properties.backupSchedule', 'type': 'BackupSchedule'}, 'databases': {'key': 'properties.databases', 'type': '[DatabaseBackupSetting]'}, - 'backup_request_type': {'key': 'properties.type', 'type': 'BackupRestoreOperationType'}, - } - - def __init__(self, *, backup_request_name: str, storage_account_url: str, kind: str=None, enabled: bool=None, backup_schedule=None, databases=None, backup_request_type=None, **kwargs) -> None: + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + backup_request_name: Optional[str] = None, + enabled: Optional[bool] = None, + storage_account_url: Optional[str] = None, + backup_schedule: Optional["BackupSchedule"] = None, + databases: Optional[List["DatabaseBackupSetting"]] = None, + type_properties_type: Optional[Union[str, "BackupRestoreOperationType"]] = None, + **kwargs + ): super(BackupRequest, self).__init__(kind=kind, **kwargs) self.backup_request_name = backup_request_name self.enabled = enabled self.storage_account_url = storage_account_url self.backup_schedule = backup_schedule self.databases = databases - self.backup_request_type = backup_request_type + self.type_properties_type = type_properties_type -class BackupSchedule(Model): - """Description of a backup schedule. Describes how often should be the backup - performed and what should be the retention policy. +class BackupSchedule(msrest.serialization.Model): + """Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param frequency_interval: Required. How often the backup should be - executed (e.g. for weekly backup, this should be set to 7 and - FrequencyUnit should be set to Day). Default value: 7 . + :param frequency_interval: Required. How often the backup should be executed (e.g. for weekly + backup, this should be set to 7 and FrequencyUnit should be set to Day). :type frequency_interval: int - :param frequency_unit: Required. The unit of time for how often the backup - should be executed (e.g. for weekly backup, this should be set to Day and - FrequencyInterval should be set to 7). Possible values include: 'Day', - 'Hour'. Default value: "Day" . - :type frequency_unit: str or - ~azure.mgmt.web.v2016_08_01.models.FrequencyUnit - :param keep_at_least_one_backup: Required. True if the retention policy - should always keep at least one backup in the storage account, regardless - how old it is; false otherwise. Default value: True . + :param frequency_unit: Required. The unit of time for how often the backup should be executed + (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). + Possible values include: "Day", "Hour". Default value: "Day". + :type frequency_unit: str or ~azure.mgmt.web.v2016_08_01.models.FrequencyUnit + :param keep_at_least_one_backup: Required. True if the retention policy should always keep at + least one backup in the storage account, regardless how old it is; false otherwise. :type keep_at_least_one_backup: bool - :param retention_period_in_days: Required. After how many days backups - should be deleted. Default value: 30 . + :param retention_period_in_days: Required. After how many days backups should be deleted. :type retention_period_in_days: int :param start_time: When the schedule should start working. - :type start_time: datetime + :type start_time: ~datetime.datetime :ivar last_execution_time: Last time when this schedule was triggered. - :vartype last_execution_time: datetime + :vartype last_execution_time: ~datetime.datetime """ _validation = { @@ -682,14 +582,23 @@ class BackupSchedule(Model): _attribute_map = { 'frequency_interval': {'key': 'frequencyInterval', 'type': 'int'}, - 'frequency_unit': {'key': 'frequencyUnit', 'type': 'FrequencyUnit'}, + 'frequency_unit': {'key': 'frequencyUnit', 'type': 'str'}, 'keep_at_least_one_backup': {'key': 'keepAtLeastOneBackup', 'type': 'bool'}, 'retention_period_in_days': {'key': 'retentionPeriodInDays', 'type': 'int'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, } - def __init__(self, *, frequency_interval: int=7, frequency_unit="Day", keep_at_least_one_backup: bool=True, retention_period_in_days: int=30, start_time=None, **kwargs) -> None: + def __init__( + self, + *, + frequency_interval: int = 7, + frequency_unit: Union[str, "FrequencyUnit"] = "Day", + keep_at_least_one_backup: bool = True, + retention_period_in_days: int = 30, + start_time: Optional[datetime.datetime] = None, + **kwargs + ): super(BackupSchedule, self).__init__(**kwargs) self.frequency_interval = frequency_interval self.frequency_unit = frequency_unit @@ -699,75 +608,49 @@ def __init__(self, *, frequency_interval: int=7, frequency_unit="Day", keep_at_l self.last_execution_time = None -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: - super(Capability, self).__init__(**kwargs) - self.name = name - self.value = value - self.reason = reason - - -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. + :param ignore_quotas: :code:`true` if quotas should be ignored; otherwise, + :code:`false`. :type ignore_quotas: bool """ @@ -789,7 +672,22 @@ class CloningInfo(Model): 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, } - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, ignore_quotas: bool=None, **kwargs) -> None: + def __init__( + self, + *, + source_web_app_id: str, + correlation_id: Optional[str] = None, + overwrite: Optional[bool] = None, + clone_custom_host_names: Optional[bool] = None, + clone_source_control: Optional[bool] = None, + hosting_environment: Optional[str] = None, + app_settings_overrides: Optional[Dict[str, str]] = None, + configure_load_balancing: Optional[bool] = None, + traffic_manager_profile_id: Optional[str] = None, + traffic_manager_profile_name: Optional[str] = None, + ignore_quotas: Optional[bool] = None, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = correlation_id self.overwrite = overwrite @@ -804,19 +702,10 @@ def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrit self.ignore_quotas = ignore_quotas -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class ConnectionStringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -827,8 +716,7 @@ class ConnectionStringDictionary(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2016_08_01.models.ConnStringValueTypePair] + :type properties: dict[str, ~azure.mgmt.web.v2016_08_01.models.ConnStringValueTypePair] """ _validation = { @@ -845,47 +733,60 @@ class ConnectionStringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{ConnStringValueTypePair}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, "ConnStringValueTypePair"]] = None, + **kwargs + ): super(ConnectionStringDictionary, self).__init__(kind=kind, **kwargs) self.properties = properties -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_08_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + connection_string: Optional[str] = None, + type: Optional[Union[str, "ConnectionStringType"]] = None, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = name self.connection_string = connection_string self.type = type -class ConnStringValueTypePair(Model): +class ConnStringValueTypePair(msrest.serialization.Model): """Database connection string value to type pair. All required parameters must be populated in order to send to Azure. :param value: Required. Value of pair. :type value: str - :param type: Required. Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Required. Type of database. Possible values include: "MySql", "SQLServer", + "SQLAzure", "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", + "RedisCache", "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_08_01.models.ConnectionStringType """ @@ -896,10 +797,16 @@ class ConnStringValueTypePair(Model): _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, value: str, type, **kwargs) -> None: + def __init__( + self, + *, + value: str, + type: Union[str, "ConnectionStringType"], + **kwargs + ): super(ConnStringValueTypePair, self).__init__(**kwargs) self.value = value self.type = type @@ -908,8 +815,7 @@ def __init__(self, *, value: str, type, **kwargs) -> None: class ContinuousWebJob(ProxyOnlyResource): """Continuous Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -919,29 +825,26 @@ class ContinuousWebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param status: Job status. Possible values include: 'Initializing', - 'Starting', 'Running', 'PendingRestart', 'Stopped' - :type status: str or - ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobStatus + :param status: Job status. Possible values include: "Initializing", "Starting", "Running", + "PendingRestart", "Stopped". + :type status: str or ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobStatus :param detailed_status: Detailed status. :type detailed_status: str :param log_url: Log URL. :type log_url: str - :ivar continuous_web_job_name: Job name. Used as job identifier in ARM - resource URI. - :vartype continuous_web_job_name: str + :ivar name_properties_name: Job name. Used as job identifier in ARM resource URI. + :vartype name_properties_name: str :param run_command: Run command. :type run_command: str :param url: Job URL. :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param job_type: Job type. Possible values include: "Continuous", "Triggered". :type job_type: str or ~azure.mgmt.web.v2016_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -951,7 +854,7 @@ class ContinuousWebJob(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'continuous_web_job_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -959,25 +862,40 @@ class ContinuousWebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ContinuousWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'detailed_status': {'key': 'properties.detailedStatus', 'type': 'str'}, 'log_url': {'key': 'properties.logUrl', 'type': 'str'}, - 'continuous_web_job_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'run_command': {'key': 'properties.runCommand', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extraInfoUrl', 'type': 'str'}, - 'job_type': {'key': 'properties.jobType', 'type': 'WebJobType'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.usingSdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, status=None, detailed_status: str=None, log_url: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + status: Optional[Union[str, "ContinuousWebJobStatus"]] = None, + detailed_status: Optional[str] = None, + log_url: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(ContinuousWebJob, self).__init__(kind=kind, **kwargs) self.status = status self.detailed_status = detailed_status self.log_url = log_url - self.continuous_web_job_name = None + self.name_properties_name = None self.run_command = run_command self.url = url self.extra_info_url = extra_info_url @@ -987,11 +905,43 @@ def __init__(self, *, kind: str=None, status=None, detailed_status: str=None, lo self.settings = settings -class CorsSettings(Model): +class ContinuousWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob] + :param next_link: Link to next page of resources. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContinuousWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ContinuousWebJob"], + next_link: Optional[str] = None, + **kwargs + ): + super(ContinuousWebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] """ @@ -1000,41 +950,49 @@ class CorsSettings(Model): 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, } - def __init__(self, *, allowed_origins=None, **kwargs) -> None: + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = allowed_origins -class CsmPublishingProfileOptions(Model): +class CsmPublishingProfileOptions(msrest.serialization.Model): """Publishing options for requested profile. :param format: Name of the format. Valid values are: FileZilla3 WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2016_08_01.models.PublishingProfileFormat + Ftp. Possible values include: "FileZilla3", "WebDeploy", "Ftp". + :type format: str or ~azure.mgmt.web.v2016_08_01.models.PublishingProfileFormat """ _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, } - def __init__(self, *, format=None, **kwargs) -> None: + def __init__( + self, + *, + format: Optional[Union[str, "PublishingProfileFormat"]] = None, + **kwargs + ): super(CsmPublishingProfileOptions, self).__init__(**kwargs) self.format = format -class CsmSlotEntity(Model): +class CsmSlotEntity(msrest.serialization.Model): """Deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during swap - operation. + :param target_slot: Required. Destination deployment slot during swap operation. :type target_slot: str - :param preserve_vnet: Required. true to preserve Virtual - Network to the slot during swap; otherwise, false. + :param preserve_vnet: Required. :code:`true` to preserve Virtual Network to the + slot during swap; otherwise, :code:`false`. :type preserve_vnet: bool """ @@ -1048,19 +1006,25 @@ class CsmSlotEntity(Model): 'preserve_vnet': {'key': 'preserveVnet', 'type': 'bool'}, } - def __init__(self, *, target_slot: str, preserve_vnet: bool, **kwargs) -> None: + def __init__( + self, + *, + target_slot: str, + preserve_vnet: bool, + **kwargs + ): super(CsmSlotEntity, self).__init__(**kwargs) self.target_slot = target_slot self.preserve_vnet = preserve_vnet -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -1077,7 +1041,16 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=None, limit: int=None, name=None, **kwargs) -> None: + def __init__( + self, + *, + unit: Optional[str] = None, + next_reset_time: Optional[datetime.datetime] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["LocalizableString"] = None, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = unit self.next_reset_time = next_reset_time @@ -1086,11 +1059,44 @@ def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=N self.name = name +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmUsageQuota"], + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class CustomHostnameAnalysisResult(ProxyOnlyResource): """Custom domain analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1100,25 +1106,25 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar is_hostname_already_verified: true if hostname is - already verified; otherwise, false. + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. - Possible values include: 'Passed', 'Failed', 'Skipped' + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.web.v2016_08_01.models.DnsVerificationTestResult - :ivar custom_domain_verification_failure_info: Raw failure information if - DNS verification fails. + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. :vartype custom_domain_verification_failure_info: ~azure.mgmt.web.v2016_08_01.models.ErrorEntity - :ivar has_conflict_on_scale_unit: true if there is a conflict - on a scale unit; otherwise, false. + :ivar has_conflict_on_scale_unit: :code:`true` if there is a conflict on a scale + unit; otherwise, :code:`false`. :vartype has_conflict_on_scale_unit: bool - :ivar has_conflict_across_subscription: true if there is a - conflict across subscriptions; otherwise, false. + :ivar has_conflict_across_subscription: :code:`true` if there is a conflict across + subscriptions; otherwise, :code:`false`. :vartype has_conflict_across_subscription: bool - :ivar conflicting_app_resource_id: Name of the conflicting app on scale - unit if it's within the same subscription. + :ivar conflicting_app_resource_id: Name of the conflicting app on scale unit if it's within the + same subscription. :vartype conflicting_app_resource_id: str :param c_name_records: CName records controller can see for this hostname. :type c_name_records: list[str] @@ -1126,11 +1132,9 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type txt_records: list[str] :param a_records: A records controller can see for this hostname. :type a_records: list[str] - :param alternate_cname_records: Alternate CName records controller can see - for this hostname. - :type alternate_cname_records: list[str] - :param alternate_txt_records: Alternate TXT records controller can see for - this hostname. + :param alternate_c_name_records: Alternate CName records controller can see for this hostname. + :type alternate_c_name_records: list[str] + :param alternate_txt_records: Alternate TXT records controller can see for this hostname. :type alternate_txt_records: list[str] """ @@ -1152,7 +1156,7 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'DnsVerificationTestResult'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'ErrorEntity'}, 'has_conflict_on_scale_unit': {'key': 'properties.hasConflictOnScaleUnit', 'type': 'bool'}, 'has_conflict_across_subscription': {'key': 'properties.hasConflictAcrossSubscription', 'type': 'bool'}, @@ -1160,11 +1164,21 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_cname_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, } - def __init__(self, *, kind: str=None, c_name_records=None, txt_records=None, a_records=None, alternate_cname_records=None, alternate_txt_records=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + c_name_records: Optional[List[str]] = None, + txt_records: Optional[List[str]] = None, + a_records: Optional[List[str]] = None, + alternate_c_name_records: Optional[List[str]] = None, + alternate_txt_records: Optional[List[str]] = None, + **kwargs + ): super(CustomHostnameAnalysisResult, self).__init__(kind=kind, **kwargs) self.is_hostname_already_verified = None self.custom_domain_verification_test = None @@ -1175,28 +1189,27 @@ def __init__(self, *, kind: str=None, c_name_records=None, txt_records=None, a_r self.c_name_records = c_name_records self.txt_records = txt_records self.a_records = a_records - self.alternate_cname_records = alternate_cname_records + self.alternate_c_name_records = alternate_c_name_records self.alternate_txt_records = alternate_txt_records -class DatabaseBackupSetting(Model): +class DatabaseBackupSetting(msrest.serialization.Model): """Database backup settings. All required parameters must be populated in order to send to Azure. - :param database_type: Required. Database type (e.g. SqlAzure / MySql). - Possible values include: 'SqlAzure', 'MySql', 'LocalMySql', 'PostgreSql' - :type database_type: str or - ~azure.mgmt.web.v2016_08_01.models.DatabaseType + :param database_type: Required. Database type (e.g. SqlAzure / MySql). Possible values include: + "SqlAzure", "MySql", "LocalMySql", "PostgreSql". + :type database_type: str or ~azure.mgmt.web.v2016_08_01.models.DatabaseType :param name: :type name: str - :param connection_string_name: Contains a connection string name that is - linked to the SiteConfig.ConnectionStrings. + :param connection_string_name: Contains a connection string name that is linked to the + SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. :type connection_string_name: str - :param connection_string: Contains a connection string to a database which - is being backed up or restored. If the restore should happen to a new - database, the database name inside is the new one. + :param connection_string: Contains a connection string to a database which is being backed up + or restored. If the restore should happen to a new database, the database name inside is the + new one. :type connection_string: str """ @@ -1211,7 +1224,15 @@ class DatabaseBackupSetting(Model): 'connection_string': {'key': 'connectionString', 'type': 'str'}, } - def __init__(self, *, database_type, name: str=None, connection_string_name: str=None, connection_string: str=None, **kwargs) -> None: + def __init__( + self, + *, + database_type: Union[str, "DatabaseType"], + name: Optional[str] = None, + connection_string_name: Optional[str] = None, + connection_string: Optional[str] = None, + **kwargs + ): super(DatabaseBackupSetting, self).__init__(**kwargs) self.database_type = database_type self.name = name @@ -1222,8 +1243,7 @@ def __init__(self, *, database_type, name: str=None, connection_string_name: str class Deployment(ProxyOnlyResource): """User credentials used for publishing activity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1233,8 +1253,8 @@ class Deployment(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param deployment_id: Identifier for deployment. - :type deployment_id: str + :param id_properties_id: Identifier for deployment. + :type id_properties_id: str :param status: Deployment status. :type status: int :param message: Details about deployment status. @@ -1246,11 +1266,11 @@ class Deployment(ProxyOnlyResource): :param author_email: Author email. :type author_email: str :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime - :param active: True if deployment is currently active, false if completed - and null if not started. + :type end_time: ~datetime.datetime + :param active: True if deployment is currently active, false if completed and null if not + started. :type active: bool :param details: Details on deployment. :type details: str @@ -1267,7 +1287,7 @@ class Deployment(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'deployment_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'int'}, 'message': {'key': 'properties.message', 'type': 'str'}, 'author': {'key': 'properties.author', 'type': 'str'}, @@ -1279,9 +1299,24 @@ class Deployment(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, *, kind: str=None, deployment_id: str=None, status: int=None, message: str=None, author: str=None, deployer: str=None, author_email: str=None, start_time=None, end_time=None, active: bool=None, details: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[str] = None, + status: Optional[int] = None, + message: Optional[str] = None, + author: Optional[str] = None, + deployer: Optional[str] = None, + author_email: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + active: Optional[bool] = None, + details: Optional[str] = None, + **kwargs + ): super(Deployment, self).__init__(kind=kind, **kwargs) - self.deployment_id = deployment_id + self.id_properties_id = id_properties_id self.status = status self.message = message self.author = author @@ -1293,11 +1328,45 @@ def __init__(self, *, kind: str=None, deployment_id: str=None, status: int=None, self.details = details -class EnabledConfig(Model): +class DeploymentCollection(msrest.serialization.Model): + """Collection of app deployments. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Deployment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Deployment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Deployment"], + **kwargs + ): + super(DeploymentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EnabledConfig(msrest.serialization.Model): """Enabled configuration. - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -1305,12 +1374,17 @@ class EnabledConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(EnabledConfig, self).__init__(**kwargs) self.enabled = enabled -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -1336,7 +1410,17 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, extended_code: str=None, message_template: str=None, parameters=None, inner_errors=None, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["ErrorEntity"]] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = extended_code self.message_template = message_template @@ -1346,7 +1430,7 @@ def __init__(self, *, extended_code: str=None, message_template: str=None, param self.message = message -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -1357,33 +1441,42 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: + def __init__( + self, + *, + ramp_up_rules: Optional[List["RampUpRule"]] = None, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = ramp_up_rules -class FileSystemApplicationLogsConfig(Model): +class FileSystemApplicationLogsConfig(msrest.serialization.Model): """Application logs to file system configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error'. Default value: "Off" . + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2016_08_01.models.LogLevel """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, } - def __init__(self, *, level="Off", **kwargs) -> None: + def __init__( + self, + *, + level: Optional[Union[str, "LogLevel"]] = None, + **kwargs + ): super(FileSystemApplicationLogsConfig, self).__init__(**kwargs) self.level = level -class FileSystemHttpLogsConfig(Model): +class FileSystemHttpLogsConfig(msrest.serialization.Model): """Http logs to file system configuration. - :param retention_in_mb: Maximum size in megabytes that http log files can - use. + :param retention_in_mb: Maximum size in megabytes that http log files can use. When reached old log files will be removed to make space for new ones. Value can range between 25 and 100. :type retention_in_mb: int @@ -1391,8 +1484,8 @@ class FileSystemHttpLogsConfig(Model): Remove files older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -1406,7 +1499,14 @@ class FileSystemHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, retention_in_mb: int=None, retention_in_days: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + retention_in_mb: Optional[int] = None, + retention_in_days: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(FileSystemHttpLogsConfig, self).__init__(**kwargs) self.retention_in_mb = retention_in_mb self.retention_in_days = retention_in_days @@ -1416,8 +1516,7 @@ def __init__(self, *, retention_in_mb: int=None, retention_in_days: int=None, en class FunctionEnvelope(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1427,8 +1526,8 @@ class FunctionEnvelope(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar function_envelope_name: Function name. - :vartype function_envelope_name: str + :ivar name_properties_name: Function name. + :vartype name_properties_name: str :ivar function_app_id: Function App ID. :vartype function_app_id: str :param script_root_path_href: Script root path URI. @@ -1453,7 +1552,7 @@ class FunctionEnvelope(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'function_envelope_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'function_app_id': {'readonly': True}, } @@ -1462,7 +1561,7 @@ class FunctionEnvelope(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'function_envelope_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'function_app_id': {'key': 'properties.functionAppId', 'type': 'str'}, 'script_root_path_href': {'key': 'properties.scriptRootPathHref', 'type': 'str'}, 'script_href': {'key': 'properties.scriptHref', 'type': 'str'}, @@ -1474,9 +1573,22 @@ class FunctionEnvelope(ProxyOnlyResource): 'test_data': {'key': 'properties.testData', 'type': 'str'}, } - def __init__(self, *, kind: str=None, script_root_path_href: str=None, script_href: str=None, config_href: str=None, secrets_file_href: str=None, href: str=None, config=None, files=None, test_data: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + script_root_path_href: Optional[str] = None, + script_href: Optional[str] = None, + config_href: Optional[str] = None, + secrets_file_href: Optional[str] = None, + href: Optional[str] = None, + config: Optional[object] = None, + files: Optional[Dict[str, str]] = None, + test_data: Optional[str] = None, + **kwargs + ): super(FunctionEnvelope, self).__init__(kind=kind, **kwargs) - self.function_envelope_name = None + self.name_properties_name = None self.function_app_id = None self.script_root_path_href = script_root_path_href self.script_href = script_href @@ -1488,11 +1600,44 @@ def __init__(self, *, kind: str=None, script_root_path_href: str=None, script_hr self.test_data = test_data +class FunctionEnvelopeCollection(msrest.serialization.Model): + """Collection of Kudu function information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["FunctionEnvelope"], + **kwargs + ): + super(FunctionEnvelopeCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class FunctionSecrets(ProxyOnlyResource): """Function secrets. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1523,25 +1668,29 @@ class FunctionSecrets(ProxyOnlyResource): 'trigger_url': {'key': 'properties.triggerUrl', 'type': 'str'}, } - def __init__(self, *, kind: str=None, key: str=None, trigger_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key: Optional[str] = None, + trigger_url: Optional[str] = None, + **kwargs + ): super(FunctionSecrets, self).__init__(kind=kind, **kwargs) self.key = key self.trigger_url = trigger_url -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -1551,18 +1700,24 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: + def __init__( + self, + *, + extension: Optional[str] = None, + script_processor: Optional[str] = None, + arguments: Optional[str] = None, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = extension self.script_processor = script_processor self.arguments = arguments -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -1583,7 +1738,12 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = id self.name = None @@ -1593,8 +1753,7 @@ def __init__(self, *, id: str=None, **kwargs) -> None: class HostNameBinding(ProxyOnlyResource): """A hostname binding object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1610,25 +1769,21 @@ class HostNameBinding(ProxyOnlyResource): :type domain_id: str :param azure_resource_name: Azure resource name. :type azure_resource_name: str - :param azure_resource_type: Azure resource type. Possible values include: - 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2016_08_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Custom DNS record type. Possible - values include: 'CName', 'A' + :param azure_resource_type: Azure resource type. Possible values include: "Website", + "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2016_08_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Custom DNS record type. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2016_08_01.models.CustomHostNameDnsRecordType - :param host_name_type: Hostname type. Possible values include: 'Verified', - 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2016_08_01.models.HostNameType - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param host_name_type: Hostname type. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2016_08_01.models.HostNameType + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_08_01.models.SslState - :param thumbprint: SSL certificate thumbprint + :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :vartype virtual_ip: str """ @@ -1647,15 +1802,28 @@ class HostNameBinding(ProxyOnlyResource): 'site_name': {'key': 'properties.siteName', 'type': 'str'}, 'domain_id': {'key': 'properties.domainId', 'type': 'str'}, 'azure_resource_name': {'key': 'properties.azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'properties.hostNameType', 'type': 'HostNameType'}, - 'ssl_state': {'key': 'properties.sslState', 'type': 'SslState'}, + 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'properties.hostNameType', 'type': 'str'}, + 'ssl_state': {'key': 'properties.sslState', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'virtual_ip': {'key': 'properties.virtualIP', 'type': 'str'}, } - def __init__(self, *, kind: str=None, site_name: str=None, domain_id: str=None, azure_resource_name: str=None, azure_resource_type=None, custom_host_name_dns_record_type=None, host_name_type=None, ssl_state=None, thumbprint: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + site_name: Optional[str] = None, + domain_id: Optional[str] = None, + azure_resource_name: Optional[str] = None, + azure_resource_type: Optional[Union[str, "AzureResourceType"]] = None, + custom_host_name_dns_record_type: Optional[Union[str, "CustomHostNameDnsRecordType"]] = None, + host_name_type: Optional[Union[str, "HostNameType"]] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + thumbprint: Optional[str] = None, + **kwargs + ): super(HostNameBinding, self).__init__(kind=kind, **kwargs) self.site_name = site_name self.domain_id = domain_id @@ -1668,36 +1836,79 @@ def __init__(self, *, kind: str=None, site_name: str=None, domain_id: str=None, self.virtual_ip = None -class HostNameSslState(Model): +class HostNameBindingCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.HostNameBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostNameBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["HostNameBinding"], + **kwargs + ): + super(HostNameBindingCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_08_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2016_08_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: + 'host_type': {'key': 'hostType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + virtual_ip: Optional[str] = None, + thumbprint: Optional[str] = None, + to_update: Optional[bool] = None, + host_type: Optional[Union[str, "HostType"]] = None, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = name self.ssl_state = ssl_state @@ -1707,15 +1918,13 @@ def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thum self.host_type = host_type -class HttpLogsConfig(Model): +class HttpLogsConfig(msrest.serialization.Model): """Http logs configuration. :param file_system: Http logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2016_08_01.models.FileSystemHttpLogsConfig + :type file_system: ~azure.mgmt.web.v2016_08_01.models.FileSystemHttpLogsConfig :param azure_blob_storage: Http logs to azure blob storage configuration. - :type azure_blob_storage: - ~azure.mgmt.web.v2016_08_01.models.AzureBlobStorageHttpLogsConfig + :type azure_blob_storage: ~azure.mgmt.web.v2016_08_01.models.AzureBlobStorageHttpLogsConfig """ _attribute_map = { @@ -1723,7 +1932,13 @@ class HttpLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageHttpLogsConfig'}, } - def __init__(self, *, file_system=None, azure_blob_storage=None, **kwargs) -> None: + def __init__( + self, + *, + file_system: Optional["FileSystemHttpLogsConfig"] = None, + azure_blob_storage: Optional["AzureBlobStorageHttpLogsConfig"] = None, + **kwargs + ): super(HttpLogsConfig, self).__init__(**kwargs) self.file_system = file_system self.azure_blob_storage = azure_blob_storage @@ -1732,8 +1947,7 @@ def __init__(self, *, file_system=None, azure_blob_storage=None, **kwargs) -> No class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1753,15 +1967,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -1786,7 +2000,20 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + service_bus_namespace: Optional[str] = None, + relay_name: Optional[str] = None, + relay_arm_uri: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + send_key_name: Optional[str] = None, + send_key_value: Optional[str] = None, + service_bus_suffix: Optional[str] = None, + **kwargs + ): super(HybridConnection, self).__init__(kind=kind, **kwargs) self.service_bus_namespace = service_bus_namespace self.relay_name = relay_name @@ -1799,11 +2026,9 @@ def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_nam class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1836,7 +2061,12 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) self.send_key_name = None self.send_key_value = None @@ -1845,8 +2075,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1856,8 +2085,8 @@ class Identifier(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str + :param id_properties_id: String representation of the identity. + :type id_properties_id: str """ _validation = { @@ -1871,24 +2100,62 @@ class Identifier(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[str] = None, + **kwargs + ): super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id + self.id_properties_id = id_properties_id + +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. -class IpSecurityRestriction(Model): + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Identifier"], + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP address the security restriction is valid - for. + :param ip_address: Required. IP address the security restriction is valid for. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str """ @@ -1901,13 +2168,19 @@ class IpSecurityRestriction(Model): 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, } - def __init__(self, *, ip_address: str, subnet_mask: str=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: str, + subnet_mask: Optional[str] = None, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = ip_address self.subnet_mask = subnet_mask -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -1921,22 +2194,25 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = value self.localized_value = localized_value -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned". + :type type: str or ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. @@ -1954,7 +2230,12 @@ class ManagedServiceIdentity(Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, } - def __init__(self, *, type=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = type self.tenant_id = None @@ -1964,10 +2245,7 @@ def __init__(self, *, type=None, **kwargs) -> None: class MigrateMySqlRequest(ProxyOnlyResource): """MySQL migration request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1977,21 +2255,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param connection_string: Required. Connection string to the remote MySQL - database. + :param connection_string: Connection string to the remote MySQL database. :type connection_string: str - :param migration_type: Required. The type of migration operation to be - done. Possible values include: 'LocalToRemote', 'RemoteToLocal' - :type migration_type: str or - ~azure.mgmt.web.v2016_08_01.models.MySqlMigrationType + :param migration_type: The type of migration operation to be done. Possible values include: + "LocalToRemote", "RemoteToLocal". + :type migration_type: str or ~azure.mgmt.web.v2016_08_01.models.MySqlMigrationType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'connection_string': {'required': True}, - 'migration_type': {'required': True}, } _attribute_map = { @@ -2000,10 +2274,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'migration_type': {'key': 'properties.migrationType', 'type': 'MySqlMigrationType'}, + 'migration_type': {'key': 'properties.migrationType', 'type': 'str'}, } - def __init__(self, *, connection_string: str, migration_type, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + connection_string: Optional[str] = None, + migration_type: Optional[Union[str, "MySqlMigrationType"]] = None, + **kwargs + ): super(MigrateMySqlRequest, self).__init__(kind=kind, **kwargs) self.connection_string = connection_string self.migration_type = migration_type @@ -2012,8 +2293,7 @@ def __init__(self, *, connection_string: str, migration_type, kind: str=None, ** class MigrateMySqlStatus(ProxyOnlyResource): """MySQL migration status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2023,13 +2303,12 @@ class MigrateMySqlStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar migration_operation_status: Status of the migration task. Possible - values include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' - :vartype migration_operation_status: str or - ~azure.mgmt.web.v2016_08_01.models.OperationStatus + :ivar migration_operation_status: Status of the migration task. Possible values include: + "InProgress", "Failed", "Succeeded", "TimedOut", "Created". + :vartype migration_operation_status: str or ~azure.mgmt.web.v2016_08_01.models.OperationStatus :ivar operation_id: Operation ID for the migration task. :vartype operation_id: str - :ivar local_my_sql_enabled: True if the web app has in app MySql enabled + :ivar local_my_sql_enabled: True if the web app has in app MySql enabled. :vartype local_my_sql_enabled: bool """ @@ -2047,12 +2326,17 @@ class MigrateMySqlStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'OperationStatus'}, + 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'str'}, 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, 'local_my_sql_enabled': {'key': 'properties.localMySqlEnabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MigrateMySqlStatus, self).__init__(kind=kind, **kwargs) self.migration_operation_status = None self.operation_id = None @@ -2062,8 +2346,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class MSDeploy(ProxyOnlyResource): """MSDeploy ARM PUT information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2073,29 +2356,24 @@ class MSDeploy(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param package_uri: Package URI + :param package_uri: Package URI. :type package_uri: str - :param connection_string: SQL Connection String + :param connection_string: SQL Connection String. :type connection_string: str - :param db_type: Database Type + :param db_type: Database Type. :type db_type: str - :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must - not be set if SetParameters is used. + :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must not be set if + SetParameters is used. :type set_parameters_xml_file_uri: str - :param set_parameters: MSDeploy Parameters. Must not be set if - SetParametersXmlFileUri is used. + :param set_parameters: MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. :type set_parameters: dict[str, str] - :param skip_app_data: Controls whether the MSDeploy operation skips the - App_Data directory. - If set to true, the existing App_Data directory on the - destination - will not be deleted, and any App_Data directory in the source will be - ignored. - Setting is false by default. + :param skip_app_data: Controls whether the MSDeploy operation skips the App_Data directory. + If set to :code:`true`, the existing App_Data directory on the destination + will not be deleted, and any App_Data directory in the source will be ignored. + Setting is :code:`false` by default. :type skip_app_data: bool - :param app_offline: Sets the AppOffline rule while the MSDeploy operation - executes. - Setting is false by default. + :param app_offline: Sets the AppOffline rule while the MSDeploy operation executes. + Setting is :code:`false` by default. :type app_offline: bool """ @@ -2119,7 +2397,19 @@ class MSDeploy(ProxyOnlyResource): 'app_offline': {'key': 'properties.appOffline', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, package_uri: str=None, connection_string: str=None, db_type: str=None, set_parameters_xml_file_uri: str=None, set_parameters=None, skip_app_data: bool=None, app_offline: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + package_uri: Optional[str] = None, + connection_string: Optional[str] = None, + db_type: Optional[str] = None, + set_parameters_xml_file_uri: Optional[str] = None, + set_parameters: Optional[Dict[str, str]] = None, + skip_app_data: Optional[bool] = None, + app_offline: Optional[bool] = None, + **kwargs + ): super(MSDeploy, self).__init__(kind=kind, **kwargs) self.package_uri = package_uri self.connection_string = connection_string @@ -2133,8 +2423,7 @@ def __init__(self, *, kind: str=None, package_uri: str=None, connection_string: class MSDeployLog(ProxyOnlyResource): """MSDeploy log. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2144,9 +2433,8 @@ class MSDeployLog(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar entries: List of log entry messages - :vartype entries: - list[~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntry] + :ivar entries: List of log entry messages. + :vartype entries: list[~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntry] """ _validation = { @@ -2164,24 +2452,26 @@ class MSDeployLog(ProxyOnlyResource): 'entries': {'key': 'properties.entries', 'type': '[MSDeployLogEntry]'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MSDeployLog, self).__init__(kind=kind, **kwargs) self.entries = None -class MSDeployLogEntry(Model): +class MSDeployLogEntry(msrest.serialization.Model): """MSDeploy log entry. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar time: Timestamp of log entry - :vartype time: datetime - :ivar type: Log entry type. Possible values include: 'Message', 'Warning', - 'Error' - :vartype type: str or - ~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntryType - :ivar message: Log entry message + :ivar time: Timestamp of log entry. + :vartype time: ~datetime.datetime + :ivar type: Log entry type. Possible values include: "Message", "Warning", "Error". + :vartype type: str or ~azure.mgmt.web.v2016_08_01.models.MSDeployLogEntryType + :ivar message: Log entry message. :vartype message: str """ @@ -2193,11 +2483,14 @@ class MSDeployLogEntry(Model): _attribute_map = { 'time': {'key': 'time', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'MSDeployLogEntryType'}, + 'type': {'key': 'type', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(MSDeployLogEntry, self).__init__(**kwargs) self.time = None self.type = None @@ -2207,8 +2500,7 @@ def __init__(self, **kwargs) -> None: class MSDeployStatus(ProxyOnlyResource): """MSDeploy ARM response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2218,17 +2510,17 @@ class MSDeployStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deployer: Username of deployer + :ivar deployer: Username of deployer. :vartype deployer: str - :ivar provisioning_state: Provisioning state. Possible values include: - 'accepted', 'running', 'succeeded', 'failed', 'canceled' + :ivar provisioning_state: Provisioning state. Possible values include: "accepted", "running", + "succeeded", "failed", "canceled". :vartype provisioning_state: str or ~azure.mgmt.web.v2016_08_01.models.MSDeployProvisioningState - :ivar start_time: Start time of deploy operation - :vartype start_time: datetime - :ivar end_time: End time of deploy operation - :vartype end_time: datetime - :ivar complete: Whether the deployment operation has completed + :ivar start_time: Start time of deploy operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of deploy operation. + :vartype end_time: ~datetime.datetime + :ivar complete: Whether the deployment operation has completed. :vartype complete: bool """ @@ -2249,13 +2541,18 @@ class MSDeployStatus(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'deployer': {'key': 'properties.deployer', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'MSDeployProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'complete': {'key': 'properties.complete', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MSDeployStatus, self).__init__(kind=kind, **kwargs) self.deployer = None self.provisioning_state = None @@ -2264,7 +2561,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.complete = None -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -2278,18 +2575,22 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = name self.value = value class NetworkFeatures(ProxyOnlyResource): - """Full view of network features for an app (presently VNET integration and - Hybrid Connections). + """Full view of network features for an app (presently VNET integration and Hybrid Connections). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2302,14 +2603,12 @@ class NetworkFeatures(ProxyOnlyResource): :ivar virtual_network_name: The Virtual Network name. :vartype virtual_network_name: str :ivar virtual_network_connection: The Virtual Network summary view. - :vartype virtual_network_connection: - ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :vartype virtual_network_connection: ~azure.mgmt.web.v2016_08_01.models.VnetInfo :ivar hybrid_connections: The Hybrid Connections summary view. :vartype hybrid_connections: list[~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity] :ivar hybrid_connections_v2: The Hybrid Connection V2 (Service Bus) view. - :vartype hybrid_connections_v2: - list[~azure.mgmt.web.v2016_08_01.models.HybridConnection] + :vartype hybrid_connections_v2: list[~azure.mgmt.web.v2016_08_01.models.HybridConnection] """ _validation = { @@ -2333,7 +2632,12 @@ class NetworkFeatures(ProxyOnlyResource): 'hybrid_connections_v2': {'key': 'properties.hybridConnectionsV2', 'type': '[HybridConnection]'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(NetworkFeatures, self).__init__(kind=kind, **kwargs) self.virtual_network_name = None self.virtual_network_connection = None @@ -2341,24 +2645,24 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.hybrid_connections_v2 = None -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2016_08_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2016_08_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -2366,7 +2670,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -2374,7 +2678,19 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, created_time=None, modified_time=None, expiration_time=None, geo_master_operation_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "OperationStatus"]] = None, + errors: Optional[List["ErrorEntity"]] = None, + created_time: Optional[datetime.datetime] = None, + modified_time: Optional[datetime.datetime] = None, + expiration_time: Optional[datetime.datetime] = None, + geo_master_operation_id: Optional[str] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = id self.name = name @@ -2386,7 +2702,41 @@ def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, cr self.geo_master_operation_id = geo_master_operation_id -class PerfMonResponse(Model): +class PerfMonCounterCollection(msrest.serialization.Model): + """Collection of performance monitor counters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.PerfMonResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PerfMonResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PerfMonResponse"], + **kwargs + ): + super(PerfMonCounterCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PerfMonResponse(msrest.serialization.Model): """Performance monitor API response. :param code: The response code. @@ -2403,23 +2753,30 @@ class PerfMonResponse(Model): 'data': {'key': 'data', 'type': 'PerfMonSet'}, } - def __init__(self, *, code: str=None, message: str=None, data=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + data: Optional["PerfMonSet"] = None, + **kwargs + ): super(PerfMonResponse, self).__init__(**kwargs) self.code = code self.message = message self.data = data -class PerfMonSample(Model): +class PerfMonSample(msrest.serialization.Model): """Performance monitor sample in a set. :param time: Point in time for which counter was measured. - :type time: datetime + :type time: ~datetime.datetime :param instance_name: Name of the server on which the measurement is made. :type instance_name: str :param value: Value of counter at a certain time. :type value: float - :param core_count: Core Count of worker. Not a data member + :param core_count: Core Count of worker. Not a data member. :type core_count: int """ @@ -2430,7 +2787,15 @@ class PerfMonSample(Model): 'core_count': {'key': 'coreCount', 'type': 'int'}, } - def __init__(self, *, time=None, instance_name: str=None, value: float=None, core_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + time: Optional[datetime.datetime] = None, + instance_name: Optional[str] = None, + value: Optional[float] = None, + core_count: Optional[int] = None, + **kwargs + ): super(PerfMonSample, self).__init__(**kwargs) self.time = time self.instance_name = instance_name @@ -2438,15 +2803,15 @@ def __init__(self, *, time=None, instance_name: str=None, value: float=None, cor self.core_count = core_count -class PerfMonSet(Model): +class PerfMonSet(msrest.serialization.Model): """Metric information. :param name: Unique key name of the counter. :type name: str :param start_time: Start time of the period. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time of the period. - :type end_time: datetime + :type end_time: ~datetime.datetime :param time_grain: Presented time grain. :type time_grain: str :param values: Collection of workers that are active during this time. @@ -2461,7 +2826,16 @@ class PerfMonSet(Model): 'values': {'key': 'values', 'type': '[PerfMonSample]'}, } - def __init__(self, *, name: str=None, start_time=None, end_time=None, time_grain: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + values: Optional[List["PerfMonSample"]] = None, + **kwargs + ): super(PerfMonSet, self).__init__(**kwargs) self.name = name self.start_time = start_time @@ -2470,11 +2844,64 @@ def __init__(self, *, name: str=None, start_time=None, end_time=None, time_grain self.values = values +class Resource(msrest.serialization.Model): + """Azure resource. This resource is tracked in Azure Resource Manager. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :param location: Required. Resource Location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = kind + self.location = location + self.type = None + self.tags = tags + + class PremierAddOn(Resource): """Premier add-on. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2488,7 +2915,7 @@ class PremierAddOn(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Premier add on SKU. :type sku: str @@ -2498,10 +2925,10 @@ class PremierAddOn(Resource): :type vendor: str :param premier_add_on_name: Premier add on Name. :type premier_add_on_name: str - :param premier_add_on_location: Premier add on Location. - :type premier_add_on_location: str - :param premier_add_on_tags: Premier add on Tags. - :type premier_add_on_tags: dict[str, str] + :param location_properties_location: Premier add on Location. + :type location_properties_location: str + :param tags_properties_tags: Premier add on Tags. + :type tags_properties_tags: dict[str, str] :param marketplace_publisher: Premier add on Marketplace publisher. :type marketplace_publisher: str :param marketplace_offer: Premier add on Marketplace offer. @@ -2526,20 +2953,35 @@ class PremierAddOn(Resource): 'product': {'key': 'properties.product', 'type': 'str'}, 'vendor': {'key': 'properties.vendor', 'type': 'str'}, 'premier_add_on_name': {'key': 'properties.name', 'type': 'str'}, - 'premier_add_on_location': {'key': 'properties.location', 'type': 'str'}, - 'premier_add_on_tags': {'key': 'properties.tags', 'type': '{str}'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'tags_properties_tags': {'key': 'properties.tags', 'type': '{str}'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, sku: str=None, product: str=None, vendor: str=None, premier_add_on_name: str=None, premier_add_on_location: str=None, premier_add_on_tags=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + premier_add_on_name: Optional[str] = None, + location_properties_location: Optional[str] = None, + tags_properties_tags: Optional[Dict[str, str]] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOn, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.sku = sku self.product = product self.vendor = vendor self.premier_add_on_name = premier_add_on_name - self.premier_add_on_location = premier_add_on_location - self.premier_add_on_tags = premier_add_on_tags + self.location_properties_location = location_properties_location + self.tags_properties_tags = tags_properties_tags self.marketplace_publisher = marketplace_publisher self.marketplace_offer = marketplace_offer @@ -2547,8 +2989,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, sku: str=None, p class ProcessInfo(ProxyOnlyResource): """Process Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2558,17 +2999,17 @@ class ProcessInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param process_info_id: ARM Identifier for deployment. - :type process_info_id: int - :param process_info_name: Deployment name. - :type process_info_name: str + :param id_properties_id: ARM Identifier for deployment. + :type id_properties_id: int + :param name_properties_name: Deployment name. + :type name_properties_name: str :param href: HRef URI. :type href: str :param mini_dump: Minidump URI. :type mini_dump: str - :param is_profile_running: Is profile running? + :param is_profile_running: Is profile running?. :type is_profile_running: bool - :param is_iis_profile_running: Is the IIS Profile running? + :param is_iis_profile_running: Is the IIS Profile running?. :type is_iis_profile_running: bool :param iis_profile_timeout_in_seconds: IIS Profile timeout (seconds). :type iis_profile_timeout_in_seconds: float @@ -2595,7 +3036,7 @@ class ProcessInfo(ProxyOnlyResource): :param thread_count: Thread count. :type thread_count: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total CPU time. :type total_processor_time: str :param user_processor_time: User CPU time. @@ -2621,12 +3062,12 @@ class ProcessInfo(ProxyOnlyResource): :param peak_paged_memory_size64: Peak paged memory. :type peak_paged_memory_size64: long :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime :param environment_variables: List of environment variables. :type environment_variables: dict[str, str] - :param is_scm_site: Is this the SCM site? + :param is_scm_site: Is this the SCM site?. :type is_scm_site: bool - :param is_web_job: Is this a Web Job? + :param is_web_job: Is this a Web Job?. :type is_web_job: bool :param description: Description of process. :type description: str @@ -2643,8 +3084,8 @@ class ProcessInfo(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'process_info_id': {'key': 'properties.id', 'type': 'int'}, - 'process_info_name': {'key': 'properties.name', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'int'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'href': {'key': 'properties.href', 'type': 'str'}, 'mini_dump': {'key': 'properties.miniDump', 'type': 'str'}, 'is_profile_running': {'key': 'properties.isProfileRunning', 'type': 'bool'}, @@ -2681,10 +3122,51 @@ class ProcessInfo(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, process_info_id: int=None, process_info_name: str=None, href: str=None, mini_dump: str=None, is_profile_running: bool=None, is_iis_profile_running: bool=None, iis_profile_timeout_in_seconds: float=None, parent: str=None, children=None, threads=None, open_file_handles=None, modules=None, file_name: str=None, command_line: str=None, user_name: str=None, handle_count: int=None, module_count: int=None, thread_count: int=None, start_time=None, total_processor_time: str=None, user_processor_time: str=None, privileged_processor_time: str=None, working_set64: int=None, peak_working_set64: int=None, private_memory_size64: int=None, virtual_memory_size64: int=None, peak_virtual_memory_size64: int=None, paged_system_memory_size64: int=None, nonpaged_system_memory_size64: int=None, paged_memory_size64: int=None, peak_paged_memory_size64: int=None, time_stamp=None, environment_variables=None, is_scm_site: bool=None, is_web_job: bool=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[int] = None, + name_properties_name: Optional[str] = None, + href: Optional[str] = None, + mini_dump: Optional[str] = None, + is_profile_running: Optional[bool] = None, + is_iis_profile_running: Optional[bool] = None, + iis_profile_timeout_in_seconds: Optional[float] = None, + parent: Optional[str] = None, + children: Optional[List[str]] = None, + threads: Optional[List["ProcessThreadInfo"]] = None, + open_file_handles: Optional[List[str]] = None, + modules: Optional[List["ProcessModuleInfo"]] = None, + file_name: Optional[str] = None, + command_line: Optional[str] = None, + user_name: Optional[str] = None, + handle_count: Optional[int] = None, + module_count: Optional[int] = None, + thread_count: Optional[int] = None, + start_time: Optional[datetime.datetime] = None, + total_processor_time: Optional[str] = None, + user_processor_time: Optional[str] = None, + privileged_processor_time: Optional[str] = None, + working_set64: Optional[int] = None, + peak_working_set64: Optional[int] = None, + private_memory_size64: Optional[int] = None, + virtual_memory_size64: Optional[int] = None, + peak_virtual_memory_size64: Optional[int] = None, + paged_system_memory_size64: Optional[int] = None, + nonpaged_system_memory_size64: Optional[int] = None, + paged_memory_size64: Optional[int] = None, + peak_paged_memory_size64: Optional[int] = None, + time_stamp: Optional[datetime.datetime] = None, + environment_variables: Optional[Dict[str, str]] = None, + is_scm_site: Optional[bool] = None, + is_web_job: Optional[bool] = None, + description: Optional[str] = None, + **kwargs + ): super(ProcessInfo, self).__init__(kind=kind, **kwargs) - self.process_info_id = process_info_id - self.process_info_name = process_info_name + self.id_properties_id = id_properties_id + self.name_properties_name = name_properties_name self.href = href self.mini_dump = mini_dump self.is_profile_running = is_profile_running @@ -2721,11 +3203,44 @@ def __init__(self, *, kind: str=None, process_info_id: int=None, process_info_na self.description = description +class ProcessInfoCollection(msrest.serialization.Model): + """Collection of Kudu process information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ProcessInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessInfo"], + **kwargs + ): + super(ProcessInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ProcessModuleInfo(ProxyOnlyResource): """Process Module Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2735,8 +3250,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param base_address: Base address. Used as module identifier in ARM - resource URI. + :param base_address: Base address. Used as module identifier in ARM resource URI. :type base_address: str :param file_name: File name. :type file_name: str @@ -2754,7 +3268,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type product: str :param product_version: Product version. :type product_version: str - :param is_debug: Is debug? + :param is_debug: Is debug?. :type is_debug: bool :param language: Module language (locale). :type language: str @@ -2784,7 +3298,23 @@ class ProcessModuleInfo(ProxyOnlyResource): 'language': {'key': 'properties.language', 'type': 'str'}, } - def __init__(self, *, kind: str=None, base_address: str=None, file_name: str=None, href: str=None, file_path: str=None, module_memory_size: int=None, file_version: str=None, file_description: str=None, product: str=None, product_version: str=None, is_debug: bool=None, language: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + base_address: Optional[str] = None, + file_name: Optional[str] = None, + href: Optional[str] = None, + file_path: Optional[str] = None, + module_memory_size: Optional[int] = None, + file_version: Optional[str] = None, + file_description: Optional[str] = None, + product: Optional[str] = None, + product_version: Optional[str] = None, + is_debug: Optional[bool] = None, + language: Optional[str] = None, + **kwargs + ): super(ProcessModuleInfo, self).__init__(kind=kind, **kwargs) self.base_address = base_address self.file_name = file_name @@ -2799,11 +3329,44 @@ def __init__(self, *, kind: str=None, base_address: str=None, file_name: str=Non self.language = language +class ProcessModuleInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessModuleInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessModuleInfo"], + **kwargs + ): + super(ProcessModuleInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ProcessThreadInfo(ProxyOnlyResource): """Process Thread Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2813,8 +3376,8 @@ class ProcessThreadInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param process_thread_info_id: ARM Identifier for deployment. - :type process_thread_info_id: int + :param id_properties_id: ARM Identifier for deployment. + :type id_properties_id: int :param href: HRef URI. :type href: str :param process: Process URI. @@ -2828,7 +3391,7 @@ class ProcessThreadInfo(ProxyOnlyResource): :param base_priority: Base priority. :type base_priority: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total processor time. :type total_processor_time: str :param user_processor_time: User processor time. @@ -2852,7 +3415,7 @@ class ProcessThreadInfo(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'process_thread_info_id': {'key': 'properties.id', 'type': 'int'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'int'}, 'href': {'key': 'properties.href', 'type': 'str'}, 'process': {'key': 'properties.process', 'type': 'str'}, 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, @@ -2867,9 +3430,27 @@ class ProcessThreadInfo(ProxyOnlyResource): 'wait_reason': {'key': 'properties.waitReason', 'type': 'str'}, } - def __init__(self, *, kind: str=None, process_thread_info_id: int=None, href: str=None, process: str=None, start_address: str=None, current_priority: int=None, priority_level: str=None, base_priority: int=None, start_time=None, total_processor_time: str=None, user_processor_time: str=None, priviledged_processor_time: str=None, state: str=None, wait_reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[int] = None, + href: Optional[str] = None, + process: Optional[str] = None, + start_address: Optional[str] = None, + current_priority: Optional[int] = None, + priority_level: Optional[str] = None, + base_priority: Optional[int] = None, + start_time: Optional[datetime.datetime] = None, + total_processor_time: Optional[str] = None, + user_processor_time: Optional[str] = None, + priviledged_processor_time: Optional[str] = None, + state: Optional[str] = None, + wait_reason: Optional[str] = None, + **kwargs + ): super(ProcessThreadInfo, self).__init__(kind=kind, **kwargs) - self.process_thread_info_id = process_thread_info_id + self.id_properties_id = id_properties_id self.href = href self.process = process self.start_address = start_address @@ -2884,11 +3465,44 @@ def __init__(self, *, kind: str=None, process_thread_info_id: int=None, href: st self.wait_reason = wait_reason +class ProcessThreadInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessThreadInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessThreadInfo"], + **kwargs + ): + super(ProcessThreadInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class PublicCertificate(ProxyOnlyResource): """Public certificate object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2898,13 +3512,13 @@ class PublicCertificate(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param blob: Public Certificate byte array + :param blob: Public Certificate byte array. :type blob: bytearray - :param public_certificate_location: Public Certificate Location. Possible - values include: 'CurrentUserMy', 'LocalMachineMy', 'Unknown' + :param public_certificate_location: Public Certificate Location. Possible values include: + "CurrentUserMy", "LocalMachineMy", "Unknown". :type public_certificate_location: str or ~azure.mgmt.web.v2016_08_01.models.PublicCertificateLocation - :ivar thumbprint: Certificate Thumbprint + :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str """ @@ -2916,29 +3530,67 @@ class PublicCertificate(ProxyOnlyResource): } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, - 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'PublicCertificateLocation'}, - 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, + 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + blob: Optional[bytearray] = None, + public_certificate_location: Optional[Union[str, "PublicCertificateLocation"]] = None, + **kwargs + ): + super(PublicCertificate, self).__init__(kind=kind, **kwargs) + self.blob = blob + self.public_certificate_location = public_certificate_location + self.thumbprint = None + + +class PublicCertificateCollection(msrest.serialization.Model): + """Collection of public certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.PublicCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublicCertificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, blob: bytearray=None, public_certificate_location=None, **kwargs) -> None: - super(PublicCertificate, self).__init__(kind=kind, **kwargs) - self.blob = blob - self.public_certificate_location = public_certificate_location - self.thumbprint = None + def __init__( + self, + *, + value: List["PublicCertificate"], + **kwargs + ): + super(PublicCertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None class PushSettings(ProxyOnlyResource): """Push settings for the App. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2948,22 +3600,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -2971,7 +3620,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -2985,7 +3633,16 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + is_push_enabled: Optional[bool] = None, + tag_whitelist_json: Optional[str] = None, + tags_requiring_auth: Optional[str] = None, + dynamic_tags_json: Optional[str] = None, + **kwargs + ): super(PushSettings, self).__init__(kind=kind, **kwargs) self.is_push_enabled = is_push_enabled self.tag_whitelist_json = tag_whitelist_json @@ -2993,40 +3650,38 @@ def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: self.dynamic_tags_json = dynamic_tags_json -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -3041,7 +3696,19 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_host_name: Optional[str] = None, + reroute_percentage: Optional[float] = None, + change_step: Optional[float] = None, + change_interval_in_minutes: Optional[int] = None, + min_reroute_percentage: Optional[float] = None, + max_reroute_percentage: Optional[float] = None, + change_decision_callback_url: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = action_host_name self.reroute_percentage = reroute_percentage @@ -3056,8 +3723,7 @@ def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None class RelayServiceConnectionEntity(ProxyOnlyResource): """Hybrid Connection for an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3103,7 +3769,19 @@ class RelayServiceConnectionEntity(ProxyOnlyResource): 'biztalk_uri': {'key': 'properties.biztalkUri', 'type': 'str'}, } - def __init__(self, *, kind: str=None, entity_name: str=None, entity_connection_string: str=None, resource_type: str=None, resource_connection_string: str=None, hostname: str=None, port: int=None, biztalk_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + entity_name: Optional[str] = None, + entity_connection_string: Optional[str] = None, + resource_type: Optional[str] = None, + resource_connection_string: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + biztalk_uri: Optional[str] = None, + **kwargs + ): super(RelayServiceConnectionEntity, self).__init__(kind=kind, **kwargs) self.entity_name = entity_name self.entity_connection_string = entity_connection_string @@ -3114,7 +3792,7 @@ def __init__(self, *, kind: str=None, entity_name: str=None, entity_connection_s self.biztalk_uri = biztalk_uri -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -3128,38 +3806,41 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = count self.time_interval = time_interval -class ResourceMetric(Model): +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2016_08_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] """ _validation = { @@ -3186,7 +3867,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -3199,11 +3883,10 @@ def __init__(self, **kwargs) -> None: self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -3221,17 +3904,53 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None +class ResourceMetricCollection(msrest.serialization.Model): + """Collection of metric responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetric] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetric]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetric"], + **kwargs + ): + super(ResourceMetricCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3241,21 +3960,20 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2016_08_01.models.ResourceMetricName + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: ~azure.mgmt.web.v2016_08_01.models.ResourceMetricName :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str + :ivar id_properties_id: Resource ID. + :vartype id_properties_id: str :ivar properties: Resource metric definition properties. :vartype properties: dict[str, str] """ @@ -3264,12 +3982,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, 'properties': {'readonly': True}, } @@ -3278,31 +3996,69 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) - self.resource_metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.resource_uri = None - self.resource_metric_definition_id = None + self.id_properties_id = None self.properties = None -class ResourceMetricName(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetricDefinition"], + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -3320,13 +4076,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -3340,17 +4099,22 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = key self.value = value -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -3365,8 +4129,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_08_01.models.ResourceMetricProperty] """ _validation = { @@ -3389,7 +4152,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -3403,10 +4169,7 @@ def __init__(self, **kwargs) -> None: class RestoreRequest(ProxyOnlyResource): """Description of a restore request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3416,42 +4179,37 @@ class RestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str :param blob_name: Name of a blob which contains the backup. :type blob_name: str - :param overwrite: Required. true if the restore operation can - overwrite target app; otherwise, false. true is - needed if trying to restore over an existing app. + :param overwrite: :code:`true` if the restore operation can overwrite target app; + otherwise, :code:`false`. :code:`true` is needed if trying to restore + over an existing app. :type overwrite: bool :param site_name: Name of an app. :type site_name: str - :param databases: Collection of databases which should be restored. This - list has to match the list of databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] - :param ignore_conflicting_host_names: Changes a logic when restoring an - app with custom domains. true to remove custom domains - automatically. If false, custom domains are added to - the app's object when it is being restored, but that might fail due to - conflicts during the operation. Default value: False . + :param databases: Collection of databases which should be restored. This list has to match the + list of databases included in the backup. + :type databases: list[~azure.mgmt.web.v2016_08_01.models.DatabaseBackupSetting] + :param ignore_conflicting_host_names: Changes a logic when restoring an app with custom + domains. :code:`true` to remove custom domains automatically. If + :code:`false`, custom domains are added to + the app's object when it is being restored, but that might fail due to conflicts during the + operation. :type ignore_conflicting_host_names: bool - :param ignore_databases: Ignore the databases and only restore the site - content. Default value: False . + :param ignore_databases: Ignore the databases and only restore the site content. :type ignore_databases: bool - :param app_service_plan: Specify app service plan that will own restored - site. + :param app_service_plan: Specify app service plan that will own restored site. :type app_service_plan: str - :param operation_type: Operation type. Possible values include: 'Default', - 'Clone', 'Relocation', 'Snapshot'. Default value: "Default" . - :type operation_type: str or - ~azure.mgmt.web.v2016_08_01.models.BackupRestoreOperationType - :param adjust_connection_strings: true if - SiteConfig.ConnectionStrings should be set in new app; otherwise, - false. + :param operation_type: Operation type. Possible values include: "Default", "Clone", + "Relocation", "Snapshot". + :type operation_type: str or ~azure.mgmt.web.v2016_08_01.models.BackupRestoreOperationType + :param adjust_connection_strings: :code:`true` if SiteConfig.ConnectionStrings + should be set in new app; otherwise, :code:`false`. :type adjust_connection_strings: bool - :param hosting_environment: App Service Environment name, if needed (only - when restoring an app to an App Service Environment). + :param hosting_environment: App Service Environment name, if needed (only when restoring an app + to an App Service Environment). :type hosting_environment: str """ @@ -3459,8 +4217,6 @@ class RestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -3476,12 +4232,28 @@ class RestoreRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, 'ignore_databases': {'key': 'properties.ignoreDatabases', 'type': 'bool'}, 'app_service_plan': {'key': 'properties.appServicePlan', 'type': 'str'}, - 'operation_type': {'key': 'properties.operationType', 'type': 'BackupRestoreOperationType'}, + 'operation_type': {'key': 'properties.operationType', 'type': 'str'}, 'adjust_connection_strings': {'key': 'properties.adjustConnectionStrings', 'type': 'bool'}, 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, *, storage_account_url: str, overwrite: bool, kind: str=None, blob_name: str=None, site_name: str=None, databases=None, ignore_conflicting_host_names: bool=False, ignore_databases: bool=False, app_service_plan: str=None, operation_type="Default", adjust_connection_strings: bool=None, hosting_environment: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + storage_account_url: Optional[str] = None, + blob_name: Optional[str] = None, + overwrite: Optional[bool] = None, + site_name: Optional[str] = None, + databases: Optional[List["DatabaseBackupSetting"]] = None, + ignore_conflicting_host_names: Optional[bool] = False, + ignore_databases: Optional[bool] = False, + app_service_plan: Optional[str] = None, + operation_type: Optional[Union[str, "BackupRestoreOperationType"]] = None, + adjust_connection_strings: Optional[bool] = None, + hosting_environment: Optional[str] = None, + **kwargs + ): super(RestoreRequest, self).__init__(kind=kind, **kwargs) self.storage_account_url = storage_account_url self.blob_name = blob_name @@ -3499,8 +4271,7 @@ def __init__(self, *, storage_account_url: str, overwrite: bool, kind: str=None, class RestoreResponse(ProxyOnlyResource): """Response for an app restore request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3510,8 +4281,8 @@ class RestoreResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the restore process, it will return - an operation ID identifying that particular restore operation. + :ivar operation_id: When server starts the restore process, it will return an operation ID + identifying that particular restore operation. :vartype operation_id: str """ @@ -3530,7 +4301,12 @@ class RestoreResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(RestoreResponse, self).__init__(kind=kind, **kwargs) self.operation_id = None @@ -3538,8 +4314,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3553,117 +4328,99 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_08_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2016_08_01.models.ManagedServiceIdentity """ _validation = { @@ -3697,13 +4454,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -3729,11 +4487,34 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, snapshot_info=None, https_only: bool=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + snapshot_info: Optional["SnapshotRecoveryRequest"] = None, + https_only: Optional[bool] = None, + **kwargs + ): super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -3766,15 +4547,12 @@ def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=No self.default_host_name = None self.slot_swap_status = None self.https_only = https_only - self.identity = identity class SiteAuthSettings(ProxyOnlyResource): - """Configuration settings for the Azure App Service Authentication / - Authorization feature. + """Configuration settings for the Azure App Service Authentication / Authorization feature. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3784,144 +4562,121 @@ class SiteAuthSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param enabled: true if the Authentication / Authorization - feature is enabled for the current app; otherwise, false. + :param enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. :type enabled: bool - :param runtime_version: The RuntimeVersion of the Authentication / - Authorization feature in use for the current app. - The setting in this value can control the behavior of certain features in - the Authentication / Authorization module. + :param runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. :type runtime_version: str - :param unauthenticated_client_action: The action to take when an - unauthenticated client attempts to access the app. Possible values - include: 'RedirectToLoginPage', 'AllowAnonymous' + :param unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous". :type unauthenticated_client_action: str or ~azure.mgmt.web.v2016_08_01.models.UnauthenticatedClientAction - :param token_store_enabled: true to durably store - platform-specific security tokens that are obtained during login flows; - otherwise, false. - The default is false. + :param token_store_enabled: :code:`true` to durably store platform-specific + security tokens that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. :type token_store_enabled: bool - :param allowed_external_redirect_urls: External URLs that can be - redirected to as part of logging in or logging out of the app. Note that - the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store - application backends. + :param allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. :type allowed_external_redirect_urls: list[str] - :param default_provider: The default authentication provider to use when - multiple providers are configured. - This setting is only needed if multiple providers are configured and the - unauthenticated client - action is set to "RedirectToLoginPage". Possible values include: - 'AzureActiveDirectory', 'Facebook', 'Google', 'MicrosoftAccount', - 'Twitter' - :type default_provider: str or - ~azure.mgmt.web.v2016_08_01.models.BuiltInAuthenticationProvider - :param token_refresh_extension_hours: The number of hours after session - token expiration that a session token can be used to + :param default_provider: The default authentication provider to use when multiple providers are + configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". Possible values include: "AzureActiveDirectory", + "Facebook", "Google", "MicrosoftAccount", "Twitter". + :type default_provider: str or ~azure.mgmt.web.v2016_08_01.models.BuiltInAuthenticationProvider + :param token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to call the token refresh API. The default is 72 hours. :type token_refresh_extension_hours: float - :param client_id: The Client ID of this relying party application, known - as the client_id. - This setting is required for enabling OpenID Connection authentication - with Azure Active Directory or + :param client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or other 3rd party OpenID Connect providers. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_id: str - :param client_secret: The Client Secret of this relying party application - (in Azure Active Directory, this is also referred to as the Key). - This setting is optional. If no client secret is configured, the OpenID - Connect implicit auth flow is used to authenticate end users. - Otherwise, the OpenID Connect Authorization Code Flow is used to - authenticate end users. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + :param client_secret: The Client Secret of this relying party application (in Azure Active + Directory, this is also referred to as the Key). + This setting is optional. If no client secret is configured, the OpenID Connect implicit auth + flow is used to authenticate end users. + Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_secret: str - :param issuer: The OpenID Connect Issuer URI that represents the entity - which issues access tokens for this application. - When using Azure Active Directory, this value is the URI of the directory - tenant, e.g. https://sts.windows.net/{tenant-guid}/. + :param issuer: The OpenID Connect Issuer URI that represents the entity which issues access + tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://sts.windows.net/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. - More information on OpenID Connect Discovery: - http://openid.net/specs/openid-connect-discovery-1_0.html + More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect- + discovery-1_0.html. :type issuer: str - :param allowed_audiences: Allowed audience values to consider when - validating JWTs issued by - Azure Active Directory. Note that the ClientID value is - always considered an + :param allowed_audiences: Allowed audience values to consider when validating JWTs issued by + Azure Active Directory. Note that the :code:`ClientID` value is always considered + an allowed audience, regardless of this setting. :type allowed_audiences: list[str] - :param additional_login_params: Login parameters to send to the OpenID - Connect authorization endpoint when + :param additional_login_params: Login parameters to send to the OpenID Connect authorization + endpoint when a user logs in. Each parameter must be in the form "key=value". :type additional_login_params: list[str] - :param google_client_id: The OpenID Connect Client ID for the Google web - application. + :param google_client_id: The OpenID Connect Client ID for the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_id: str - :param google_client_secret: The client secret associated with the Google - web application. + :param google_client_secret: The client secret associated with the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_secret: str - :param google_oauth_scopes: The OAuth 2.0 scopes that will be requested as - part of Google Sign-In authentication. - This setting is optional. If not specified, "openid", "profile", and - "email" are used as default scopes. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ - :type google_oauth_scopes: list[str] + :param google_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Google + Sign-In authentication. + This setting is optional. If not specified, "openid", "profile", and "email" are used as + default scopes. + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. + :type google_o_auth_scopes: list[str] :param facebook_app_id: The App ID of the Facebook app used for login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_id: str - :param facebook_app_secret: The App Secret of the Facebook app used for - Facebook Login. + :param facebook_app_secret: The App Secret of the Facebook app used for Facebook Login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_secret: str - :param facebook_oauth_scopes: The OAuth 2.0 scopes that will be requested - as part of Facebook Login authentication. + :param facebook_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Facebook + Login authentication. This setting is optional. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login - :type facebook_oauth_scopes: list[str] - :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter - application used for sign-in. + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. + :type facebook_o_auth_scopes: list[str] + :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter application used for + sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_key: str - :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the - Twitter application used for sign-in. + :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the Twitter application used + for sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_secret: str - :param microsoft_account_client_id: The OAuth 2.0 client ID that was - created for the app used for authentication. + :param microsoft_account_client_id: The OAuth 2.0 client ID that was created for the app used + for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_id: str - :param microsoft_account_client_secret: The OAuth 2.0 client secret that - was created for the app used for authentication. + :param microsoft_account_client_secret: The OAuth 2.0 client secret that was created for the + app used for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_secret: str - :param microsoft_account_oauth_scopes: The OAuth 2.0 scopes that will be - requested as part of Microsoft Account authentication. - This setting is optional. If not specified, "wl.basic" is used as the - default scope. - Microsoft Account Scopes and permissions documentation: - https://msdn.microsoft.com/en-us/library/dn631845.aspx - :type microsoft_account_oauth_scopes: list[str] + :param microsoft_account_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of + Microsoft Account authentication. + This setting is optional. If not specified, "wl.basic" is used as the default scope. + Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en- + us/library/dn631845.aspx. + :type microsoft_account_o_auth_scopes: list[str] """ _validation = { @@ -3937,10 +4692,10 @@ class SiteAuthSettings(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, - 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'UnauthenticatedClientAction'}, + 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'str'}, 'token_store_enabled': {'key': 'properties.tokenStoreEnabled', 'type': 'bool'}, 'allowed_external_redirect_urls': {'key': 'properties.allowedExternalRedirectUrls', 'type': '[str]'}, - 'default_provider': {'key': 'properties.defaultProvider', 'type': 'BuiltInAuthenticationProvider'}, + 'default_provider': {'key': 'properties.defaultProvider', 'type': 'str'}, 'token_refresh_extension_hours': {'key': 'properties.tokenRefreshExtensionHours', 'type': 'float'}, 'client_id': {'key': 'properties.clientId', 'type': 'str'}, 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, @@ -3949,18 +4704,46 @@ class SiteAuthSettings(ProxyOnlyResource): 'additional_login_params': {'key': 'properties.additionalLoginParams', 'type': '[str]'}, 'google_client_id': {'key': 'properties.googleClientId', 'type': 'str'}, 'google_client_secret': {'key': 'properties.googleClientSecret', 'type': 'str'}, - 'google_oauth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, + 'google_o_auth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, 'facebook_app_id': {'key': 'properties.facebookAppId', 'type': 'str'}, 'facebook_app_secret': {'key': 'properties.facebookAppSecret', 'type': 'str'}, - 'facebook_oauth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, + 'facebook_o_auth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, 'twitter_consumer_key': {'key': 'properties.twitterConsumerKey', 'type': 'str'}, 'twitter_consumer_secret': {'key': 'properties.twitterConsumerSecret', 'type': 'str'}, 'microsoft_account_client_id': {'key': 'properties.microsoftAccountClientId', 'type': 'str'}, 'microsoft_account_client_secret': {'key': 'properties.microsoftAccountClientSecret', 'type': 'str'}, - 'microsoft_account_oauth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, - } - - def __init__(self, *, kind: str=None, enabled: bool=None, runtime_version: str=None, unauthenticated_client_action=None, token_store_enabled: bool=None, allowed_external_redirect_urls=None, default_provider=None, token_refresh_extension_hours: float=None, client_id: str=None, client_secret: str=None, issuer: str=None, allowed_audiences=None, additional_login_params=None, google_client_id: str=None, google_client_secret: str=None, google_oauth_scopes=None, facebook_app_id: str=None, facebook_app_secret: str=None, facebook_oauth_scopes=None, twitter_consumer_key: str=None, twitter_consumer_secret: str=None, microsoft_account_client_id: str=None, microsoft_account_client_secret: str=None, microsoft_account_oauth_scopes=None, **kwargs) -> None: + 'microsoft_account_o_auth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + enabled: Optional[bool] = None, + runtime_version: Optional[str] = None, + unauthenticated_client_action: Optional[Union[str, "UnauthenticatedClientAction"]] = None, + token_store_enabled: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + default_provider: Optional[Union[str, "BuiltInAuthenticationProvider"]] = None, + token_refresh_extension_hours: Optional[float] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + issuer: Optional[str] = None, + allowed_audiences: Optional[List[str]] = None, + additional_login_params: Optional[List[str]] = None, + google_client_id: Optional[str] = None, + google_client_secret: Optional[str] = None, + google_o_auth_scopes: Optional[List[str]] = None, + facebook_app_id: Optional[str] = None, + facebook_app_secret: Optional[str] = None, + facebook_o_auth_scopes: Optional[List[str]] = None, + twitter_consumer_key: Optional[str] = None, + twitter_consumer_secret: Optional[str] = None, + microsoft_account_client_id: Optional[str] = None, + microsoft_account_client_secret: Optional[str] = None, + microsoft_account_o_auth_scopes: Optional[List[str]] = None, + **kwargs + ): super(SiteAuthSettings, self).__init__(kind=kind, **kwargs) self.enabled = enabled self.runtime_version = runtime_version @@ -3976,46 +4759,50 @@ def __init__(self, *, kind: str=None, enabled: bool=None, runtime_version: str=N self.additional_login_params = additional_login_params self.google_client_id = google_client_id self.google_client_secret = google_client_secret - self.google_oauth_scopes = google_oauth_scopes + self.google_o_auth_scopes = google_o_auth_scopes self.facebook_app_id = facebook_app_id self.facebook_app_secret = facebook_app_secret - self.facebook_oauth_scopes = facebook_oauth_scopes + self.facebook_o_auth_scopes = facebook_o_auth_scopes self.twitter_consumer_key = twitter_consumer_key self.twitter_consumer_secret = twitter_consumer_secret self.microsoft_account_client_id = microsoft_account_client_id self.microsoft_account_client_secret = microsoft_account_client_secret - self.microsoft_account_oauth_scopes = microsoft_account_oauth_scopes + self.microsoft_account_o_auth_scopes = microsoft_account_o_auth_scopes -class SiteCloneability(Model): +class SiteCloneability(msrest.serialization.Model): """Represents whether or not an app is cloneable. - :param result: Name of app. Possible values include: 'Cloneable', - 'PartiallyCloneable', 'NotCloneable' + :param result: Name of app. Possible values include: "Cloneable", "PartiallyCloneable", + "NotCloneable". :type result: str or ~azure.mgmt.web.v2016_08_01.models.CloneAbilityResult - :param blocking_features: List of features enabled on app that prevent - cloning. - :type blocking_features: - list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] - :param unsupported_features: List of features enabled on app that are - non-blocking but cannot be cloned. The app can still be cloned + :param blocking_features: List of features enabled on app that prevent cloning. + :type blocking_features: list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] + :param unsupported_features: List of features enabled on app that are non-blocking but cannot + be cloned. The app can still be cloned but the features in this list will not be set up on cloned app. - :type unsupported_features: - list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] - :param blocking_characteristics: List of blocking application - characteristics. + :type unsupported_features: list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] + :param blocking_characteristics: List of blocking application characteristics. :type blocking_characteristics: list[~azure.mgmt.web.v2016_08_01.models.SiteCloneabilityCriterion] """ _attribute_map = { - 'result': {'key': 'result', 'type': 'CloneAbilityResult'}, + 'result': {'key': 'result', 'type': 'str'}, 'blocking_features': {'key': 'blockingFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'unsupported_features': {'key': 'unsupportedFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'blocking_characteristics': {'key': 'blockingCharacteristics', 'type': '[SiteCloneabilityCriterion]'}, } - def __init__(self, *, result=None, blocking_features=None, unsupported_features=None, blocking_characteristics=None, **kwargs) -> None: + def __init__( + self, + *, + result: Optional[Union[str, "CloneAbilityResult"]] = None, + blocking_features: Optional[List["SiteCloneabilityCriterion"]] = None, + unsupported_features: Optional[List["SiteCloneabilityCriterion"]] = None, + blocking_characteristics: Optional[List["SiteCloneabilityCriterion"]] = None, + **kwargs + ): super(SiteCloneability, self).__init__(**kwargs) self.result = result self.blocking_features = blocking_features @@ -4023,7 +4810,7 @@ def __init__(self, *, result=None, blocking_features=None, unsupported_features= self.blocking_characteristics = blocking_characteristics -class SiteCloneabilityCriterion(Model): +class SiteCloneabilityCriterion(msrest.serialization.Model): """An app cloneability criterion. :param name: Name of criterion. @@ -4037,24 +4824,28 @@ class SiteCloneabilityCriterion(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(SiteCloneabilityCriterion, self).__init__(**kwargs) self.name = name self.description = description -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -4062,52 +4853,50 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -4117,24 +4906,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_08_01.models.AutoHealRules @@ -4146,25 +4931,21 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2016_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_08_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions """ _validation = { @@ -4200,9 +4981,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -4219,7 +5000,55 @@ class SiteConfig(Model): 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, } - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, ip_security_restrictions=None, http20_enabled: bool=True, min_tls_version=None, **kwargs) -> None: + def __init__( + self, + *, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -4271,8 +5100,7 @@ def __init__(self, *, number_of_workers: int=None, default_documents=None, net_f class SiteConfigResource(ProxyOnlyResource): """Web app configuration ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4286,8 +5114,7 @@ class SiteConfigResource(ProxyOnlyResource): :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -4295,52 +5122,50 @@ class SiteConfigResource(ProxyOnlyResource): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -4350,24 +5175,20 @@ class SiteConfigResource(ProxyOnlyResource): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_08_01.models.AutoHealRules @@ -4379,25 +5200,21 @@ class SiteConfigResource(ProxyOnlyResource): :type cors: ~azure.mgmt.web.v2016_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_08_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_08_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_08_01.models.SupportedTlsVersions """ _validation = { @@ -4440,9 +5257,9 @@ class SiteConfigResource(ProxyOnlyResource): 'java_container': {'key': 'properties.javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'properties.javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'properties.appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'properties.virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'str'}, 'experiments': {'key': 'properties.experiments', 'type': 'Experiments'}, 'limits': {'key': 'properties.limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'properties.autoHealEnabled', 'type': 'bool'}, @@ -4459,7 +5276,56 @@ class SiteConfigResource(ProxyOnlyResource): 'min_tls_version': {'key': 'properties.minTlsVersion', 'type': 'str'}, } - def __init__(self, *, kind: str=None, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, ip_security_restrictions=None, http20_enabled: bool=True, min_tls_version=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + **kwargs + ): super(SiteConfigResource, self).__init__(kind=kind, **kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -4508,11 +5374,44 @@ def __init__(self, *, kind: str=None, number_of_workers: int=None, default_docum self.min_tls_version = min_tls_version +class SiteConfigResourceCollection(msrest.serialization.Model): + """Collection of site configurations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteConfigResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteConfigResource"], + **kwargs + ): + super(SiteConfigResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteConfigurationSnapshotInfo(ProxyOnlyResource): """A snapshot of a web app configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4523,9 +5422,9 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :ivar time: The time the snapshot was taken. - :vartype time: datetime - :ivar site_configuration_snapshot_info_id: The id of the snapshot - :vartype site_configuration_snapshot_info_id: int + :vartype time: ~datetime.datetime + :ivar id_properties_id: The id of the snapshot. + :vartype id_properties_id: int """ _validation = { @@ -4533,7 +5432,7 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'time': {'readonly': True}, - 'site_configuration_snapshot_info_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, } _attribute_map = { @@ -4542,20 +5441,58 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'time': {'key': 'properties.time', 'type': 'iso-8601'}, - 'site_configuration_snapshot_info_id': {'key': 'properties.id', 'type': 'int'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'int'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SiteConfigurationSnapshotInfo, self).__init__(kind=kind, **kwargs) self.time = None - self.site_configuration_snapshot_info_id = None + self.id_properties_id = None + + +class SiteConfigurationSnapshotInfoCollection(msrest.serialization.Model): + """Collection of metadata for the app configuration snapshots that can be restored. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteConfigurationSnapshotInfo"], + **kwargs + ): + super(SiteConfigurationSnapshotInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None class SiteExtensionInfo(ProxyOnlyResource): """Site Extension Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4565,14 +5502,13 @@ class SiteExtensionInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param site_extension_info_id: Site extension ID. - :type site_extension_info_id: str + :param id_properties_id: Site extension ID. + :type id_properties_id: str :param title: Site extension title. :type title: str - :param site_extension_info_type: Site extension type. Possible values - include: 'Gallery', 'WebRoot' - :type site_extension_info_type: str or - ~azure.mgmt.web.v2016_08_01.models.SiteExtensionType + :param type_properties_type: Site extension type. Possible values include: "Gallery", + "WebRoot". + :type type_properties_type: str or ~azure.mgmt.web.v2016_08_01.models.SiteExtensionType :param summary: Summary description. :type summary: str :param description: Detailed description. @@ -4594,16 +5530,16 @@ class SiteExtensionInfo(ProxyOnlyResource): :param installation_args: Installer command line parameters. :type installation_args: str :param published_date_time: Published timestamp. - :type published_date_time: datetime + :type published_date_time: ~datetime.datetime :param download_count: Count of downloads. :type download_count: int - :param local_is_latest_version: true if the local version is - the latest version; false otherwise. + :param local_is_latest_version: :code:`true` if the local version is the latest + version; :code:`false` otherwise. :type local_is_latest_version: bool :param local_path: Local path. :type local_path: str :param installed_date_time: Installed timestamp. - :type installed_date_time: datetime + :type installed_date_time: ~datetime.datetime :param provisioning_state: Provisioning state. :type provisioning_state: str :param comment: Site Extension comment. @@ -4621,9 +5557,9 @@ class SiteExtensionInfo(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'site_extension_info_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'title': {'key': 'properties.title', 'type': 'str'}, - 'site_extension_info_type': {'key': 'properties.type', 'type': 'SiteExtensionType'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'summary': {'key': 'properties.summary', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'str'}, @@ -4643,11 +5579,36 @@ class SiteExtensionInfo(ProxyOnlyResource): 'comment': {'key': 'properties.comment', 'type': 'str'}, } - def __init__(self, *, kind: str=None, site_extension_info_id: str=None, title: str=None, site_extension_info_type=None, summary: str=None, description: str=None, version: str=None, extension_url: str=None, project_url: str=None, icon_url: str=None, license_url: str=None, feed_url: str=None, authors=None, installation_args: str=None, published_date_time=None, download_count: int=None, local_is_latest_version: bool=None, local_path: str=None, installed_date_time=None, provisioning_state: str=None, comment: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[str] = None, + title: Optional[str] = None, + type_properties_type: Optional[Union[str, "SiteExtensionType"]] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + version: Optional[str] = None, + extension_url: Optional[str] = None, + project_url: Optional[str] = None, + icon_url: Optional[str] = None, + license_url: Optional[str] = None, + feed_url: Optional[str] = None, + authors: Optional[List[str]] = None, + installation_args: Optional[str] = None, + published_date_time: Optional[datetime.datetime] = None, + download_count: Optional[int] = None, + local_is_latest_version: Optional[bool] = None, + local_path: Optional[str] = None, + installed_date_time: Optional[datetime.datetime] = None, + provisioning_state: Optional[str] = None, + comment: Optional[str] = None, + **kwargs + ): super(SiteExtensionInfo, self).__init__(kind=kind, **kwargs) - self.site_extension_info_id = site_extension_info_id + self.id_properties_id = id_properties_id self.title = title - self.site_extension_info_type = site_extension_info_type + self.type_properties_type = type_properties_type self.summary = summary self.description = description self.version = version @@ -4667,11 +5628,44 @@ def __init__(self, *, kind: str=None, site_extension_info_id: str=None, title: s self.comment = comment +class SiteExtensionInfoCollection(msrest.serialization.Model): + """Collection of Kudu site extension information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteExtensionInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteExtensionInfo"], + **kwargs + ): + super(SiteExtensionInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteInstance(ProxyOnlyResource): """Instance of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4681,15 +5675,15 @@ class SiteInstance(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar site_instance_name: Name of instance. - :vartype site_instance_name: str + :ivar name_properties_name: Name of instance. + :vartype name_properties_name: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'site_instance_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -4697,15 +5691,20 @@ class SiteInstance(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'site_instance_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SiteInstance, self).__init__(kind=kind, **kwargs) - self.site_instance_name = None + self.name_properties_name = None -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -4722,7 +5721,14 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: + def __init__( + self, + *, + max_percentage_cpu: Optional[float] = None, + max_memory_in_mb: Optional[int] = None, + max_disk_size_in_mb: Optional[int] = None, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = max_percentage_cpu self.max_memory_in_mb = max_memory_in_mb @@ -4732,8 +5738,7 @@ def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None class SiteLogsConfig(ProxyOnlyResource): """Configuration of App Service site logs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4744,16 +5749,13 @@ class SiteLogsConfig(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param application_logs: Application logs configuration. - :type application_logs: - ~azure.mgmt.web.v2016_08_01.models.ApplicationLogsConfig + :type application_logs: ~azure.mgmt.web.v2016_08_01.models.ApplicationLogsConfig :param http_logs: HTTP logs configuration. :type http_logs: ~azure.mgmt.web.v2016_08_01.models.HttpLogsConfig :param failed_requests_tracing: Failed requests tracing configuration. - :type failed_requests_tracing: - ~azure.mgmt.web.v2016_08_01.models.EnabledConfig + :type failed_requests_tracing: ~azure.mgmt.web.v2016_08_01.models.EnabledConfig :param detailed_error_messages: Detailed error messages configuration. - :type detailed_error_messages: - ~azure.mgmt.web.v2016_08_01.models.EnabledConfig + :type detailed_error_messages: ~azure.mgmt.web.v2016_08_01.models.EnabledConfig """ _validation = { @@ -4773,7 +5775,16 @@ class SiteLogsConfig(ProxyOnlyResource): 'detailed_error_messages': {'key': 'properties.detailedErrorMessages', 'type': 'EnabledConfig'}, } - def __init__(self, *, kind: str=None, application_logs=None, http_logs=None, failed_requests_tracing=None, detailed_error_messages=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + application_logs: Optional["ApplicationLogsConfig"] = None, + http_logs: Optional["HttpLogsConfig"] = None, + failed_requests_tracing: Optional["EnabledConfig"] = None, + detailed_error_messages: Optional["EnabledConfig"] = None, + **kwargs + ): super(SiteLogsConfig, self).__init__(kind=kind, **kwargs) self.application_logs = application_logs self.http_logs = http_logs @@ -4781,7 +5792,7 @@ def __init__(self, *, kind: str=None, application_logs=None, http_logs=None, fai self.detailed_error_messages = detailed_error_messages -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -4801,7 +5812,15 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + validation: Optional[str] = None, + validation_key: Optional[str] = None, + decryption: Optional[str] = None, + decryption_key: Optional[str] = None, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = validation self.validation_key = validation_key @@ -4812,8 +5831,7 @@ def __init__(self, *, validation: str=None, validation_key: str=None, decryption class SitePatchResource(ProxyOnlyResource): """ARM resource for a site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4829,106 +5847,88 @@ class SitePatchResource(ProxyOnlyResource): :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_08_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool """ @@ -4963,10 +5963,10 @@ class SitePatchResource(ProxyOnlyResource): 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -4994,7 +5994,27 @@ class SitePatchResource(ProxyOnlyResource): 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, snapshot_info=None, https_only: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + snapshot_info: Optional["SnapshotRecoveryRequest"] = None, + https_only: Optional[bool] = None, + **kwargs + ): super(SitePatchResource, self).__init__(kind=kind, **kwargs) self.state = None self.host_names = None @@ -5033,8 +6053,7 @@ def __init__(self, *, kind: str=None, enabled: bool=None, host_name_ssl_states=N class SitePhpErrorLogFlag(ProxyOnlyResource): """Used for getting PHP error logging flag. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5071,7 +6090,16 @@ class SitePhpErrorLogFlag(ProxyOnlyResource): 'master_log_errors_max_length': {'key': 'properties.masterLogErrorsMaxLength', 'type': 'str'}, } - def __init__(self, *, kind: str=None, local_log_errors: str=None, master_log_errors: str=None, local_log_errors_max_length: str=None, master_log_errors_max_length: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + local_log_errors: Optional[str] = None, + master_log_errors: Optional[str] = None, + local_log_errors_max_length: Optional[str] = None, + master_log_errors_max_length: Optional[str] = None, + **kwargs + ): super(SitePhpErrorLogFlag, self).__init__(kind=kind, **kwargs) self.local_log_errors = local_log_errors self.master_log_errors = master_log_errors @@ -5082,8 +6110,7 @@ def __init__(self, *, kind: str=None, local_log_errors: str=None, master_log_err class SiteSourceControl(ProxyOnlyResource): """Source control configuration for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5097,15 +6124,15 @@ class SiteSourceControl(ProxyOnlyResource): :type repo_url: str :param branch: Name of branch to use for deployment. :type branch: str - :param is_manual_integration: true to limit to manual - integration; false to enable continuous integration (which - configures webhooks into online repos like GitHub). + :param is_manual_integration: :code:`true` to limit to manual integration; + :code:`false` to enable continuous integration (which configures webhooks into + online repos like GitHub). :type is_manual_integration: bool - :param deployment_rollback_enabled: true to enable deployment - rollback; otherwise, false. + :param deployment_rollback_enabled: :code:`true` to enable deployment rollback; + otherwise, :code:`false`. :type deployment_rollback_enabled: bool - :param is_mercurial: true for a Mercurial repository; - false for a Git repository. + :param is_mercurial: :code:`true` for a Mercurial repository; + :code:`false` for a Git repository. :type is_mercurial: bool """ @@ -5127,7 +6154,17 @@ class SiteSourceControl(ProxyOnlyResource): 'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_manual_integration: bool=None, deployment_rollback_enabled: bool=None, is_mercurial: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + is_manual_integration: Optional[bool] = None, + deployment_rollback_enabled: Optional[bool] = None, + is_mercurial: Optional[bool] = None, + **kwargs + ): super(SiteSourceControl, self).__init__(kind=kind, **kwargs) self.repo_url = repo_url self.branch = branch @@ -5136,84 +6173,10 @@ def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_m self.is_mercurial = is_mercurial -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2016_08_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2016_08_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: - super(SkuDescription, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - self.sku_capacity = sku_capacity - self.locations = locations - self.capabilities = capabilities - - class SlotConfigNamesResource(ProxyOnlyResource): """Slot Config names azure resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5244,7 +6207,14 @@ class SlotConfigNamesResource(ProxyOnlyResource): 'app_setting_names': {'key': 'properties.appSettingNames', 'type': '[str]'}, } - def __init__(self, *, kind: str=None, connection_string_names=None, app_setting_names=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + connection_string_names: Optional[List[str]] = None, + app_setting_names: Optional[List[str]] = None, + **kwargs + ): super(SlotConfigNamesResource, self).__init__(kind=kind, **kwargs) self.connection_string_names = connection_string_names self.app_setting_names = app_setting_names @@ -5253,8 +6223,7 @@ def __init__(self, *, kind: str=None, connection_string_names=None, app_setting_ class SlotDifference(ProxyOnlyResource): """A setting difference between two deployment slots of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5264,14 +6233,11 @@ class SlotDifference(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar slot_difference_type: Type of the difference: Information, Warning - or Error. - :vartype slot_difference_type: str - :ivar setting_type: The type of the setting: General, AppSetting or - ConnectionString. + :ivar type_properties_type: Type of the difference: Information, Warning or Error. + :vartype type_properties_type: str + :ivar setting_type: The type of the setting: General, AppSetting or ConnectionString. :vartype setting_type: str - :ivar diff_rule: Rule that describes how to process the setting difference - during a slot swap. + :ivar diff_rule: Rule that describes how to process the setting difference during a slot swap. :vartype diff_rule: str :ivar setting_name: Name of the setting. :vartype setting_name: str @@ -5287,7 +6253,7 @@ class SlotDifference(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'slot_difference_type': {'readonly': True}, + 'type_properties_type': {'readonly': True}, 'setting_type': {'readonly': True}, 'diff_rule': {'readonly': True}, 'setting_name': {'readonly': True}, @@ -5301,7 +6267,7 @@ class SlotDifference(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'slot_difference_type': {'key': 'properties.type', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, 'setting_type': {'key': 'properties.settingType', 'type': 'str'}, 'diff_rule': {'key': 'properties.diffRule', 'type': 'str'}, 'setting_name': {'key': 'properties.settingName', 'type': 'str'}, @@ -5310,9 +6276,14 @@ class SlotDifference(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SlotDifference, self).__init__(kind=kind, **kwargs) - self.slot_difference_type = None + self.type_properties_type = None self.setting_type = None self.diff_rule = None self.setting_name = None @@ -5321,18 +6292,50 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.description = None -class SlotSwapStatus(Model): +class SlotDifferenceCollection(msrest.serialization.Model): + """Collection of slot differences. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SlotDifference] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SlotDifference]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SlotDifference"], + **kwargs + ): + super(SlotDifferenceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -5348,14 +6351,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -5372,7 +6378,14 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_taken: Optional[str] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = time_taken self.count = count @@ -5382,8 +6395,7 @@ def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str= class Snapshot(ProxyOnlyResource): """A snapshot of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5412,19 +6424,55 @@ class Snapshot(ProxyOnlyResource): 'time': {'key': 'properties.time', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(Snapshot, self).__init__(kind=kind, **kwargs) self.time = None -class SnapshotRecoveryRequest(ProxyOnlyResource): - """Details about app recovery operation. +class SnapshotCollection(msrest.serialization.Model): + """Collection of snapshots which can be used to revert an app to a previous time. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Snapshot] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Snapshot"], + **kwargs + ): + super(SnapshotCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SnapshotRecoveryRequest(ProxyOnlyResource): + """Details about app recovery operation. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -5433,21 +6481,19 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app recovery should be attempted, formatted as + a DateTime string. :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. + :param recovery_target: Specifies the web app that snapshot contents will be written to. + :type recovery_target: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryTarget + :param overwrite: If :code:`true` the recovery operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool """ @@ -5456,7 +6502,6 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -5471,7 +6516,17 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, } - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_target=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + snapshot_time: Optional[str] = None, + recovery_target: Optional["SnapshotRecoveryTarget"] = None, + overwrite: Optional[bool] = None, + recover_configuration: Optional[bool] = None, + ignore_conflicting_host_names: Optional[bool] = None, + **kwargs + ): super(SnapshotRecoveryRequest, self).__init__(kind=kind, **kwargs) self.snapshot_time = snapshot_time self.recovery_target = recovery_target @@ -5480,16 +6535,16 @@ def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, self.ignore_conflicting_host_names = ignore_conflicting_host_names -class SnapshotRecoveryTarget(Model): +class SnapshotRecoveryTarget(msrest.serialization.Model): """Specifies the web app that snapshot contents will be written to. - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the target web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -5499,13 +6554,19 @@ class SnapshotRecoveryTarget(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): super(SnapshotRecoveryTarget, self).__init__(**kwargs) self.location = location self.id = id -class StatusCodesBasedTrigger(Model): +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -5528,7 +6589,16 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[int] = None, + sub_status: Optional[int] = None, + win32_status: Optional[int] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = status self.sub_status = sub_status @@ -5540,10 +6610,7 @@ def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int= class StorageMigrationOptions(ProxyOnlyResource): """Options for app content migration. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5553,17 +6620,15 @@ class StorageMigrationOptions(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param azurefiles_connection_string: Required. AzureFiles connection - string. + :param azurefiles_connection_string: AzureFiles connection string. :type azurefiles_connection_string: str - :param azurefiles_share: Required. AzureFiles share. + :param azurefiles_share: AzureFiles share. :type azurefiles_share: str - :param switch_site_after_migration: trueif the app should be - switched over; otherwise, false. Default value: False . + :param switch_site_after_migration: :code:`true`if the app should be switched + over; otherwise, :code:`false`. :type switch_site_after_migration: bool - :param block_write_access_to_site: true if the app should be - read only during copy operation; otherwise, false. Default - value: False . + :param block_write_access_to_site: :code:`true` if the app should be read only + during copy operation; otherwise, :code:`false`. :type block_write_access_to_site: bool """ @@ -5571,8 +6636,6 @@ class StorageMigrationOptions(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'azurefiles_connection_string': {'required': True}, - 'azurefiles_share': {'required': True}, } _attribute_map = { @@ -5586,7 +6649,16 @@ class StorageMigrationOptions(ProxyOnlyResource): 'block_write_access_to_site': {'key': 'properties.blockWriteAccessToSite', 'type': 'bool'}, } - def __init__(self, *, azurefiles_connection_string: str, azurefiles_share: str, kind: str=None, switch_site_after_migration: bool=False, block_write_access_to_site: bool=False, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + azurefiles_connection_string: Optional[str] = None, + azurefiles_share: Optional[str] = None, + switch_site_after_migration: Optional[bool] = False, + block_write_access_to_site: Optional[bool] = False, + **kwargs + ): super(StorageMigrationOptions, self).__init__(kind=kind, **kwargs) self.azurefiles_connection_string = azurefiles_connection_string self.azurefiles_share = azurefiles_share @@ -5597,8 +6669,7 @@ def __init__(self, *, azurefiles_connection_string: str, azurefiles_share: str, class StorageMigrationResponse(ProxyOnlyResource): """Response for a migration of app content request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5608,8 +6679,8 @@ class StorageMigrationResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the migration process, it will - return an operation ID identifying that particular migration operation. + :ivar operation_id: When server starts the migration process, it will return an operation ID + identifying that particular migration operation. :vartype operation_id: str """ @@ -5628,7 +6699,12 @@ class StorageMigrationResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(StorageMigrationResponse, self).__init__(kind=kind, **kwargs) self.operation_id = None @@ -5636,8 +6712,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class StringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5665,17 +6740,21 @@ class StringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): super(StringDictionary, self).__init__(kind=kind, **kwargs) self.properties = properties class TriggeredJobHistory(ProxyOnlyResource): - """Triggered Web Job History. List of Triggered Web Job Run Information - elements. + """Triggered Web Job History. List of Triggered Web Job Run Information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5686,8 +6765,7 @@ class TriggeredJobHistory(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param triggered_job_runs: List of triggered web job runs. - :type triggered_job_runs: - list[~azure.mgmt.web.v2016_08_01.models.TriggeredJobRun] + :type triggered_job_runs: list[~azure.mgmt.web.v2016_08_01.models.TriggeredJobRun] """ _validation = { @@ -5704,16 +6782,55 @@ class TriggeredJobHistory(ProxyOnlyResource): 'triggered_job_runs': {'key': 'properties.triggeredJobRuns', 'type': '[TriggeredJobRun]'}, } - def __init__(self, *, kind: str=None, triggered_job_runs=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + triggered_job_runs: Optional[List["TriggeredJobRun"]] = None, + **kwargs + ): super(TriggeredJobHistory, self).__init__(kind=kind, **kwargs) self.triggered_job_runs = triggered_job_runs +class TriggeredJobHistoryCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredJobHistory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TriggeredJobHistory"], + **kwargs + ): + super(TriggeredJobHistoryCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TriggeredJobRun(ProxyOnlyResource): """Triggered Web Job Run Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5723,18 +6840,16 @@ class TriggeredJobRun(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param triggered_job_run_id: Job ID. - :type triggered_job_run_id: str - :ivar triggered_job_run_name: Job name. - :vartype triggered_job_run_name: str - :param status: Job status. Possible values include: 'Success', 'Failed', - 'Error' - :type status: str or - ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobStatus + :param id_properties_id: Job ID. + :type id_properties_id: str + :ivar name_properties_name: Job name. + :vartype name_properties_name: str + :param status: Job status. Possible values include: "Success", "Failed", "Error". + :type status: str or ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobStatus :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime + :type end_time: ~datetime.datetime :param duration: Job duration. :type duration: str :param output_url: Output URL. @@ -5753,7 +6868,7 @@ class TriggeredJobRun(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'triggered_job_run_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -5761,9 +6876,9 @@ class TriggeredJobRun(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'triggered_job_run_id': {'key': 'properties.id', 'type': 'str'}, - 'triggered_job_run_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TriggeredWebJobStatus'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'duration': {'key': 'properties.duration', 'type': 'str'}, @@ -5774,10 +6889,25 @@ class TriggeredJobRun(ProxyOnlyResource): 'trigger': {'key': 'properties.trigger', 'type': 'str'}, } - def __init__(self, *, kind: str=None, triggered_job_run_id: str=None, status=None, start_time=None, end_time=None, duration: str=None, output_url: str=None, error_url: str=None, url: str=None, job_name: str=None, trigger: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[str] = None, + status: Optional[Union[str, "TriggeredWebJobStatus"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + duration: Optional[str] = None, + output_url: Optional[str] = None, + error_url: Optional[str] = None, + url: Optional[str] = None, + job_name: Optional[str] = None, + trigger: Optional[str] = None, + **kwargs + ): super(TriggeredJobRun, self).__init__(kind=kind, **kwargs) - self.triggered_job_run_id = triggered_job_run_id - self.triggered_job_run_name = None + self.id_properties_id = id_properties_id + self.name_properties_name = None self.status = status self.start_time = start_time self.end_time = end_time @@ -5792,8 +6922,7 @@ def __init__(self, *, kind: str=None, triggered_job_run_id: str=None, status=Non class TriggeredWebJob(ProxyOnlyResource): """Triggered Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5809,21 +6938,19 @@ class TriggeredWebJob(ProxyOnlyResource): :type history_url: str :param scheduler_logs_url: Scheduler Logs URL. :type scheduler_logs_url: str - :ivar triggered_web_job_name: Job name. Used as job identifier in ARM - resource URI. - :vartype triggered_web_job_name: str + :ivar name_properties_name: Job name. Used as job identifier in ARM resource URI. + :vartype name_properties_name: str :param run_command: Run command. :type run_command: str :param url: Job URL. :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param job_type: Job type. Possible values include: "Continuous", "Triggered". :type job_type: str or ~azure.mgmt.web.v2016_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -5833,7 +6960,7 @@ class TriggeredWebJob(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'triggered_web_job_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -5844,22 +6971,37 @@ class TriggeredWebJob(ProxyOnlyResource): 'latest_run': {'key': 'properties.latestRun', 'type': 'TriggeredJobRun'}, 'history_url': {'key': 'properties.historyUrl', 'type': 'str'}, 'scheduler_logs_url': {'key': 'properties.schedulerLogsUrl', 'type': 'str'}, - 'triggered_web_job_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'run_command': {'key': 'properties.runCommand', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extraInfoUrl', 'type': 'str'}, - 'job_type': {'key': 'properties.jobType', 'type': 'WebJobType'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.usingSdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, latest_run=None, history_url: str=None, scheduler_logs_url: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + latest_run: Optional["TriggeredJobRun"] = None, + history_url: Optional[str] = None, + scheduler_logs_url: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(TriggeredWebJob, self).__init__(kind=kind, **kwargs) self.latest_run = latest_run self.history_url = history_url self.scheduler_logs_url = scheduler_logs_url - self.triggered_web_job_name = None + self.name_properties_name = None self.run_command = run_command self.url = url self.extra_info_url = extra_info_url @@ -5869,14 +7011,45 @@ def __init__(self, *, kind: str=None, latest_run=None, history_url: str=None, sc self.settings = settings -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class TriggeredWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TriggeredWebJob"], + **kwargs + ): + super(TriggeredWebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class User(ProxyOnlyResource): + """User credentials used for publishing activity. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -5885,16 +7058,15 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param user_name: Username + :param user_name: Username. :type user_name: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str """ @@ -5902,7 +7074,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -5917,7 +7088,17 @@ class User(ProxyOnlyResource): 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, } - def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + user_name: Optional[str] = None, + publishing_user_name: Optional[str] = None, + publishing_password: Optional[str] = None, + publishing_password_hash: Optional[str] = None, + publishing_password_hash_salt: Optional[str] = None, + **kwargs + ): super(User, self).__init__(kind=kind, **kwargs) self.user_name = user_name self.publishing_user_name = publishing_user_name @@ -5926,19 +7107,18 @@ def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str= self.publishing_password_hash_salt = publishing_password_hash_salt -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2016_08_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2016_08_01.models.VirtualDirectory] """ _attribute_map = { @@ -5948,7 +7128,15 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + preload_enabled: Optional[bool] = None, + virtual_directories: Optional[List["VirtualDirectory"]] = None, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path @@ -5956,7 +7144,7 @@ def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_e self.virtual_directories = virtual_directories -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -5970,20 +7158,22 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5995,8 +7185,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -6004,7 +7193,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -6016,7 +7204,14 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_name: Optional[str] = None, + vpn_package_uri: Optional[str] = None, + **kwargs + ): super(VnetGateway, self).__init__(kind=kind, **kwargs) self.vnet_name = vnet_name self.vpn_package_uri = vpn_package_uri @@ -6025,8 +7220,7 @@ def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6040,17 +7234,17 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: bytearray :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2016_08_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str """ @@ -6076,7 +7270,15 @@ class VnetInfo(ProxyOnlyResource): 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: bytearray=None, dns_servers: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_id: Optional[str] = None, + cert_blob: Optional[bytearray] = None, + dns_servers: Optional[str] = None, + **kwargs + ): super(VnetInfo, self).__init__(kind=kind, **kwargs) self.vnet_resource_id = vnet_resource_id self.cert_thumbprint = None @@ -6087,11 +7289,9 @@ def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: byt class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6101,23 +7301,22 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. + :param vnet_route_name: The name of this route. This is only returned by the server and does + not need to be set by the client. :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2016_08_01.models.RouteType """ @@ -6138,7 +7337,16 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_route_name: Optional[str] = None, + start_address: Optional[str] = None, + end_address: Optional[str] = None, + route_type: Optional[Union[str, "RouteType"]] = None, + **kwargs + ): super(VnetRoute, self).__init__(kind=kind, **kwargs) self.vnet_route_name = vnet_route_name self.start_address = start_address @@ -6146,11 +7354,78 @@ def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: self.route_type = route_type +class WebAppCollection(msrest.serialization.Model): + """Collection of App Service apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.Site] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Site]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Site"], + **kwargs + ): + super(WebAppCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class WebAppInstanceCollection(msrest.serialization.Model): + """Collection of app instances. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.SiteInstance] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteInstance"], + **kwargs + ): + super(WebAppInstanceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WebJob(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6160,20 +7435,19 @@ class WebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar web_job_name: Job name. Used as job identifier in ARM resource URI. - :vartype web_job_name: str + :ivar name_properties_name: Job name. Used as job identifier in ARM resource URI. + :vartype name_properties_name: str :param run_command: Run command. :type run_command: str :param url: Job URL. :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param job_type: Job type. Possible values include: "Continuous", "Triggered". :type job_type: str or ~azure.mgmt.web.v2016_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -6183,7 +7457,7 @@ class WebJob(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'web_job_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, } _attribute_map = { @@ -6191,19 +7465,31 @@ class WebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'web_job_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'run_command': {'key': 'properties.runCommand', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extraInfoUrl', 'type': 'str'}, - 'job_type': {'key': 'properties.jobType', 'type': 'WebJobType'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.usingSdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(WebJob, self).__init__(kind=kind, **kwargs) - self.web_job_name = None + self.name_properties_name = None self.run_command = run_command self.url = url self.extra_info_url = extra_info_url @@ -6211,3 +7497,37 @@ def __init__(self, *, kind: str=None, run_command: str=None, url: str=None, extr self.error = error self.using_sdk = using_sdk self.settings = settings + + +class WebJobCollection(msrest.serialization.Model): + """Collection of Kudu web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_08_01.models.WebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["WebJob"], + **kwargs + ): + super(WebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_web_site_management_client_enums.py index d8fd32b4088f..8b724a3f96b6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_web_site_management_client_enums.py @@ -1,292 +1,336 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class LogLevel(str, Enum): - - off = "Off" - verbose = "Verbose" - information = "Information" - warning = "Warning" - error = "Error" - - -class BackupItemStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - skipped = "Skipped" - partially_succeeded = "PartiallySucceeded" - delete_in_progress = "DeleteInProgress" - delete_failed = "DeleteFailed" - deleted = "Deleted" - - -class DatabaseType(str, Enum): - - sql_azure = "SqlAzure" - my_sql = "MySql" - local_my_sql = "LocalMySql" - postgre_sql = "PostgreSql" - - -class FrequencyUnit(str, Enum): - - day = "Day" - hour = "Hour" - - -class BackupRestoreOperationType(str, Enum): - - default = "Default" - clone = "Clone" - relocation = "Relocation" - snapshot = "Snapshot" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class ContinuousWebJobStatus(str, Enum): - - initializing = "Initializing" - starting = "Starting" - running = "Running" - pending_restart = "PendingRestart" - stopped = "Stopped" - - -class WebJobType(str, Enum): - - continuous = "Continuous" - triggered = "Triggered" - - -class PublishingProfileFormat(str, Enum): - - file_zilla3 = "FileZilla3" - web_deploy = "WebDeploy" - ftp = "Ftp" - - -class DnsVerificationTestResult(str, Enum): - - passed = "Passed" - failed = "Failed" - skipped = "Skipped" - - -class AzureResourceType(str, Enum): - - website = "Website" - traffic_manager = "TrafficManager" - - -class CustomHostNameDnsRecordType(str, Enum): - - cname = "CName" - a = "A" - - -class HostNameType(str, Enum): - - verified = "Verified" - managed = "Managed" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class MSDeployLogEntryType(str, Enum): - - message = "Message" - warning = "Warning" - error = "Error" - - -class MSDeployProvisioningState(str, Enum): - - accepted = "accepted" - running = "running" - succeeded = "succeeded" - failed = "failed" - canceled = "canceled" - - -class MySqlMigrationType(str, Enum): - - local_to_remote = "LocalToRemote" - remote_to_local = "RemoteToLocal" - - -class OperationStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class PublicCertificateLocation(str, Enum): - - current_user_my = "CurrentUserMy" - local_machine_my = "LocalMachineMy" - unknown = "Unknown" - - -class UnauthenticatedClientAction(str, Enum): - - redirect_to_login_page = "RedirectToLoginPage" - allow_anonymous = "AllowAnonymous" - - -class BuiltInAuthenticationProvider(str, Enum): - - azure_active_directory = "AzureActiveDirectory" - facebook = "Facebook" - google = "Google" - microsoft_account = "MicrosoftAccount" - twitter = "Twitter" - - -class CloneAbilityResult(str, Enum): - - cloneable = "Cloneable" - partially_cloneable = "PartiallyCloneable" - not_cloneable = "NotCloneable" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class SiteExtensionType(str, Enum): - - gallery = "Gallery" - web_root = "WebRoot" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class TriggeredWebJobStatus(str, Enum): - - success = "Success" - failed = "Failed" - error = "Error" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AutoHealActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Predefined action to be taken. + """ + + RECYCLE = "Recycle" + LOG_EVENT = "LogEvent" + CUSTOM_ACTION = "CustomAction" + +class AzureResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Azure resource type. + """ + + WEBSITE = "Website" + TRAFFIC_MANAGER = "TrafficManager" + +class BackupItemStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Backup status. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + SKIPPED = "Skipped" + PARTIALLY_SUCCEEDED = "PartiallySucceeded" + DELETE_IN_PROGRESS = "DeleteInProgress" + DELETE_FAILED = "DeleteFailed" + DELETED = "Deleted" + +class BackupRestoreOperationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the backup. + """ + + DEFAULT = "Default" + CLONE = "Clone" + RELOCATION = "Relocation" + SNAPSHOT = "Snapshot" + +class BuiltInAuthenticationProvider(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The default authentication provider to use when multiple providers are configured. + This setting is only needed if multiple providers are configured and the unauthenticated client + action is set to "RedirectToLoginPage". + """ + + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + FACEBOOK = "Facebook" + GOOGLE = "Google" + MICROSOFT_ACCOUNT = "MicrosoftAccount" + TWITTER = "Twitter" + +class CloneAbilityResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of app. + """ + + CLONEABLE = "Cloneable" + PARTIALLY_CLONEABLE = "PartiallyCloneable" + NOT_CLONEABLE = "NotCloneable" + +class ConnectionStringType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of database. + """ + + MY_SQL = "MySql" + SQL_SERVER = "SQLServer" + SQL_AZURE = "SQLAzure" + CUSTOM = "Custom" + NOTIFICATION_HUB = "NotificationHub" + SERVICE_BUS = "ServiceBus" + EVENT_HUB = "EventHub" + API_HUB = "ApiHub" + DOC_DB = "DocDb" + REDIS_CACHE = "RedisCache" + POSTGRE_SQL = "PostgreSQL" + +class ContinuousWebJobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job status. + """ + + INITIALIZING = "Initializing" + STARTING = "Starting" + RUNNING = "Running" + PENDING_RESTART = "PendingRestart" + STOPPED = "Stopped" + +class CustomHostNameDnsRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Custom DNS record type. + """ + + C_NAME = "CName" + A = "A" + +class DatabaseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Database type (e.g. SqlAzure / MySql). + """ + + SQL_AZURE = "SqlAzure" + MY_SQL = "MySql" + LOCAL_MY_SQL = "LocalMySql" + POSTGRE_SQL = "PostgreSql" + +class DnsVerificationTestResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """DNS verification test result. + """ + + PASSED = "Passed" + FAILED = "Failed" + SKIPPED = "Skipped" + +class FrequencyUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of time for how often the backup should be executed (e.g. for weekly backup, this + should be set to Day and FrequencyInterval should be set to 7) + """ + + DAY = "Day" + HOUR = "Hour" + +class HostNameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Hostname type. + """ + + VERIFIED = "Verified" + MANAGED = "Managed" + +class HostType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether the hostname is a standard or repository hostname. + """ + + STANDARD = "Standard" + REPOSITORY = "Repository" + +class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Log level. + """ + + OFF = "Off" + VERBOSE = "Verbose" + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + +class ManagedPipelineMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Managed pipeline mode. + """ + + INTEGRATED = "Integrated" + CLASSIC = "Classic" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + +class MSDeployLogEntryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Log entry type + """ + + MESSAGE = "Message" + WARNING = "Warning" + ERROR = "Error" + +class MSDeployProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state + """ + + ACCEPTED = "accepted" + RUNNING = "running" + SUCCEEDED = "succeeded" + FAILED = "failed" + CANCELED = "canceled" + +class MySqlMigrationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of migration operation to be done + """ + + LOCAL_TO_REMOTE = "LocalToRemote" + REMOTE_TO_LOCAL = "RemoteToLocal" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the operation. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + +class PublicCertificateLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Public Certificate Location + """ + + CURRENT_USER_MY = "CurrentUserMy" + LOCAL_MACHINE_MY = "LocalMachineMy" + UNKNOWN = "Unknown" + +class PublishingProfileFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of the format. Valid values are: + FileZilla3 + WebDeploy -- default + Ftp + """ + + FILE_ZILLA3 = "FileZilla3" + WEB_DEPLOY = "WebDeploy" + FTP = "Ftp" + +class RouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of route this is: + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 + INHERITED - Routes inherited from the real Virtual Network routes + STATIC - Static route set on the app only + + These values will be used for syncing an app's routes with those from a Virtual Network. + """ + + DEFAULT = "DEFAULT" + INHERITED = "INHERITED" + STATIC = "STATIC" + +class ScmType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SCM type. + """ + + NONE = "None" + DROPBOX = "Dropbox" + TFS = "Tfs" + LOCAL_GIT = "LocalGit" + GIT_HUB = "GitHub" + CODE_PLEX_GIT = "CodePlexGit" + CODE_PLEX_HG = "CodePlexHg" + BITBUCKET_GIT = "BitbucketGit" + BITBUCKET_HG = "BitbucketHg" + EXTERNAL_GIT = "ExternalGit" + EXTERNAL_HG = "ExternalHg" + ONE_DRIVE = "OneDrive" + VSO = "VSO" + +class SiteAvailabilityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Management information availability state for the app. + """ + + NORMAL = "Normal" + LIMITED = "Limited" + DISASTER_RECOVERY_MODE = "DisasterRecoveryMode" + +class SiteExtensionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site extension type. + """ + + GALLERY = "Gallery" + WEB_ROOT = "WebRoot" + +class SiteLoadBalancing(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site load balancing. + """ + + WEIGHTED_ROUND_ROBIN = "WeightedRoundRobin" + LEAST_REQUESTS = "LeastRequests" + LEAST_RESPONSE_TIME = "LeastResponseTime" + WEIGHTED_TOTAL_TRAFFIC = "WeightedTotalTraffic" + REQUEST_HASH = "RequestHash" + +class SslState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SSL type. + """ + + DISABLED = "Disabled" + SNI_ENABLED = "SniEnabled" + IP_BASED_ENABLED = "IpBasedEnabled" + +class SupportedTlsVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """MinTlsVersion: configures the minimum version of TLS required for SSL requests + """ + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" + +class TriggeredWebJobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job status. + """ + + SUCCESS = "Success" + FAILED = "Failed" + ERROR = "Error" + +class UnauthenticatedClientAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The action to take when an unauthenticated client attempts to access the app. + """ + + REDIRECT_TO_LOGIN_PAGE = "RedirectToLoginPage" + ALLOW_ANONYMOUS = "AllowAnonymous" + +class UsageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State indicating whether the app has exceeded its quota usage. Read-only. + """ + + NORMAL = "Normal" + EXCEEDED = "Exceeded" + +class WebJobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job type. + """ + + CONTINUOUS = "Continuous" + TRIGGERED = "Triggered" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/__init__.py index caab7b182000..fd3b4d38e9ea 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._web_apps_operations import WebAppsOperations diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py index 738fbf1fdd2a..f623879d22d7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py @@ -1,1004 +1,990 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class WebAppsOperations(object): """WebAppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_08_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. - :ivar api_version: API Version. Constant value: "2016-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps for a subscription. Get all apps for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SitePaged[~azure.mgmt.web.v2016_08_01.models.Site] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} # type: ignore def list_by_resource_group( - self, resource_group_name, include_slots=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + include_slots=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Gets all web, mobile, and API apps in the specified resource group. Gets all web, mobile, and API apps in the specified resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param include_slots: Specify true to include - deployment slots in results. The default is false, which only gives - you the production slot of all apps. + :param include_slots: Specify :code:`true` to include deployment slots in + results. The default is false, which only gives you the production slot of all apps. :type include_slots: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SitePaged[~azure.mgmt.web.v2016_08_01.models.Site] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if include_slots is not None: query_parameters['includeSlots'] = self._serialize.query("include_slots", include_slots, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Site"] """Gets the details of a web, mobile, or API app. Gets the details of a web, mobile, or API app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Site"] + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - def create_or_update( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. - - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. + :param site_envelope: A JSON representation of the app properties. See example. :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.Site - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Site or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.Site] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.Site]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - site_envelope=site_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Site', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + 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 + ) + 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.Web/sites/{name}'} # type: ignore def delete( - self, resource_group_name, name, delete_metrics=None, delete_empty_server_farm=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + delete_metrics=None, # type: Optional[bool] + delete_empty_server_farm=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a web, mobile, or API app, or one of the deployment slots. Deletes a web, mobile, or API app, or one of the deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app to delete. :type name: str :param delete_metrics: If true, web app metrics are also deleted. :type delete_metrics: bool - :param delete_empty_server_farm: Specify false if you want to keep - empty App Service plan. By default, empty App Service plan is deleted. + :param delete_empty_server_farm: Specify false if you want to keep empty App Service plan. By + default, empty App Service plan is deleted. :type delete_empty_server_farm: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if delete_metrics is not None: query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') if delete_empty_server_farm is not None: query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + if cls: + return cls(pipeline_response, None, {}) - def update( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def update( + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.SitePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: - ~azure.mgmt.web.v2016_08_01.models.SitePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def analyze_custom_hostname( - self, resource_group_name, name, host_name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomHostnameAnalysisResult" """Analyze a custom hostname. Analyze a custom hostname. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param host_name: Custom hostname. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomHostnameAnalysisResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.CustomHostnameAnalysisResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.analyze_custom_hostname.metadata['url'] + url = self.analyze_custom_hostname.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if host_name is not None: query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('CustomHostnameAnalysisResult', response) + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} + analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} # type: ignore def apply_slot_config_to_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - """Applies the configuration settings from the target slot onto the - current slot. + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + """Applies the configuration settings from the target slot onto the current slot. - Applies the configuration settings from the target slot onto the - current slot. + Applies the configuration settings from the target slot onto the current slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :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 """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.apply_slot_config_to_production.metadata['url'] + url = self.apply_slot_config_to_production.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} + apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} # type: ignore def backup( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Creates a backup of an app. Creates a backup of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: Backup configuration. You can use the JSON response - from the POST action as input here. + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.backup.metadata['url'] + url = self.backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} + backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} # type: ignore def list_backups( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2016_08_01.models.BackupItemPaged[~azure.mgmt.web.v2016_08_01.models.BackupItem] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_backups.metadata['url'] + url = self.list_backups.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} + return ItemPaged( + get_next, extract_data + ) + list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} # type: ignore def discover_restore( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): - """Discovers an existing app backup that can be restored from a blob in - Azure storage. + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreRequest" + """Discovers an existing app backup that can be restored from a blob in Azure storage. - Discovers an existing app backup that can be restored from a blob in - Azure storage. + Discovers an existing app backup that can be restored from a blob in Azure storage. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: A RestoreRequest object that includes Azure storage - URL and blog name for discovery of backup. + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RestoreRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.discover_restore.metadata['url'] + url = self.discover_restore.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RestoreRequest', response) + deserialized = self._deserialize('RestoreRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - discover_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover'} + discover_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover'} # type: ignore def get_backup_status( - self, resource_group_name, name, backup_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Gets a backup of an app by its ID. Gets a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_backup_status.metadata['url'] + url = self.get_backup_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} + get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore def delete_backup( - self, resource_group_name, name, backup_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a backup of an app by its ID. Deletes a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_backup.metadata['url'] + url = self.delete_backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def list_backup_status_secrets( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, **operation_config): - """Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + if cls: + return cls(pipeline_response, None, {}) - Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_backup_status_secrets( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str @@ -1006,125 +992,124 @@ def list_backup_status_secrets( :type backup_id: str :param request: Information on backup request. :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.list_backup_status_secrets.metadata['url'] + url = self.list_backup_status_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} - + list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} # type: ignore def _restore_initial( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore.metadata['url'] + url = self._restore_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('RestoreResponse', response) + deserialized = self._deserialize('RestoreResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore - def restore( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, polling=True, **operation_config): - """Restores a specific backup to another app (or deployment slot, if - specified). + def begin_restore( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.RestoreResponse"] + """Restores a specific backup to another app (or deployment slot, if specified). - Restores a specific backup to another app (or deployment slot, if - specified). + Restores a specific backup to another app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str @@ -1132,2386 +1117,2266 @@ def restore( :type backup_id: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns RestoreResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.RestoreResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.RestoreResponse]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_initial( - resource_group_name=resource_group_name, - name=name, - backup_id=backup_id, - request=request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either RestoreResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.RestoreResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('RestoreResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RestoreResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore def list_configurations( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigResourceCollection"] """List the configurations of an app. List the configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigResource - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigResourcePaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configurations.metadata['url'] + url = self.list_configurations.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} + return ItemPaged( + get_next, extract_data + ) + list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} # type: ignore def update_application_settings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the application settings of an app. Replaces the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_application_settings.metadata['url'] + url = self.update_application_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} + update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} # type: ignore def list_application_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of an app. Gets the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_application_settings.metadata['url'] + url = self.list_application_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} + list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} # type: ignore def update_auth_settings( - self, resource_group_name, name, site_auth_settings, custom_headers=None, raw=False, **operation_config): - """Updates the Authentication / Authorization settings associated with web - app. + self, + resource_group_name, # type: str + name, # type: str + site_auth_settings, # type: "models.SiteAuthSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" + """Updates the Authentication / Authorization settings associated with web app. - Updates the Authentication / Authorization settings associated with web - app. + Updates the Authentication / Authorization settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param site_auth_settings: Auth settings associated with web app. - :type site_auth_settings: - ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type site_auth_settings: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_auth_settings.metadata['url'] + url = self.update_auth_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} + update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} # type: ignore def get_auth_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" """Gets the Authentication/Authorization settings of an app. Gets the Authentication/Authorization settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_auth_settings.metadata['url'] + url = self.get_auth_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} + get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} # type: ignore def update_backup_configuration( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Updates the backup configuration of an app. Updates the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param request: Edited backup configuration. :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_backup_configuration.metadata['url'] + url = self.update_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} + update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore def delete_backup_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the backup configuration of an app. Deletes the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_backup_configuration.metadata['url'] + url = self.delete_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} + delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore def get_backup_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Gets the backup configuration of an app. Gets the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_backup_configuration.metadata['url'] + url = self.get_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} + get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} # type: ignore def update_connection_strings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + connection_strings, # type: "models.ConnectionStringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Replaces the connection strings of an app. Replaces the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2016_08_01.models.ConnStringValueTypePair] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ - connection_strings = models.ConnectionStringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_connection_strings.metadata['url'] + url = self.update_connection_strings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} + update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} # type: ignore def list_connection_strings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Gets the connection strings of an app. Gets the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_connection_strings.metadata['url'] + url = self.list_connection_strings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} # type: ignore def get_diagnostic_logs_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Gets the logging configuration of an app. Gets the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_diagnostic_logs_configuration.metadata['url'] + url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} + get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore def update_diagnostic_logs_config( - self, resource_group_name, name, site_logs_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_logs_config, # type: "models.SiteLogsConfig" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Updates the logging configuration of an app. Updates the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_logs_config: A SiteLogsConfig JSON object that contains - the logging configuration to change in the "properties" property. - :type site_logs_config: - ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_diagnostic_logs_config.metadata['url'] + url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} + update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore def update_metadata( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + metadata, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the metadata of an app. Replaces the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_metadata.metadata['url'] + url = self.update_metadata.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} + update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} # type: ignore def list_metadata( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the metadata of an app. Gets the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_metadata.metadata['url'] + url = self.list_metadata.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} - + list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} # type: ignore def _list_publishing_credentials_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.User" + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_publishing_credentials.metadata['url'] + url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def list_publishing_credentials( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _list_publishing_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + def begin_list_publishing_credentials( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.User"] """Gets the Git/FTP publishing credentials of an app. Gets the Git/FTP publishing credentials of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns User or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.User] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.User]] - :raises: :class:`CloudError` - """ - raw_result = self._list_publishing_credentials_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('User', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._list_publishing_credentials_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore def update_site_push_settings( - self, resource_group_name, name, push_settings, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + push_settings, # type: "models.PushSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Updates the Push settings associated with web app. Updates the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param push_settings: Push settings associated with web app. :type push_settings: ~azure.mgmt.web.v2016_08_01.models.PushSettings - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_site_push_settings.metadata['url'] + url = self.update_site_push_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} + update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} # type: ignore def list_site_push_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Gets the Push settings associated with web app. Gets the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_site_push_settings.metadata['url'] + url = self.list_site_push_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} + list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} # type: ignore def list_slot_configuration_names( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the names of app settings and connection strings that stick to the - slot (not swapped). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SlotConfigNamesResource" + """Gets the names of app settings and connection strings that stick to the slot (not swapped). - Gets the names of app settings and connection strings that stick to the - slot (not swapped). + Gets the names of app settings and connection strings that stick to the slot (not swapped). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SlotConfigNamesResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_slot_configuration_names.metadata['url'] + url = self.list_slot_configuration_names.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SlotConfigNamesResource', response) + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} + list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore def update_slot_configuration_names( - self, resource_group_name, name, slot_config_names, custom_headers=None, raw=False, **operation_config): - """Updates the names of application settings and connection string that - remain with the slot during swap operation. + self, + resource_group_name, # type: str + name, # type: str + slot_config_names, # type: "models.SlotConfigNamesResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SlotConfigNamesResource" + """Updates the names of application settings and connection string that remain with the slot during swap operation. - Updates the names of application settings and connection string that - remain with the slot during swap operation. + Updates the names of application settings and connection string that remain with the slot + during swap operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot_config_names: Names of application settings and connection - strings. See example. - :type slot_config_names: - ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SlotConfigNamesResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param slot_config_names: Names of application settings and connection strings. See example. + :type slot_config_names: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_slot_configuration_names.metadata['url'] + url = self.update_slot_configuration_names.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SlotConfigNamesResource', response) + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} + update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore def get_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. - Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_configuration.metadata['url'] + url = self.get_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def create_or_update_configuration( - self, resource_group_name, name, site_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_configuration.metadata['url'] + url = self.create_or_update_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def update_configuration( - self, resource_group_name, name, site_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_configuration.metadata['url'] + url = self.update_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def list_configuration_snapshot_info( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigurationSnapshotInfoCollection"] + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. - Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigurationSnapshotInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfoPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configuration_snapshot_info.metadata['url'] + url = self.list_configuration_snapshot_info.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigurationSnapshotInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigurationSnapshotInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} # type: ignore def get_configuration_snapshot( - self, resource_group_name, name, snapshot_id, custom_headers=None, raw=False, **operation_config): - """Gets a snapshot of the configuration of an app at a previous point in - time. + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets a snapshot of the configuration of an app at a previous point in time. - Gets a snapshot of the configuration of an app at a previous point in - time. + Gets a snapshot of the configuration of an app at a previous point in time. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_configuration_snapshot.metadata['url'] + url = self.get_configuration_snapshot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} + get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} # type: ignore def recover_site_configuration_snapshot( - self, resource_group_name, name, snapshot_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reverts the configuration of an app to a previous snapshot. Reverts the configuration of an app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.recover_site_configuration_snapshot.metadata['url'] + url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} + recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} # type: ignore def get_web_site_container_logs( - self, resource_group_name, name, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the last lines of docker logs for the given site. Gets the last lines of docker logs for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_web_site_container_logs.metadata['url'] + url = self.get_web_site_container_logs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/octet-stream' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} + get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} # type: ignore def get_web_site_container_logs_zip( - self, resource_group_name, name, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the ZIP archived docker log files for the given site. Gets the ZIP archived docker log files for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_web_site_container_logs_zip.metadata['url'] + url = self.get_web_site_container_logs_zip.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/zip' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} + get_web_site_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} # type: ignore def list_continuous_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ContinuousWebJobCollection"] """List continuous web jobs for an app, or a deployment slot. List continuous web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContinuousWebJob - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobPaged[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_continuous_web_jobs.metadata['url'] + url = self.list_continuous_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContinuousWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContinuousWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} # type: ignore def get_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ContinuousWebJob"] """Gets a continuous web job by its ID for an app, or a deployment slot. Gets a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContinuousWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_continuous_web_job.metadata['url'] + url = self.get_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ContinuousWebJob', response) + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} + get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore def delete_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a continuous web job by its ID for an app, or a deployment slot. Delete a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_continuous_web_job.metadata['url'] + url = self.delete_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} + delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore def start_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Start a continuous web job for an app, or a deployment slot. Start a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.start_continuous_web_job.metadata['url'] + url = self.start_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} + start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} # type: ignore def stop_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop a continuous web job for an app, or a deployment slot. Stop a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.stop_continuous_web_job.metadata['url'] + url = self.stop_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} + stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} # type: ignore def list_deployments( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentCollection"] """List deployments for an app, or a deployment slot. List deployments for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Deployment - :rtype: - ~azure.mgmt.web.v2016_08_01.models.DeploymentPaged[~azure.mgmt.web.v2016_08_01.models.Deployment] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_deployments.metadata['url'] + url = self.list_deployments.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} # type: ignore def get_deployment( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Get a deployment by its ID for an app, or a deployment slot. Get a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_deployment.metadata['url'] + url = self.get_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def create_deployment( - self, resource_group_name, name, id, deployment, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + deployment, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Create a deployment for an app, or a deployment slot. Create a deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str @@ -3519,1517 +3384,1475 @@ def create_deployment( :type id: str :param deployment: Deployment details. :type deployment: ~azure.mgmt.web.v2016_08_01.models.Deployment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_deployment.metadata['url'] + url = self.create_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def delete_deployment( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a deployment by its ID for an app, or a deployment slot. Delete a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_deployment.metadata['url'] + url = self.delete_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def list_deployment_log( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): - """List deployment log for specific deployment for an app, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" + """List deployment log for specific deployment for an app, or a deployment slot. - List deployment log for specific deployment for an app, or a deployment - slot. + List deployment log for specific deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param id: The ID of a specific deployment. This is the value of the - name property in the JSON response from "GET - /api/sites/{siteName}/deployments". + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_deployment_log.metadata['url'] + url = self.list_deployment_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} + list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} # type: ignore def list_domain_ownership_identifiers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """Lists ownership identifiers for domain associated with web app. Lists ownership identifiers for domain associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2016_08_01.models.IdentifierPaged[~azure.mgmt.web.v2016_08_01.models.Identifier] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_domain_ownership_identifiers.metadata['url'] + url = self.list_domain_ownership_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} # type: ignore def get_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" """Get domain ownership identifier for web app. Get domain ownership identifier for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_domain_ownership_identifier.metadata['url'] + url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def create_or_update_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_domain_ownership_identifier.metadata['url'] + url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def delete_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a domain ownership identifier for a web app. Deletes a domain ownership identifier for a web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_domain_ownership_identifier.metadata['url'] + url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def update_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_domain_ownership_identifier.metadata['url'] + url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def get_ms_deploy_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_ms_deploy_status.metadata['url'] + url = self.get_ms_deploy_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} - + get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore def _create_ms_deploy_operation_initial( - self, resource_group_name, name, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_ms_deploy_operation.metadata['url'] + url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_ms_deploy_operation( - self, resource_group_name, name, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + _create_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + def begin_create_ms_deploy_operation( + self, + resource_group_name, # type: str + name, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_ms_deploy_operation_initial( - resource_group_name=resource_group_name, - name=name, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore def get_ms_deploy_log( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_ms_deploy_log.metadata['url'] + url = self.get_ms_deploy_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} + get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} # type: ignore def list_functions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.FunctionEnvelopeCollection"] """List the functions for a web site, or a deployment slot. List the functions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of FunctionEnvelope - :rtype: - ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelopePaged[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_functions.metadata['url'] + url = self.list_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('FunctionEnvelopeCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.FunctionEnvelopePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} # type: ignore def get_functions_admin_token( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Fetch a short lived token that can be exchanged for a master key. Fetch a short lived token that can be exchanged for a master key. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_functions_admin_token.metadata['url'] + url = self.get_functions_admin_token.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} + get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} # type: ignore def get_function( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.FunctionEnvelope"] """Get function information by its ID for web site, or a deployment slot. Get function information by its ID for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionEnvelope or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_function.metadata['url'] + url = self.get_function.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} - + get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def _create_function_initial( - self, resource_group_name, name, function_name, function_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionEnvelope" + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_function.metadata['url'] + url = self._create_function_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_function( - self, resource_group_name, name, function_name, function_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_function_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + def begin_create_function( + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.FunctionEnvelope"] """Create function for web site, or a deployment slot. Create function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str :param function_envelope: Function details. - :type function_envelope: - ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type function_envelope: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns FunctionEnvelope or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope]] - :raises: :class:`CloudError` - """ - raw_result = self._create_function_initial( - resource_group_name=resource_group_name, - name=name, - function_name=function_name, - function_envelope=function_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('FunctionEnvelope', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_function_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def delete_function( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function for web site, or a deployment slot. Delete a function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_function.metadata['url'] + url = self.delete_function.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} + delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def list_function_secrets( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): - """Get function secrets for a function in a web site, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" + """Get function secrets for a function in a web site, or a deployment slot. - Get function secrets for a function in a web site, or a deployment - slot. + Get function secrets for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_function_secrets.metadata['url'] + url = self.list_function_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} + list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} # type: ignore def list_host_name_bindings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HostNameBindingCollection"] """Get hostname bindings for an app or a deployment slot. Get hostname bindings for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HostNameBinding - :rtype: - ~azure.mgmt.web.v2016_08_01.models.HostNameBindingPaged[~azure.mgmt.web.v2016_08_01.models.HostNameBinding] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_host_name_bindings.metadata['url'] + url = self.list_host_name_bindings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HostNameBindingCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HostNameBindingPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} + return ItemPaged( + get_next, extract_data + ) + list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} # type: ignore def get_host_name_binding( - self, resource_group_name, name, host_name, custom_headers=None, raw=False, **operation_config): - """Get the named hostname binding for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" + """Get the named hostname binding for an app (or deployment slot, if specified). - Get the named hostname binding for an app (or deployment slot, if - specified). + Get the named hostname binding for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_host_name_binding.metadata['url'] + url = self.get_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def create_or_update_host_name_binding( - self, resource_group_name, name, host_name, host_name_binding, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + host_name_binding, # type: "models.HostNameBinding" + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param host_name_binding: Binding details. This is the JSON - representation of a HostNameBinding object. - :type host_name_binding: - ~azure.mgmt.web.v2016_08_01.models.HostNameBinding - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_host_name_binding.metadata['url'] + url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def delete_host_name_binding( - self, resource_group_name, name, host_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_host_name_binding.metadata['url'] + url = self.delete_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def get_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): - """Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. - Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + Retrieves a specific Service Bus Hybrid Connection used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5037,69 +4860,66 @@ def get_hybrid_connection( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_hybrid_connection.metadata['url'] + url = self.get_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def create_or_update_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5108,75 +4928,72 @@ def create_or_update_hybrid_connection( :param relay_name: The relay name for this hybrid connection. :type relay_name: str :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.HybridConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_hybrid_connection.metadata['url'] + url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Removes a Hybrid Connection from this site. Removes a Hybrid Connection from this site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5184,61 +5001,62 @@ def delete_hybrid_connection( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_hybrid_connection.metadata['url'] + url = self.delete_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def update_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5247,75 +5065,72 @@ def update_hybrid_connection( :param relay_name: The relay name for this hybrid connection. :type relay_name: str :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.HybridConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_hybrid_connection.metadata['url'] + url = self.update_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Gets the send key name and value for a Hybrid Connection. Gets the send key name and value for a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5323,1184 +5138,1138 @@ def list_hybrid_connection_keys( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_hybrid_connection_keys.metadata['url'] + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_hybrid_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieves all Service Bus Hybrid Connections used by this Web App. Retrieves all Service Bus Hybrid Connections used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_hybrid_connections.metadata['url'] + url = self.list_hybrid_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} # type: ignore def list_relay_service_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets hybrid connections configured for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Gets hybrid connections configured for an app (or deployment slot, if specified). - Gets hybrid connections configured for an app (or deployment slot, if - specified). + Gets hybrid connections configured for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_relay_service_connections.metadata['url'] + url = self.list_relay_service_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} + list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} # type: ignore def get_relay_service_connection( - self, resource_group_name, name, entity_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" """Gets a hybrid connection configuration by its name. Gets a hybrid connection configuration by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection. :type entity_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_relay_service_connection.metadata['url'] + url = self.get_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def create_or_update_relay_service_connection( - self, resource_group_name, name, entity_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_relay_service_connection.metadata['url'] + url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def delete_relay_service_connection( - self, resource_group_name, name, entity_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a relay service connection by its name. Deletes a relay service connection by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_relay_service_connection.metadata['url'] + url = self.delete_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def update_relay_service_connection( - self, resource_group_name, name, entity_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_relay_service_connection.metadata['url'] + url = self.update_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def list_instance_identifiers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppInstanceCollection"] """Gets all scale-out instances of an app. Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteInstance - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteInstancePaged[~azure.mgmt.web.v2016_08_01.models.SiteInstance] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_identifiers.metadata['url'] + url = self.list_instance_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppInstanceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} + return ItemPaged( + get_next, extract_data + ) + list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} # type: ignore def get_instance_ms_deploy_status( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_ms_deploy_status.metadata['url'] + url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} - + get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def _create_instance_ms_deploy_operation_initial( - self, resource_group_name, name, instance_id, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_ms_deploy_operation.metadata['url'] + url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_instance_ms_deploy_operation( - self, resource_group_name, name, instance_id, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + _create_instance_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + def begin_create_instance_ms_deploy_operation( + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_instance_ms_deploy_operation_initial( - resource_group_name=resource_group_name, - name=name, - instance_id=instance_id, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def get_instance_ms_deploy_log( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_ms_deploy_log.metadata['url'] + url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} + get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore def list_instance_processes( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_processes.metadata['url'] + url = self.list_instance_processes.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} # type: ignore def get_instance_process( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process.metadata['url'] + url = self.get_instance_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} + get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore def delete_instance_process( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_instance_process.metadata['url'] + url = self.delete_instance_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} + delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore def get_instance_process_dump( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_dump.metadata['url'] + url = self.get_instance_process_dump.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} + get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore def list_instance_process_modules( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. - List module information for a process by its ID for a specific - scaled-out instance in a web site. + List module information for a process by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_modules.metadata['url'] + url = self.list_instance_process_modules.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore def get_instance_process_module( - self, resource_group_name, name, process_id, base_address, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -6508,161 +6277,156 @@ def get_instance_process_module( :type process_id: str :param base_address: Module base address. :type base_address: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_module.metadata['url'] + url = self.get_instance_process_module.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} + get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_instance_process_threads( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_threads.metadata['url'] + url = self.list_instance_process_threads.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore def get_instance_process_thread( - self, resource_group_name, name, process_id, thread_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -6670,718 +6434,719 @@ def get_instance_process_thread( :type process_id: str :param thread_id: TID. :type thread_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_thread.metadata['url'] + url = self.get_instance_process_thread.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'threadId': self._serialize.url("thread_id", thread_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} + get_instance_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore def is_cloneable( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Shows whether an app can be cloned to another resource group or - subscription. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteCloneability" + """Shows whether an app can be cloned to another resource group or subscription. - Shows whether an app can be cloned to another resource group or - subscription. + Shows whether an app can be cloned to another resource group or subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteCloneability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteCloneability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.is_cloneable.metadata['url'] + url = self.is_cloneable.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteCloneability', response) + deserialized = self._deserialize('SiteCloneability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} + is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} # type: ignore def list_sync_function_triggers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" """This is to allow calling via powershell and ARM template. This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_sync_function_triggers.metadata['url'] + url = self.list_sync_function_triggers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} + list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} # type: ignore def list_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets all metric definitions of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Gets all metric definitions of an app (or deployment slot, if specified). - Gets all metric definitions of an app (or deployment slot, if - specified). + Gets all metric definitions of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metric_definitions.metadata['url'] + url = self.list_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions'} # type: ignore def list_metrics( - self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Gets performance metrics of an app (or deployment slot, if specified). Gets performance metrics of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param details: Specify "true" to include metric details in the - response. It is "false" by default. + :param details: Specify "true" to include metric details in the response. It is "false" by + default. :type details: bool - :param filter: Return only metrics specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and - endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics.metadata['url'] + url = self.list_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics'} # type: ignore def _migrate_storage_initial( - self, subscription_name, resource_group_name, name, migration_options, custom_headers=None, raw=False, **operation_config): + self, + subscription_name, # type: str + resource_group_name, # type: str + name, # type: str + migration_options, # type: "models.StorageMigrationOptions" + **kwargs # type: Any + ): + # type: (...) -> "models.StorageMigrationResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.migrate_storage.metadata['url'] + url = self._migrate_storage_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['subscriptionName'] = self._serialize.query("subscription_name", subscription_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('StorageMigrationResponse', response) + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def migrate_storage( - self, subscription_name, resource_group_name, name, migration_options, custom_headers=None, raw=False, polling=True, **operation_config): + _migrate_storage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + def begin_migrate_storage( + self, + subscription_name, # type: str + resource_group_name, # type: str + name, # type: str + migration_options, # type: "models.StorageMigrationOptions" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.StorageMigrationResponse"] """Restores a web app. Restores a web app. :param subscription_name: Azure subscription. :type subscription_name: str - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param migration_options: Migration migrationOptions. - :type migration_options: - ~azure.mgmt.web.v2016_08_01.models.StorageMigrationOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type migration_options: ~azure.mgmt.web.v2016_08_01.models.StorageMigrationOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - StorageMigrationResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.StorageMigrationResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.StorageMigrationResponse]] - :raises: :class:`CloudError` - """ - raw_result = self._migrate_storage_initial( - subscription_name=subscription_name, - resource_group_name=resource_group_name, - name=name, - migration_options=migration_options, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageMigrationResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.StorageMigrationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('StorageMigrationResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._migrate_storage_initial( + subscription_name=subscription_name, + resource_group_name=resource_group_name, + name=name, + migration_options=migration_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore def _migrate_my_sql_initial( - self, resource_group_name, name, migration_request_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + migration_request_envelope, # type: "models.MigrateMySqlRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.Operation" + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.migrate_my_sql.metadata['url'] + url = self._migrate_my_sql_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('Operation', response) + deserialized = self._deserialize('Operation', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def migrate_my_sql( - self, resource_group_name, name, migration_request_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _migrate_my_sql_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + def begin_migrate_my_sql( + self, + resource_group_name, # type: str + name, # type: str + migration_request_envelope, # type: "models.MigrateMySqlRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Operation"] """Migrates a local (in-app) MySql database to a remote MySql database. Migrates a local (in-app) MySql database to a remote MySql database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param migration_request_envelope: MySql migration options. - :type migration_request_envelope: - ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type migration_request_envelope: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Operation or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.Operation] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.Operation]] - :raises: :class:`CloudError` - """ - raw_result = self._migrate_my_sql_initial( - resource_group_name=resource_group_name, - name=name, - migration_request_envelope=migration_request_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Operation or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Operation', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._migrate_my_sql_initial( + resource_group_name=resource_group_name, + name=name, + migration_request_envelope=migration_request_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore def get_migrate_my_sql_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MigrateMySqlStatus" + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MigrateMySqlStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlStatus or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_migrate_my_sql_status.metadata['url'] + url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MigrateMySqlStatus', response) + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} + get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} # type: ignore def list_network_features( - self, resource_group_name, name, view, custom_headers=None, raw=False, **operation_config): - """Gets all network features used by the app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + view, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.NetworkFeatures"] + """Gets all network features used by the app (or deployment slot, if specified). - Gets all network features used by the app (or deployment slot, if - specified). + Gets all network features used by the app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param view: The type of view. This can either be "summary" or - "detailed". + :param view: The type of view. This can either be "summary" or "detailed". :type view: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NetworkFeatures or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.NetworkFeatures or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_network_features.metadata['url'] + url = self.list_network_features.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'view': self._serialize.url("view", view, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('NetworkFeatures', response) + deserialized = self._deserialize('NetworkFeatures', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} + list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} # type: ignore def start_web_site_network_trace( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str """Start capturing network packets for the site. Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -7391,963 +7156,910 @@ def start_web_site_network_trace( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.start_web_site_network_trace.metadata['url'] + url = self.start_web_site_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} + start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} # type: ignore def stop_web_site_network_trace( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Stop ongoing capturing network packets for the site. Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.stop_web_site_network_trace.metadata['url'] + url = self.stop_web_site_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} + stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} # type: ignore def generate_new_site_publishing_password( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Generates a new publishing password for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Generates a new publishing password for an app (or deployment slot, if specified). - Generates a new publishing password for an app (or deployment slot, if - specified). + Generates a new publishing password for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.generate_new_site_publishing_password.metadata['url'] + url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} + generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} # type: ignore def list_perf_mon_counters( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PerfMonCounterCollection"] """Gets perfmon counters for web app. Gets perfmon counters for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PerfMonResponse - :rtype: - ~azure.mgmt.web.v2016_08_01.models.PerfMonResponsePaged[~azure.mgmt.web.v2016_08_01.models.PerfMonResponse] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_perf_mon_counters.metadata['url'] + url = self.list_perf_mon_counters.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PerfMonResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} + return ItemPaged( + get_next, extract_data + ) + list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} # type: ignore def get_site_php_error_log_flag( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SitePhpErrorLogFlag" """Gets web app's event logs. Gets web app's event logs. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SitePhpErrorLogFlag or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SitePhpErrorLogFlag or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_site_php_error_log_flag.metadata['url'] + url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SitePhpErrorLogFlag', response) + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} + get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} # type: ignore def list_premier_add_ons( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets the premier add-ons of an app. Gets the premier add-ons of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_premier_add_ons.metadata['url'] + url = self.list_premier_add_ons.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} + list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} # type: ignore def get_premier_add_on( - self, resource_group_name, name, premier_add_on_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets a named add-on of an app. Gets a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_premier_add_on.metadata['url'] + url = self.get_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def add_premier_add_on( - self, resource_group_name, name, premier_add_on_name, premier_add_on, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + premier_add_on, # type: "models.PremierAddOn" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. + :param premier_add_on: A JSON representation of the edited premier add-on. :type premier_add_on: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.add_premier_add_on.metadata['url'] + url = self.add_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def delete_premier_add_on( - self, resource_group_name, name, premier_add_on_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a premier add-on from an app. Delete a premier add-on from an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_premier_add_on.metadata['url'] + url = self.delete_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + if cls: + return cls(pipeline_response, None, {}) - def list_processes( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + def list_processes( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_processes.metadata['url'] + url = self.list_processes.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} # type: ignore def get_process( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process.metadata['url'] + url = self.get_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} + get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore def delete_process( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_process.metadata['url'] + url = self.delete_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} + delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore def get_process_dump( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_dump.metadata['url'] + url = self.get_process_dump.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} + get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} # type: ignore def list_process_modules( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. - List module information for a process by its ID for a specific - scaled-out instance in a web site. + List module information for a process by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_modules.metadata['url'] + url = self.list_process_modules.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} # type: ignore def get_process_module( - self, resource_group_name, name, process_id, base_address, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -8355,151 +8067,146 @@ def get_process_module( :type process_id: str :param base_address: Module base address. :type base_address: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_module.metadata['url'] + url = self.get_process_module.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} + get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_process_threads( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_threads.metadata['url'] + url = self.list_process_threads.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} # type: ignore def get_process_thread( - self, resource_group_name, name, process_id, thread_id, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -8507,1100 +8214,1107 @@ def get_process_thread( :type process_id: str :param thread_id: TID. :type thread_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_thread.metadata['url'] + url = self.get_process_thread.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'threadId': self._serialize.url("thread_id", thread_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads/{threadId}'} + get_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads/{threadId}'} # type: ignore def list_public_certificates( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PublicCertificateCollection"] """Get public certificates for an app or a deployment slot. Get public certificates for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PublicCertificate - :rtype: - ~azure.mgmt.web.v2016_08_01.models.PublicCertificatePaged[~azure.mgmt.web.v2016_08_01.models.PublicCertificate] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_public_certificates.metadata['url'] + url = self.list_public_certificates.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PublicCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PublicCertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} + return ItemPaged( + get_next, extract_data + ) + list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} # type: ignore def get_public_certificate( - self, resource_group_name, name, public_certificate_name, custom_headers=None, raw=False, **operation_config): - """Get the named public certificate for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" + """Get the named public certificate for an app (or deployment slot, if specified). - Get the named public certificate for an app (or deployment slot, if - specified). + Get the named public certificate for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_public_certificate.metadata['url'] + url = self.get_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def create_or_update_public_certificate( - self, resource_group_name, name, public_certificate_name, public_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + public_certificate, # type: "models.PublicCertificate" + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param public_certificate: Public certificate details. This is the - JSON representation of a PublicCertificate object. - :type public_certificate: - ~azure.mgmt.web.v2016_08_01.models.PublicCertificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_public_certificate.metadata['url'] + url = self.create_or_update_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def delete_public_certificate( - self, resource_group_name, name, public_certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_public_certificate.metadata['url'] + url = self.delete_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def list_publishing_profile_xml_with_secrets( - self, resource_group_name, name, format=None, custom_headers=None, raw=False, callback=None, **operation_config): - """Gets the publishing profile for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + publishing_profile_options, # type: "models.CsmPublishingProfileOptions" + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets the publishing profile for an app (or deployment slot, if specified). - Gets the publishing profile for an app (or deployment slot, if - specified). + Gets the publishing profile for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param format: Name of the format. Valid values are: - FileZilla3 - WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2016_08_01.models.PublishingProfileFormat - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2016_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError """ - publishing_profile_options = models.CsmPublishingProfileOptions(format=format) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.list_publishing_profile_xml_with_secrets.metadata['url'] + url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/xml' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} - + list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} # type: ignore def _recover_initial( - self, resource_group_name, name, recovery_entity, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + recovery_entity, # type: "models.SnapshotRecoveryRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.recover.metadata['url'] + url = self._recover_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def recover( - self, resource_group_name, name, recovery_entity, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _recover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover'} # type: ignore + + def begin_recover( + self, + resource_group_name, # type: str + name, # type: str + recovery_entity, # type: "models.SnapshotRecoveryRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Recovers a web app to a previous snapshot. Recovers a web app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param recovery_entity: Snapshot data used for web app recovery. - Snapshot information can be obtained by calling GetDeletedSites or - GetSiteSnapshots API. - :type recovery_entity: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param recovery_entity: Snapshot data used for web app recovery. Snapshot information can be + obtained by calling GetDeletedSites or GetSiteSnapshots API. + :type recovery_entity: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._recover_initial( - resource_group_name=resource_group_name, - name=name, - recovery_entity=recovery_entity, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._recover_initial( + resource_group_name=resource_group_name, + name=name, + recovery_entity=recovery_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - recover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover'} # type: ignore def reset_production_slot_config( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. - Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.reset_production_slot_config.metadata['url'] + url = self.reset_production_slot_config.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} + if cls: + return cls(pipeline_response, None, {}) + + reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} # type: ignore def restart( - self, resource_group_name, name, soft_restart=None, synchronous=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + soft_restart=None, # type: Optional[bool] + synchronous=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restarts an app (or deployment slot, if specified). Restarts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param soft_restart: Specify true to apply the configuration settings - and restarts the app only if necessary. By default, the API always - restarts and reprovisions the app. + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. :type soft_restart: bool - :param synchronous: Specify true to block until the app is restarted. - By default, it is set to false, and the API responds immediately - (asynchronous). + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). :type synchronous: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.restart.metadata['url'] + url = self.restart.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') if synchronous is not None: query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} + if cls: + return cls(pipeline_response, None, {}) + + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} # type: ignore def list_site_extensions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteExtensionInfoCollection"] """Get list of site extensions for a web site, or a deployment slot. Get list of site extensions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteExtensionInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfoPaged[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_extensions.metadata['url'] + url = self.list_site_extensions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteExtensionInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} + return ItemPaged( + get_next, extract_data + ) + list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} # type: ignore def get_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): - """Get site extension information by its ID for a web site, or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + """Get site extension information by its ID for a web site, or a deployment slot. - Get site extension information by its ID for a web site, or a - deployment slot. + Get site extension information by its ID for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteExtensionInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_site_extension.metadata['url'] + url = self.get_site_extension.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} - + get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def _install_site_extension_initial( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.install_site_extension.metadata['url'] + url = self._install_site_extension_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def install_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, polling=True, **operation_config): + _install_site_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + def begin_install_site_extension( + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteExtensionInfo"] """Install site extension on a web site, or a deployment slot. Install site extension on a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteExtensionInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo]] - :raises: :class:`CloudError` - """ - raw_result = self._install_site_extension_initial( - resource_group_name=resource_group_name, - name=name, - site_extension_id=site_extension_id, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteExtensionInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_site_extension_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def delete_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Remove a site extension from a web site, or a deployment slot. Remove a site extension from a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_site_extension.metadata['url'] + url = self.delete_site_extension.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} + delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def list_slots( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Gets an app's deployment slots. Gets an app's deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SitePaged[~azure.mgmt.web.v2016_08_01.models.Site] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slots.metadata['url'] + url = self.list_slots.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} + return ItemPaged( + get_next, extract_data + ) + list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} # type: ignore def get_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Site"] """Gets the details of a web, mobile, or API app. Gets the details of a web, mobile, or API app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. By default, this API returns - the production slot. + :param slot: Name of the deployment slot. By default, this API returns the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_slot.metadata['url'] + url = self.get_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} - + get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def _create_or_update_slot_initial( - self, resource_group_name, name, site_envelope, slot, skip_dns_registration=None, skip_custom_domain_verification=None, force_dns_registration=None, ttl_in_seconds=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.Site" + skip_dns_registration=None, # type: Optional[bool] + skip_custom_domain_verification=None, # type: Optional[bool] + force_dns_registration=None, # type: Optional[bool] + ttl_in_seconds=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_slot.metadata['url'] + url = self._create_or_update_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if skip_dns_registration is not None: query_parameters['skipDnsRegistration'] = self._serialize.query("skip_dns_registration", skip_dns_registration, 'bool') if skip_custom_domain_verification is not None: @@ -9609,252 +9323,269 @@ def _create_or_update_slot_initial( query_parameters['forceDnsRegistration'] = self._serialize.query("force_dns_registration", force_dns_registration, 'bool') if ttl_in_seconds is not None: query_parameters['ttlInSeconds'] = self._serialize.query("ttl_in_seconds", ttl_in_seconds, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + def begin_create_or_update_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.Site" + skip_dns_registration=None, # type: Optional[bool] + skip_custom_domain_verification=None, # type: Optional[bool] + force_dns_registration=None, # type: Optional[bool] + ttl_in_seconds=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Site"] + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - def create_or_update_slot( - self, resource_group_name, name, site_envelope, slot, skip_dns_registration=None, skip_custom_domain_verification=None, force_dns_registration=None, ttl_in_seconds=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. - - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.Site - :param slot: Name of the deployment slot to create or update. By - default, this API attempts to create or modify the production slot. + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. :type slot: str - :param skip_dns_registration: If true web app hostname is not - registered with DNS on creation. This parameter is - only used for app creation. + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.Site + :param skip_dns_registration: If true web app hostname is not registered with DNS on creation. + This parameter is + only used for app creation. :type skip_dns_registration: bool - :param skip_custom_domain_verification: If true, custom (non - *.azurewebsites.net) domains associated with web app are not verified. + :param skip_custom_domain_verification: If true, custom (non *.azurewebsites.net) domains + associated with web app are not verified. :type skip_custom_domain_verification: bool - :param force_dns_registration: If true, web app hostname is force - registered with DNS. + :param force_dns_registration: If true, web app hostname is force registered with DNS. :type force_dns_registration: bool - :param ttl_in_seconds: Time to live in seconds for web app's default - domain name. + :param ttl_in_seconds: Time to live in seconds for web app's default domain name. :type ttl_in_seconds: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Site or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.Site] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.Site]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_envelope=site_envelope, - slot=slot, - skip_dns_registration=skip_dns_registration, - skip_custom_domain_verification=skip_custom_domain_verification, - force_dns_registration=force_dns_registration, - ttl_in_seconds=ttl_in_seconds, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Site', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_envelope=site_envelope, + skip_dns_registration=skip_dns_registration, + skip_custom_domain_verification=skip_custom_domain_verification, + force_dns_registration=force_dns_registration, + ttl_in_seconds=ttl_in_seconds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def delete_slot( - self, resource_group_name, name, slot, delete_metrics=None, delete_empty_server_farm=None, skip_dns_registration=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + delete_metrics=None, # type: Optional[bool] + delete_empty_server_farm=None, # type: Optional[bool] + skip_dns_registration=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a web, mobile, or API app, or one of the deployment slots. Deletes a web, mobile, or API app, or one of the deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app to delete. :type name: str - :param slot: Name of the deployment slot to delete. By default, the - API deletes the production slot. + :param slot: Name of the deployment slot to delete. By default, the API deletes the production + slot. :type slot: str :param delete_metrics: If true, web app metrics are also deleted. :type delete_metrics: bool - :param delete_empty_server_farm: Specify true if the App Service plan - will be empty after app deletion and you want to delete the empty App - Service plan. By default, the empty App Service plan is not deleted. + :param delete_empty_server_farm: Specify true if the App Service plan will be empty after app + deletion and you want to delete the empty App Service plan. By default, the empty App Service + plan is not deleted. :type delete_empty_server_farm: bool :param skip_dns_registration: If true, DNS registration is skipped. :type skip_dns_registration: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_slot.metadata['url'] + url = self.delete_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if delete_metrics is not None: query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') if delete_empty_server_farm is not None: query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') if skip_dns_registration is not None: query_parameters['skipDnsRegistration'] = self._serialize.query("skip_dns_registration", skip_dns_registration, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + if cls: + return cls(pipeline_response, None, {}) - def update_slot( - self, resource_group_name, name, site_envelope, slot, skip_dns_registration=None, skip_custom_domain_verification=None, force_dns_registration=None, ttl_in_seconds=None, custom_headers=None, raw=False, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def update_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.SitePatchResource" + skip_dns_registration=None, # type: Optional[bool] + skip_custom_domain_verification=None, # type: Optional[bool] + force_dns_registration=None, # type: Optional[bool] + ttl_in_seconds=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: - ~azure.mgmt.web.v2016_08_01.models.SitePatchResource - :param slot: Name of the deployment slot to create or update. By - default, this API attempts to create or modify the production slot. + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. :type slot: str - :param skip_dns_registration: If true web app hostname is not - registered with DNS on creation. This parameter is - only used for app creation. + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2016_08_01.models.SitePatchResource + :param skip_dns_registration: If true web app hostname is not registered with DNS on creation. + This parameter is + only used for app creation. :type skip_dns_registration: bool - :param skip_custom_domain_verification: If true, custom (non - *.azurewebsites.net) domains associated with web app are not verified. + :param skip_custom_domain_verification: If true, custom (non *.azurewebsites.net) domains + associated with web app are not verified. :type skip_custom_domain_verification: bool - :param force_dns_registration: If true, web app hostname is force - registered with DNS. + :param force_dns_registration: If true, web app hostname is force registered with DNS. :type force_dns_registration: bool - :param ttl_in_seconds: Time to live in seconds for web app's default - domain name. + :param ttl_in_seconds: Time to live in seconds for web app's default domain name. :type ttl_in_seconds: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_slot.metadata['url'] + url = self.update_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if skip_dns_registration is not None: query_parameters['skipDnsRegistration'] = self._serialize.query("skip_dns_registration", skip_dns_registration, 'bool') if skip_custom_domain_verification is not None: @@ -9863,4684 +9594,4559 @@ def update_slot( query_parameters['forceDnsRegistration'] = self._serialize.query("force_dns_registration", force_dns_registration, 'bool') if ttl_in_seconds is not None: query_parameters['ttlInSeconds'] = self._serialize.query("ttl_in_seconds", ttl_in_seconds, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def analyze_custom_hostname_slot( - self, resource_group_name, name, slot, host_name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomHostnameAnalysisResult" """Analyze a custom hostname. Analyze a custom hostname. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param host_name: Custom hostname. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomHostnameAnalysisResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.CustomHostnameAnalysisResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.analyze_custom_hostname_slot.metadata['url'] + url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if host_name is not None: query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('CustomHostnameAnalysisResult', response) + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} + analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} # type: ignore def apply_slot_configuration_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - """Applies the configuration settings from the target slot onto the - current slot. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + """Applies the configuration settings from the target slot onto the current slot. - Applies the configuration settings from the target slot onto the - current slot. + Applies the configuration settings from the target slot onto the current slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :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 """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.apply_slot_configuration_slot.metadata['url'] + url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} + apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} # type: ignore def backup_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Creates a backup of an app. Creates a backup of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: Backup configuration. You can use the JSON response - from the POST action as input here. - :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a backup for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + backup for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.backup_slot.metadata['url'] + url = self.backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} + backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} # type: ignore def list_backups_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get backups of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2016_08_01.models.BackupItemPaged[~azure.mgmt.web.v2016_08_01.models.BackupItem] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_backups_slot.metadata['url'] + url = self.list_backups_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} + return ItemPaged( + get_next, extract_data + ) + list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} # type: ignore def discover_restore_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): - """Discovers an existing app backup that can be restored from a blob in - Azure storage. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreRequest" + """Discovers an existing app backup that can be restored from a blob in Azure storage. - Discovers an existing app backup that can be restored from a blob in - Azure storage. + Discovers an existing app backup that can be restored from a blob in Azure storage. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: A RestoreRequest object that includes Azure storage - URL and blog name for discovery of backup. - :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will perform discovery for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will perform + discovery for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RestoreRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.discover_restore_slot.metadata['url'] + url = self.discover_restore_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RestoreRequest', response) + deserialized = self._deserialize('RestoreRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - discover_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover'} + discover_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover'} # type: ignore def get_backup_status_slot( - self, resource_group_name, name, backup_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Gets a backup of an app by its ID. Gets a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a backup + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_backup_status_slot.metadata['url'] + url = self.get_backup_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} + get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore def delete_backup_slot( - self, resource_group_name, name, backup_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a backup of an app by its ID. Deletes a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + backup of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_backup_slot.metadata['url'] + url = self.delete_backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} + if cls: + return cls(pipeline_response, None, {}) - def list_backup_status_secrets_slot( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, **operation_config): - """Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore - Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_backup_status_secrets_slot( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param backup_id: ID of backup. :type backup_id: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str :param request: Information on backup request. :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.list_backup_status_secrets_slot.metadata['url'] + url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} - + list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} # type: ignore def _restore_slot_initial( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_slot.metadata['url'] + url = self._restore_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('RestoreResponse', response) + deserialized = self._deserialize('RestoreResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _restore_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore - def restore_slot( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, polling=True, **operation_config): - """Restores a specific backup to another app (or deployment slot, if - specified). + def begin_restore_slot( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.RestoreResponse"] + """Restores a specific backup to another app (or deployment slot, if specified). - Restores a specific backup to another app (or deployment slot, if - specified). + Restores a specific backup to another app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2016_08_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns RestoreResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.RestoreResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.RestoreResponse]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_slot_initial( - resource_group_name=resource_group_name, - name=name, - backup_id=backup_id, - request=request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either RestoreResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.RestoreResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('RestoreResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_slot_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RestoreResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore def list_configurations_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigResourceCollection"] """List the configurations of an app. List the configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigResource - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigResourcePaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configurations_slot.metadata['url'] + url = self.list_configurations_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} + return ItemPaged( + get_next, extract_data + ) + list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} # type: ignore def update_application_settings_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the application settings of an app. Replaces the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the application settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + application settings for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_application_settings_slot.metadata['url'] + url = self.update_application_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} + update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} # type: ignore def list_application_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of an app. Gets the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the application settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + application settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_application_settings_slot.metadata['url'] + url = self.list_application_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} + list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} # type: ignore def update_auth_settings_slot( - self, resource_group_name, name, site_auth_settings, slot, custom_headers=None, raw=False, **operation_config): - """Updates the Authentication / Authorization settings associated with web - app. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_auth_settings, # type: "models.SiteAuthSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" + """Updates the Authentication / Authorization settings associated with web app. - Updates the Authentication / Authorization settings associated with web - app. + Updates the Authentication / Authorization settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param site_auth_settings: Auth settings associated with web app. - :type site_auth_settings: - ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_auth_settings_slot.metadata['url'] + url = self.update_auth_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} + update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} # type: ignore def get_auth_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" """Gets the Authentication/Authorization settings of an app. Gets the Authentication/Authorization settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_auth_settings_slot.metadata['url'] + url = self.get_auth_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} + get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} # type: ignore def update_backup_configuration_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Updates the backup configuration of an app. Updates the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + backup configuration for the production slot. + :type slot: str :param request: Edited backup configuration. :type request: ~azure.mgmt.web.v2016_08_01.models.BackupRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the backup configuration for the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_backup_configuration_slot.metadata['url'] + url = self.update_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} + update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore def delete_backup_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the backup configuration of an app. Deletes the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the backup configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + backup configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_backup_configuration_slot.metadata['url'] + url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} + delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore def get_backup_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Gets the backup configuration of an app. Gets the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the backup configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + backup configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_backup_configuration_slot.metadata['url'] + url = self.get_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} + get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} # type: ignore def update_connection_strings_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_strings, # type: "models.ConnectionStringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Replaces the connection strings of an app. Replaces the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the connection settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + connection settings for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2016_08_01.models.ConnStringValueTypePair] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ - connection_strings = models.ConnectionStringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_connection_strings_slot.metadata['url'] + url = self.update_connection_strings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} + update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} # type: ignore def list_connection_strings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Gets the connection strings of an app. Gets the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the connection settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + connection settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2016_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_connection_strings_slot.metadata['url'] + url = self.list_connection_strings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} + list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} # type: ignore def get_diagnostic_logs_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Gets the logging configuration of an app. Gets the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the logging configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + logging configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_diagnostic_logs_configuration_slot.metadata['url'] + url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} + get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore def update_diagnostic_logs_config_slot( - self, resource_group_name, name, site_logs_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_logs_config, # type: "models.SiteLogsConfig" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Updates the logging configuration of an app. Updates the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_logs_config: A SiteLogsConfig JSON object that contains - the logging configuration to change in the "properties" property. - :type site_logs_config: - ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the logging configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + logging configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_diagnostic_logs_config_slot.metadata['url'] + url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} + update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore def update_metadata_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + metadata, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the metadata of an app. Replaces the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the metadata for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + metadata for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_metadata_slot.metadata['url'] + url = self.update_metadata_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} + update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} # type: ignore def list_metadata_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the metadata of an app. Gets the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the metadata for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + metadata for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_metadata_slot.metadata['url'] + url = self.list_metadata_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} - + list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} # type: ignore def _list_publishing_credentials_slot_initial( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.User" + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_publishing_credentials_slot.metadata['url'] + url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def list_publishing_credentials_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, polling=True, **operation_config): + _list_publishing_credentials_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + def begin_list_publishing_credentials_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.User"] """Gets the Git/FTP publishing credentials of an app. Gets the Git/FTP publishing credentials of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the publishing credentials for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing credentials for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns User or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.User] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.User]] - :raises: :class:`CloudError` - """ - raw_result = self._list_publishing_credentials_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('User', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._list_publishing_credentials_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore def update_site_push_settings_slot( - self, resource_group_name, name, push_settings, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + push_settings, # type: "models.PushSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Updates the Push settings associated with web app. Updates the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str :param push_settings: Push settings associated with web app. :type push_settings: ~azure.mgmt.web.v2016_08_01.models.PushSettings - :param slot: Name of web app slot. If not specified then will default - to production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_site_push_settings_slot.metadata['url'] + url = self.update_site_push_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} + update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} # type: ignore def list_site_push_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Gets the Push settings associated with web app. Gets the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_site_push_settings_slot.metadata['url'] + url = self.list_site_push_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} + list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} # type: ignore def get_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. - Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_configuration_slot.metadata['url'] + url = self.get_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def create_or_update_configuration_slot( - self, resource_group_name, name, site_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_configuration_slot.metadata['url'] + url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def update_configuration_slot( - self, resource_group_name, name, site_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_configuration_slot.metadata['url'] + url = self.update_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def list_configuration_snapshot_info_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigurationSnapshotInfoCollection"] + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. - Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigurationSnapshotInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfoPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configuration_snapshot_info_slot.metadata['url'] + url = self.list_configuration_snapshot_info_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigurationSnapshotInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigurationSnapshotInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} # type: ignore def get_configuration_snapshot_slot( - self, resource_group_name, name, snapshot_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a snapshot of the configuration of an app at a previous point in - time. + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets a snapshot of the configuration of an app at a previous point in time. - Gets a snapshot of the configuration of an app at a previous point in - time. + Gets a snapshot of the configuration of an app at a previous point in time. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_configuration_snapshot_slot.metadata['url'] + url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} + get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} # type: ignore def recover_site_configuration_snapshot_slot( - self, resource_group_name, name, snapshot_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reverts the configuration of an app to a previous snapshot. Reverts the configuration of an app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.recover_site_configuration_snapshot_slot.metadata['url'] + url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} + recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} # type: ignore def get_web_site_container_logs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the last lines of docker logs for the given site. Gets the last lines of docker logs for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_web_site_container_logs_slot.metadata['url'] + url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/octet-stream' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} + get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} # type: ignore def get_web_site_container_logs_zip_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the ZIP archived docker log files for the given site. Gets the ZIP archived docker log files for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_web_site_container_logs_zip_slot.metadata['url'] + url = self.get_web_site_container_logs_zip_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/zip' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} + get_web_site_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} # type: ignore def list_continuous_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ContinuousWebJobCollection"] """List continuous web jobs for an app, or a deployment slot. List continuous web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContinuousWebJob - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobPaged[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_continuous_web_jobs_slot.metadata['url'] + url = self.list_continuous_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContinuousWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContinuousWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} # type: ignore def get_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ContinuousWebJob"] """Gets a continuous web job by its ID for an app, or a deployment slot. Gets a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContinuousWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_continuous_web_job_slot.metadata['url'] + url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ContinuousWebJob', response) + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} + get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore def delete_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a continuous web job by its ID for an app, or a deployment slot. Delete a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_continuous_web_job_slot.metadata['url'] + url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} + delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore def start_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Start a continuous web job for an app, or a deployment slot. Start a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.start_continuous_web_job_slot.metadata['url'] + url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} + start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} # type: ignore def stop_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop a continuous web job for an app, or a deployment slot. Stop a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.stop_continuous_web_job_slot.metadata['url'] + url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} + stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} # type: ignore def list_deployments_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentCollection"] """List deployments for an app, or a deployment slot. List deployments for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Deployment - :rtype: - ~azure.mgmt.web.v2016_08_01.models.DeploymentPaged[~azure.mgmt.web.v2016_08_01.models.Deployment] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_deployments_slot.metadata['url'] + url = self.list_deployments_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} # type: ignore def get_deployment_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Get a deployment by its ID for an app, or a deployment slot. Get a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets a deployment + for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_deployment_slot.metadata['url'] + url = self.get_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def create_deployment_slot( - self, resource_group_name, name, id, slot, deployment, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + deployment, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Create a deployment for an app, or a deployment slot. Create a deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: ID of an existing deployment. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API creates a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API creates a + deployment for the production slot. :type slot: str :param deployment: Deployment details. :type deployment: ~azure.mgmt.web.v2016_08_01.models.Deployment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_deployment_slot.metadata['url'] + url = self.create_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def delete_deployment_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a deployment by its ID for an app, or a deployment slot. Delete a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_deployment_slot.metadata['url'] + url = self.delete_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def list_deployment_log_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): - """List deployment log for specific deployment for an app, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" + """List deployment log for specific deployment for an app, or a deployment slot. - List deployment log for specific deployment for an app, or a deployment - slot. + List deployment log for specific deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param id: The ID of a specific deployment. This is the value of the - name property in the JSON response from "GET - /api/sites/{siteName}/deployments". + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_deployment_log_slot.metadata['url'] + url = self.list_deployment_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} + list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} # type: ignore def list_domain_ownership_identifiers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """Lists ownership identifiers for domain associated with web app. Lists ownership identifiers for domain associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2016_08_01.models.IdentifierPaged[~azure.mgmt.web.v2016_08_01.models.Identifier] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_domain_ownership_identifiers_slot.metadata['url'] + url = self.list_domain_ownership_identifiers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} # type: ignore def get_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" """Get domain ownership identifier for web app. Get domain ownership identifier for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_domain_ownership_identifier_slot.metadata['url'] + url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def create_or_update_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] + url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def delete_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a domain ownership identifier for a web app. Deletes a domain ownership identifier for a web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_domain_ownership_identifier_slot.metadata['url'] + url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def update_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2016_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_domain_ownership_identifier_slot.metadata['url'] + url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def get_ms_deploy_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_ms_deploy_status_slot.metadata['url'] + url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} - + get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore def _create_ms_deploy_operation_slot_initial( - self, resource_group_name, name, slot, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_ms_deploy_operation_slot.metadata['url'] + url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_ms_deploy_operation_slot( - self, resource_group_name, name, slot, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + _create_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + def begin_create_ms_deploy_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_ms_deploy_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore def get_ms_deploy_log_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_ms_deploy_log_slot.metadata['url'] + url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} + get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} # type: ignore def list_instance_functions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.FunctionEnvelopeCollection"] """List the functions for a web site, or a deployment slot. List the functions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of FunctionEnvelope - :rtype: - ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelopePaged[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_functions_slot.metadata['url'] + url = self.list_instance_functions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('FunctionEnvelopeCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.FunctionEnvelopePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} # type: ignore def get_functions_admin_token_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Fetch a short lived token that can be exchanged for a master key. Fetch a short lived token that can be exchanged for a master key. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_functions_admin_token_slot.metadata['url'] + url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} + get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} # type: ignore def get_instance_function_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.FunctionEnvelope"] """Get function information by its ID for web site, or a deployment slot. Get function information by its ID for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionEnvelope or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_function_slot.metadata['url'] + url = self.get_instance_function_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} - + get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def _create_instance_function_slot_initial( - self, resource_group_name, name, function_name, slot, function_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionEnvelope" + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_function_slot.metadata['url'] + url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_instance_function_slot( - self, resource_group_name, name, function_name, slot, function_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_instance_function_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + def begin_create_instance_function_slot( + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.FunctionEnvelope"] """Create function for web site, or a deployment slot. Create function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str :param function_envelope: Function details. - :type function_envelope: - ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type function_envelope: ~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns FunctionEnvelope or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope]] - :raises: :class:`CloudError` - """ - raw_result = self._create_instance_function_slot_initial( - resource_group_name=resource_group_name, - name=name, - function_name=function_name, - slot=slot, - function_envelope=function_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('FunctionEnvelope', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_function_slot_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + slot=slot, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def delete_instance_function_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function for web site, or a deployment slot. Delete a function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_instance_function_slot.metadata['url'] + url = self.delete_instance_function_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} + delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def list_function_secrets_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): - """Get function secrets for a function in a web site, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" + """Get function secrets for a function in a web site, or a deployment slot. - Get function secrets for a function in a web site, or a deployment - slot. + Get function secrets for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_function_secrets_slot.metadata['url'] + url = self.list_function_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} + list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} # type: ignore def list_host_name_bindings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HostNameBindingCollection"] """Get hostname bindings for an app or a deployment slot. Get hostname bindings for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets hostname bindings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HostNameBinding - :rtype: - ~azure.mgmt.web.v2016_08_01.models.HostNameBindingPaged[~azure.mgmt.web.v2016_08_01.models.HostNameBinding] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_host_name_bindings_slot.metadata['url'] + url = self.list_host_name_bindings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HostNameBindingCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HostNameBindingPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} + return ItemPaged( + get_next, extract_data + ) + list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} # type: ignore def get_host_name_binding_slot( - self, resource_group_name, name, slot, host_name, custom_headers=None, raw=False, **operation_config): - """Get the named hostname binding for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" + """Get the named hostname binding for an app (or deployment slot, if specified). - Get the named hostname binding for an app (or deployment slot, if - specified). + Get the named hostname binding for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API the named binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. :type slot: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_host_name_binding_slot.metadata['url'] + url = self.get_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def create_or_update_host_name_binding_slot( - self, resource_group_name, name, host_name, host_name_binding, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + slot, # type: str + host_name_binding, # type: "models.HostNameBinding" + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param host_name_binding: Binding details. This is the JSON - representation of a HostNameBinding object. - :type host_name_binding: - ~azure.mgmt.web.v2016_08_01.models.HostNameBinding - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_host_name_binding_slot.metadata['url'] + url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def delete_host_name_binding_slot( - self, resource_group_name, name, slot, host_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_host_name_binding_slot.metadata['url'] + url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def get_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): - """Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. - Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + Retrieves a specific Service Bus Hybrid Connection used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -14550,70 +14156,68 @@ def get_hybrid_connection_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_hybrid_connection_slot.metadata['url'] + url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def create_or_update_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -14621,79 +14225,77 @@ def create_or_update_hybrid_connection_slot( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.HybridConnection :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_hybrid_connection_slot.metadata['url'] + url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Removes a Hybrid Connection from this site. Removes a Hybrid Connection from this site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -14703,62 +14305,64 @@ def delete_hybrid_connection_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_hybrid_connection_slot.metadata['url'] + url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def update_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -14766,79 +14370,77 @@ def update_hybrid_connection_slot( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.HybridConnection :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_hybrid_connection_slot.metadata['url'] + url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Gets the send key name and value for a Hybrid Connection. Gets the send key name and value for a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -14848,1247 +14450,1213 @@ def list_hybrid_connection_keys_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_hybrid_connection_keys_slot.metadata['url'] + url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_hybrid_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieves all Service Bus Hybrid Connections used by this Web App. Retrieves all Service Bus Hybrid Connections used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_hybrid_connections_slot.metadata['url'] + url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} + list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} # type: ignore def list_relay_service_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets hybrid connections configured for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Gets hybrid connections configured for an app (or deployment slot, if specified). - Gets hybrid connections configured for an app (or deployment slot, if - specified). + Gets hybrid connections configured for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get hybrid connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get hybrid + connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_relay_service_connections_slot.metadata['url'] + url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} + list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} # type: ignore def get_relay_service_connection_slot( - self, resource_group_name, name, entity_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" """Gets a hybrid connection configuration by its name. Gets a hybrid connection configuration by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection. :type entity_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a hybrid connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a hybrid + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_relay_service_connection_slot.metadata['url'] + url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def create_or_update_relay_service_connection_slot( - self, resource_group_name, name, entity_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create or update a hybrid connection for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_relay_service_connection_slot.metadata['url'] + url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def delete_relay_service_connection_slot( - self, resource_group_name, name, entity_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a relay service connection by its name. Deletes a relay service connection by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete a hybrid connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_relay_service_connection_slot.metadata['url'] + url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def update_relay_service_connection_slot( - self, resource_group_name, name, entity_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create or update a hybrid connection for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_relay_service_connection_slot.metadata['url'] + url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def list_instance_identifiers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppInstanceCollection"] """Gets all scale-out instances of an app. Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets the production slot instances. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteInstance - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteInstancePaged[~azure.mgmt.web.v2016_08_01.models.SiteInstance] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_identifiers_slot.metadata['url'] + url = self.list_instance_identifiers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppInstanceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} + return ItemPaged( + get_next, extract_data + ) + list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} # type: ignore def get_instance_ms_deploy_status_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_ms_deploy_status_slot.metadata['url'] + url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} - + get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def _create_instance_ms_deploy_operation_slot_initial( - self, resource_group_name, name, slot, instance_id, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_ms_deploy_operation_slot.metadata['url'] + url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_instance_ms_deploy_operation_slot( - self, resource_group_name, name, slot, instance_id, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + _create_instance_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + def begin_create_instance_ms_deploy_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2016_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_instance_ms_deploy_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - instance_id=instance_id, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def get_instance_ms_deploy_log_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_ms_deploy_log_slot.metadata['url'] + url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} + get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore def list_instance_processes_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_processes_slot.metadata['url'] + url = self.list_instance_processes_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} # type: ignore def get_instance_process_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_slot.metadata['url'] + url = self.get_instance_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} + get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore def delete_instance_process_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_instance_process_slot.metadata['url'] + url = self.delete_instance_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} + delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore def get_instance_process_dump_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_dump_slot.metadata['url'] + url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} + get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore def list_instance_process_modules_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. - - List module information for a process by its ID for a specific - scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_modules_slot.metadata['url'] + url = self.list_instance_process_modules_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore def get_instance_process_module_slot( - self, resource_group_name, name, process_id, base_address, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Get process information by its ID for a specific scaled-out instance in - a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16096,25 +15664,24 @@ def get_instance_process_module_slot( :type process_id: str :param base_address: Module base address. :type base_address: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_module_slot.metadata['url'] + url = self.get_instance_process_module_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), @@ -16122,143 +15689,141 @@ def get_instance_process_module_slot( 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} + get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_instance_process_threads_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_threads_slot.metadata['url'] + url = self.list_instance_process_threads_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore def get_instance_process_thread_slot( - self, resource_group_name, name, process_id, thread_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16266,25 +15831,24 @@ def get_instance_process_thread_slot( :type process_id: str :param thread_id: TID. :type thread_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_instance_process_thread_slot.metadata['url'] + url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), @@ -16292,506 +15856,482 @@ def get_instance_process_thread_slot( 'threadId': self._serialize.url("thread_id", thread_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} + get_instance_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore def is_cloneable_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Shows whether an app can be cloned to another resource group or - subscription. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteCloneability" + """Shows whether an app can be cloned to another resource group or subscription. - Shows whether an app can be cloned to another resource group or - subscription. + Shows whether an app can be cloned to another resource group or subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. By default, this API returns - information on the production slot. + :param slot: Name of the deployment slot. By default, this API returns information on the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteCloneability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteCloneability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.is_cloneable_slot.metadata['url'] + url = self.is_cloneable_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteCloneability', response) + deserialized = self._deserialize('SiteCloneability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} + is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} # type: ignore def list_sync_function_triggers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" """This is to allow calling via powershell and ARM template. This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_sync_function_triggers_slot.metadata['url'] + url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} + list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} # type: ignore def list_metric_definitions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets all metric definitions of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Gets all metric definitions of an app (or deployment slot, if specified). - Gets all metric definitions of an app (or deployment slot, if - specified). + Gets all metric definitions of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get metric definitions of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metric + definitions of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metric_definitions_slot.metadata['url'] + url = self.list_metric_definitions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metric_definitions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_metric_definitions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions'} # type: ignore def list_metrics_slot( - self, resource_group_name, name, slot, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Gets performance metrics of an app (or deployment slot, if specified). Gets performance metrics of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get metrics of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metrics + of the production slot. :type slot: str - :param details: Specify "true" to include metric details in the - response. It is "false" by default. + :param details: Specify "true" to include metric details in the response. It is "false" by + default. :type details: bool - :param filter: Return only metrics specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and - endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics_slot.metadata['url'] + url = self.list_metrics_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metrics_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_metrics_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics'} # type: ignore def get_migrate_my_sql_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MigrateMySqlStatus" + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MigrateMySqlStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlStatus or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_migrate_my_sql_status_slot.metadata['url'] + url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MigrateMySqlStatus', response) + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} + get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} # type: ignore def list_network_features_slot( - self, resource_group_name, name, view, slot, custom_headers=None, raw=False, **operation_config): - """Gets all network features used by the app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + view, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.NetworkFeatures"] + """Gets all network features used by the app (or deployment slot, if specified). - Gets all network features used by the app (or deployment slot, if - specified). + Gets all network features used by the app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param view: The type of view. This can either be "summary" or - "detailed". + :param view: The type of view. This can either be "summary" or "detailed". :type view: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get network features for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get network + features for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NetworkFeatures or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.NetworkFeatures or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_network_features_slot.metadata['url'] + url = self.list_network_features_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'view': self._serialize.url("view", view, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('NetworkFeatures', response) + deserialized = self._deserialize('NetworkFeatures', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} + list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} # type: ignore def start_web_site_network_trace_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str """Start capturing network packets for the site. Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16803,1015 +16343,974 @@ def start_web_site_network_trace_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.start_web_site_network_trace_slot.metadata['url'] + url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} + start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} # type: ignore def stop_web_site_network_trace_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Stop ongoing capturing network packets for the site. Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for this web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.stop_web_site_network_trace_slot.metadata['url'] + url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} + stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} # type: ignore def generate_new_site_publishing_password_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Generates a new publishing password for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Generates a new publishing password for an app (or deployment slot, if specified). - Generates a new publishing password for an app (or deployment slot, if - specified). + Generates a new publishing password for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API generate a new publishing password for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API generate a new + publishing password for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.generate_new_site_publishing_password_slot.metadata['url'] + url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} + if cls: + return cls(pipeline_response, None, {}) + + generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} # type: ignore def list_perf_mon_counters_slot( - self, resource_group_name, name, slot, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PerfMonCounterCollection"] """Gets perfmon counters for web app. Gets perfmon counters for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq + '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PerfMonResponse - :rtype: - ~azure.mgmt.web.v2016_08_01.models.PerfMonResponsePaged[~azure.mgmt.web.v2016_08_01.models.PerfMonResponse] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_perf_mon_counters_slot.metadata['url'] + url = self.list_perf_mon_counters_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PerfMonResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} + return ItemPaged( + get_next, extract_data + ) + list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} # type: ignore def get_site_php_error_log_flag_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SitePhpErrorLogFlag" """Gets web app's event logs. Gets web app's event logs. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SitePhpErrorLogFlag or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SitePhpErrorLogFlag or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_site_php_error_log_flag_slot.metadata['url'] + url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SitePhpErrorLogFlag', response) + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} + get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} # type: ignore def list_premier_add_ons_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets the premier add-ons of an app. Gets the premier add-ons of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the premier add-ons for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + premier add-ons for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_premier_add_ons_slot.metadata['url'] + url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} + list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} # type: ignore def get_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets a named add-on of an app. Gets a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_premier_add_on_slot.metadata['url'] + url = self.get_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def add_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, premier_add_on, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + premier_add_on, # type: "models.PremierAddOn" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.add_premier_add_on_slot.metadata['url'] + url = self.add_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def delete_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a premier add-on from an app. Delete a premier add-on from an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_premier_add_on_slot.metadata['url'] + url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + if cls: + return cls(pipeline_response, None, {}) - def list_processes_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + def list_processes_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_processes_slot.metadata['url'] + url = self.list_processes_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} # type: ignore def get_process_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_slot.metadata['url'] + url = self.get_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} + get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore def delete_process_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_process_slot.metadata['url'] + url = self.delete_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore def get_process_dump_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_dump_slot.metadata['url'] + url = self.get_process_dump_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} + get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} # type: ignore def list_process_modules_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. - List module information for a process by its ID for a specific - scaled-out instance in a web site. + List module information for a process by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_modules_slot.metadata['url'] + url = self.list_process_modules_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} # type: ignore def get_process_module_slot( - self, resource_group_name, name, process_id, base_address, slot, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -17819,159 +17318,156 @@ def get_process_module_slot( :type process_id: str :param base_address: Module base address. :type base_address: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_module_slot.metadata['url'] + url = self.get_process_module_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} + get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_process_threads_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_threads_slot.metadata['url'] + url = self.list_process_threads_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} # type: ignore def get_process_thread_slot( - self, resource_group_name, name, process_id, thread_id, slot, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -17979,2137 +17475,2178 @@ def get_process_thread_slot( :type process_id: str :param thread_id: TID. :type thread_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_process_thread_slot.metadata['url'] + url = self.get_process_thread_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'threadId': self._serialize.url("thread_id", thread_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads/{threadId}'} + get_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads/{threadId}'} # type: ignore def list_public_certificates_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PublicCertificateCollection"] """Get public certificates for an app or a deployment slot. Get public certificates for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets hostname bindings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PublicCertificate - :rtype: - ~azure.mgmt.web.v2016_08_01.models.PublicCertificatePaged[~azure.mgmt.web.v2016_08_01.models.PublicCertificate] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_public_certificates_slot.metadata['url'] + url = self.list_public_certificates_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PublicCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PublicCertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} + return ItemPaged( + get_next, extract_data + ) + list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} # type: ignore def get_public_certificate_slot( - self, resource_group_name, name, slot, public_certificate_name, custom_headers=None, raw=False, **operation_config): - """Get the named public certificate for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" + """Get the named public certificate for an app (or deployment slot, if specified). - Get the named public certificate for an app (or deployment slot, if - specified). + Get the named public certificate for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API the named binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. :type slot: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_public_certificate_slot.metadata['url'] + url = self.get_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def create_or_update_public_certificate_slot( - self, resource_group_name, name, public_certificate_name, public_certificate, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + slot, # type: str + public_certificate, # type: "models.PublicCertificate" + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param public_certificate: Public certificate details. This is the - JSON representation of a PublicCertificate object. - :type public_certificate: - ~azure.mgmt.web.v2016_08_01.models.PublicCertificate - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_public_certificate_slot.metadata['url'] + url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def delete_public_certificate_slot( - self, resource_group_name, name, slot, public_certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_public_certificate_slot.metadata['url'] + url = self.delete_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def list_publishing_profile_xml_with_secrets_slot( - self, resource_group_name, name, slot, format=None, custom_headers=None, raw=False, callback=None, **operation_config): - """Gets the publishing profile for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + publishing_profile_options, # type: "models.CsmPublishingProfileOptions" + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets the publishing profile for an app (or deployment slot, if specified). - Gets the publishing profile for an app (or deployment slot, if - specified). + Gets the publishing profile for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the publishing profile for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing profile for the production slot. :type slot: str - :param format: Name of the format. Valid values are: - FileZilla3 - WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2016_08_01.models.PublishingProfileFormat - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2016_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError """ - publishing_profile_options = models.CsmPublishingProfileOptions(format=format) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] + url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/xml' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} - + list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} # type: ignore def _recover_slot_initial( - self, resource_group_name, name, recovery_entity, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + recovery_entity, # type: "models.SnapshotRecoveryRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.recover_slot.metadata['url'] + url = self._recover_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def recover_slot( - self, resource_group_name, name, recovery_entity, slot, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _recover_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover'} # type: ignore + + def begin_recover_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + recovery_entity, # type: "models.SnapshotRecoveryRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Recovers a web app to a previous snapshot. Recovers a web app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param recovery_entity: Snapshot data used for web app recovery. - Snapshot information can be obtained by calling GetDeletedSites or - GetSiteSnapshots API. - :type recovery_entity: - ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param recovery_entity: Snapshot data used for web app recovery. Snapshot information can be + obtained by calling GetDeletedSites or GetSiteSnapshots API. + :type recovery_entity: ~azure.mgmt.web.v2016_08_01.models.SnapshotRecoveryRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._recover_slot_initial( - resource_group_name=resource_group_name, - name=name, - recovery_entity=recovery_entity, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._recover_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + recovery_entity=recovery_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - recover_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recover_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover'} # type: ignore def reset_slot_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. - Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API resets configuration settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API resets + configuration settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.reset_slot_configuration_slot.metadata['url'] + url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} + reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} # type: ignore def restart_slot( - self, resource_group_name, name, slot, soft_restart=None, synchronous=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + soft_restart=None, # type: Optional[bool] + synchronous=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restarts an app (or deployment slot, if specified). Restarts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restart the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will restart the + production slot. :type slot: str - :param soft_restart: Specify true to apply the configuration settings - and restarts the app only if necessary. By default, the API always - restarts and reprovisions the app. + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. :type soft_restart: bool - :param synchronous: Specify true to block until the app is restarted. - By default, it is set to false, and the API responds immediately - (asynchronous). + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). :type synchronous: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.restart_slot.metadata['url'] + url = self.restart_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') if synchronous is not None: query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} + restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} # type: ignore def list_site_extensions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteExtensionInfoCollection"] """Get list of site extensions for a web site, or a deployment slot. Get list of site extensions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteExtensionInfo - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfoPaged[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_extensions_slot.metadata['url'] + url = self.list_site_extensions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteExtensionInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} + return ItemPaged( + get_next, extract_data + ) + list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} # type: ignore def get_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): - """Get site extension information by its ID for a web site, or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + """Get site extension information by its ID for a web site, or a deployment slot. - Get site extension information by its ID for a web site, or a - deployment slot. + Get site extension information by its ID for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteExtensionInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_site_extension_slot.metadata['url'] + url = self.get_site_extension_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} - + get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def _install_site_extension_slot_initial( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.install_site_extension_slot.metadata['url'] + url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def install_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, polling=True, **operation_config): + _install_site_extension_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + def begin_install_site_extension_slot( + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteExtensionInfo"] """Install site extension on a web site, or a deployment slot. Install site extension on a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteExtensionInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo]] - :raises: :class:`CloudError` - """ - raw_result = self._install_site_extension_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_extension_id=site_extension_id, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteExtensionInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_site_extension_slot_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def delete_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Remove a site extension from a web site, or a deployment slot. Remove a site extension from a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_site_extension_slot.metadata['url'] + url = self.delete_site_extension_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def list_slot_differences_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SlotDifferenceCollection"] """Get the difference in configuration settings between two web app slots. Get the difference in configuration settings between two web app slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SlotDifference - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SlotDifferencePaged[~azure.mgmt.web.v2016_08_01.models.SlotDifference] - :raises: :class:`CloudError` - """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slot_differences_slot.metadata['url'] + url = self.list_slot_differences_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SlotDifferencePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} # type: ignore - def _swap_slot_slot_initial( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + def _swap_slot_initial( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.swap_slot_slot.metadata['url'] + url = self._swap_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def swap_slot_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _swap_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + def begin_swap_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Swaps two deployment slots of an app. Swaps two deployment slots of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._swap_slot_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - target_slot=target_slot, - preserve_vnet=preserve_vnet, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._swap_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - swap_slot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore def list_snapshots_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user. Returns all Snapshots to the user. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str :param slot: Website Slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SnapshotPaged[~azure.mgmt.web.v2016_08_01.models.Snapshot] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_slot.metadata['url'] + url = self.list_snapshots_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} # type: ignore def get_source_control_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Gets the source control configuration of an app. Gets the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the source control configuration for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_source_control_slot.metadata['url'] + url = self.get_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} - + get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def _create_or_update_source_control_slot_initial( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_source_control_slot.metadata['url'] + url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_source_control_slot( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_source_control_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + def begin_create_or_update_source_control_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteSourceControl"] """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteSourceControl or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_source_control_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_source_control=site_source_control, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteSourceControl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_source_control_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def delete_source_control_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the source control configuration of an app. Deletes the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_source_control_slot.metadata['url'] + url = self.delete_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def update_source_control_slot( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control_slot.metadata['url'] + url = self.update_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def start_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Starts an app (or deployment slot, if specified). Starts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will start the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will start the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.start_slot.metadata['url'] + url = self.start_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} + start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} # type: ignore def stop_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stops an app (or deployment slot, if specified). Stops an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will stop the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will stop the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.stop_slot.metadata['url'] + url = self.stop_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} + stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} # type: ignore def sync_repository_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync web app repository. Sync web app repository. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.sync_repository_slot.metadata['url'] + url = self.sync_repository_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} + sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} # type: ignore def sync_function_triggers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the scale controller. Syncs function trigger metadata to the scale controller. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.sync_function_triggers_slot.metadata['url'] + url = self.sync_function_triggers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} + sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} # type: ignore def list_triggered_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredWebJobCollection"] """List triggered web jobs for an app, or a deployment slot. List triggered web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredWebJob - :rtype: - ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_jobs_slot.metadata['url'] + url = self.list_triggered_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} # type: ignore def get_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredWebJob"] """Gets a triggered web job by its ID for an app, or a deployment slot. Gets a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_triggered_web_job_slot.metadata['url'] + url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredWebJob', response) + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} + get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore def delete_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a triggered web job by its ID for an app, or a deployment slot. Delete a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_triggered_web_job_slot.metadata['url'] + url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore def list_triggered_web_job_history_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredJobHistoryCollection"] """List a triggered web job's history for an app, or a deployment slot. List a triggered web job's history for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredJobHistory - :rtype: - ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistoryPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_job_history_slot.metadata['url'] + url = self.list_triggered_web_job_history_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredJobHistoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredJobHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} # type: ignore def get_triggered_web_job_history_slot( - self, resource_group_name, name, web_job_name, id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredJobHistory"] + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. - Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + Gets a triggered web job's history by its ID for an app, , or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -20117,2056 +19654,2028 @@ def get_triggered_web_job_history_slot( :type web_job_name: str :param id: History ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredJobHistory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_triggered_web_job_history_slot.metadata['url'] + url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredJobHistory', response) + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} + get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore def run_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Run a triggered web job for an app, or a deployment slot. Run a triggered web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.run_triggered_web_job_slot.metadata['url'] + url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} + if cls: + return cls(pipeline_response, None, {}) + + run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} # type: ignore def list_usages_slot( - self, resource_group_name, name, slot, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the quota usage information of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] + """Gets the quota usage information of an app (or deployment slot, if specified). - Gets the quota usage information of an app (or deployment slot, if - specified). + Gets the quota usage information of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get quota information of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get quota + information of the production slot. :type slot: str - :param filter: Return only information specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and - endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2016_08_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuota] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages_slot.metadata['url'] + url = self.list_usages_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} # type: ignore def list_vnet_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Gets the virtual networks the app (or deployment slot) is connected to. Gets the virtual networks the app (or deployment slot) is connected to. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get virtual network connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get virtual + network connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_08_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_vnet_connections_slot.metadata['url'] + url = self.list_vnet_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} + list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} # type: ignore def get_vnet_connection_slot( - self, resource_group_name, name, vnet_name, slot, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network the app (or deployment slot) is connected to by - name. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Gets a virtual network the app (or deployment slot) is connected to by name. - Gets a virtual network the app (or deployment slot) is connected to by - name. + Gets a virtual network the app (or deployment slot) is connected to by name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the named virtual network for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named virtual network for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_vnet_connection_slot.metadata['url'] + url = self.get_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def create_or_update_vnet_connection_slot( - self, resource_group_name, name, vnet_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). - - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_slot.metadata['url'] + url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def delete_vnet_connection_slot( - self, resource_group_name, name, vnet_name, slot, custom_headers=None, raw=False, **operation_config): - """Deletes a connection from an app (or deployment slot to a named virtual - network. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a connection from an app (or deployment slot to a named virtual network. - Deletes a connection from an app (or deployment slot to a named virtual - network. + Deletes a connection from an app (or deployment slot to a named virtual network. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_vnet_connection_slot.metadata['url'] + url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + if cls: + return cls(pipeline_response, None, {}) - def update_vnet_connection_slot( - self, resource_group_name, name, vnet_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + def update_vnet_connection_slot( + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_slot.metadata['url'] + url = self.update_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetGateway"] """Gets an app's Virtual Network gateway. Gets an app's Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a gateway for the production slot's Virtual Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_vnet_connection_gateway_slot.metadata['url'] + url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def create_or_update_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.VnetGateway - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update a gateway for the production slot's Virtual - Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] + url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.VnetGateway - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update a gateway for the production slot's Virtual - Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_gateway_slot.metadata['url'] + url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebJobCollection"] """List webjobs for an app, or a deployment slot. List webjobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WebJob - :rtype: - ~azure.mgmt.web.v2016_08_01.models.WebJobPaged[~azure.mgmt.web.v2016_08_01.models.WebJob] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_jobs_slot.metadata['url'] + url = self.list_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} + return ItemPaged( + get_next, extract_data + ) + list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} # type: ignore def get_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebJob" """Get webjob information for an app, or a deployment slot. Get webjob information for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of the web job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.WebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_web_job_slot.metadata['url'] + url = self.get_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WebJob', response) + deserialized = self._deserialize('WebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} + get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} # type: ignore def list_slot_differences_from_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SlotDifferenceCollection"] """Get the difference in configuration settings between two web app slots. Get the difference in configuration settings between two web app slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SlotDifference - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SlotDifferencePaged[~azure.mgmt.web.v2016_08_01.models.SlotDifference] - :raises: :class:`CloudError` - """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slot_differences_from_production.metadata['url'] + url = self.list_slot_differences_from_production.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SlotDifferencePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} # type: ignore def _swap_slot_with_production_initial( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.swap_slot_with_production.metadata['url'] + url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def swap_slot_with_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _swap_slot_with_production_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + def begin_swap_slot_with_production( + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Swaps two deployment slots of an app. Swaps two deployment slots of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2016_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._swap_slot_with_production_initial( - resource_group_name=resource_group_name, - name=name, - target_slot=target_slot, - preserve_vnet=preserve_vnet, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._swap_slot_with_production_initial( + resource_group_name=resource_group_name, + name=name, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore def list_snapshots( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user. Returns all Snapshots to the user. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2016_08_01.models.SnapshotPaged[~azure.mgmt.web.v2016_08_01.models.Snapshot] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots.metadata['url'] + url = self.list_snapshots.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} # type: ignore def get_source_control( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Gets the source control configuration of an app. Gets the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_source_control.metadata['url'] + url = self.get_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} - + get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def _create_or_update_source_control_initial( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_source_control.metadata['url'] + url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_source_control( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_source_control_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + def begin_create_or_update_source_control( + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteSourceControl"] """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteSourceControl or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_source_control_initial( - resource_group_name=resource_group_name, - name=name, - site_source_control=site_source_control, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteSourceControl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_source_control_initial( + resource_group_name=resource_group_name, + name=name, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def delete_source_control( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the source control configuration of an app. Deletes the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_source_control.metadata['url'] + url = self.delete_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + if cls: + return cls(pipeline_response, None, {}) + + delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def update_source_control( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control.metadata['url'] + url = self.update_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def start( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Starts an app (or deployment slot, if specified). Starts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.start.metadata['url'] + url = self.start.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} # type: ignore def stop( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stops an app (or deployment slot, if specified). Stops an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.stop.metadata['url'] + url = self.stop.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} # type: ignore def sync_repository( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync web app repository. Sync web app repository. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.sync_repository.metadata['url'] + url = self.sync_repository.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} + if cls: + return cls(pipeline_response, None, {}) + + sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} # type: ignore def sync_function_triggers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the scale controller. Syncs function trigger metadata to the scale controller. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.sync_function_triggers.metadata['url'] + url = self.sync_function_triggers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} + if cls: + return cls(pipeline_response, None, {}) + + sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} # type: ignore def list_triggered_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredWebJobCollection"] """List triggered web jobs for an app, or a deployment slot. List triggered web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredWebJob - :rtype: - ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_jobs.metadata['url'] + url = self.list_triggered_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} # type: ignore def get_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredWebJob"] """Gets a triggered web job by its ID for an app, or a deployment slot. Gets a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_triggered_web_job.metadata['url'] + url = self.get_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredWebJob', response) + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} + get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore def delete_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a triggered web job by its ID for an app, or a deployment slot. Delete a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_triggered_web_job.metadata['url'] + url = self.delete_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} + delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore def list_triggered_web_job_history( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredJobHistoryCollection"] """List a triggered web job's history for an app, or a deployment slot. List a triggered web job's history for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredJobHistory - :rtype: - ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistoryPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_job_history.metadata['url'] + url = self.list_triggered_web_job_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredJobHistoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredJobHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} # type: ignore def get_triggered_web_job_history( - self, resource_group_name, name, web_job_name, id, custom_headers=None, raw=False, **operation_config): - """Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredJobHistory"] + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. - Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + Gets a triggered web job's history by its ID for an app, , or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -22174,922 +21683,865 @@ def get_triggered_web_job_history( :type web_job_name: str :param id: History ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredJobHistory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_triggered_web_job_history.metadata['url'] + url = self.get_triggered_web_job_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredJobHistory', response) + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} + get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore def run_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Run a triggered web job for an app, or a deployment slot. Run a triggered web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.run_triggered_web_job.metadata['url'] + url = self.run_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} + run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the quota usage information of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] + """Gets the quota usage information of an app (or deployment slot, if specified). - Gets the quota usage information of an app (or deployment slot, if - specified). + Gets the quota usage information of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param filter: Return only information specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and - endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2016_08_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuota] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} # type: ignore def list_vnet_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Gets the virtual networks the app (or deployment slot) is connected to. Gets the virtual networks the app (or deployment slot) is connected to. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_08_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.list_vnet_connections.metadata['url'] + url = self.list_vnet_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} + list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} # type: ignore def get_vnet_connection( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network the app (or deployment slot) is connected to by - name. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Gets a virtual network the app (or deployment slot) is connected to by name. - Gets a virtual network the app (or deployment slot) is connected to by - name. + Gets a virtual network the app (or deployment slot) is connected to by name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_vnet_connection.metadata['url'] + url = self.get_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def create_or_update_vnet_connection( - self, resource_group_name, name, vnet_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). - - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. + :param connection_envelope: Properties of the Virtual Network connection. See example. :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection.metadata['url'] + url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def delete_vnet_connection( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes a connection from an app (or deployment slot to a named virtual - network. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a connection from an app (or deployment slot to a named virtual network. - Deletes a connection from an app (or deployment slot to a named virtual - network. + Deletes a connection from an app (or deployment slot to a named virtual network. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.delete_vnet_connection.metadata['url'] + url = self.delete_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + if cls: + return cls(pipeline_response, None, {}) - def update_vnet_connection( - self, resource_group_name, name, vnet_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + def update_vnet_connection( + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. + :param connection_envelope: Properties of the Virtual Network connection. See example. :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection.metadata['url'] + url = self.update_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetGateway"] """Gets an app's Virtual Network gateway. Gets an app's Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_vnet_connection_gateway.metadata['url'] + url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def create_or_update_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_gateway.metadata['url'] + url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2016_08_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_gateway.metadata['url'] + url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebJobCollection"] """List webjobs for an app, or a deployment slot. List webjobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WebJob - :rtype: - ~azure.mgmt.web.v2016_08_01.models.WebJobPaged[~azure.mgmt.web.v2016_08_01.models.WebJob] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_jobs.metadata['url'] + url = self.list_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} + return ItemPaged( + get_next, extract_data + ) + list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} # type: ignore def get_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebJob" """Get webjob information for an app, or a deployment slot. Get webjob information for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of the web job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_08_01.models.WebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-08-01" + # Construct URL - url = self.get_web_job.metadata['url'] + url = self.get_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WebJob', response) + deserialized = self._deserialize('WebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} + get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py index b96e0933169e..68e22e307460 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2016-09-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json new file mode 100644 index 000000000000..f26eccb00ee8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json @@ -0,0 +1,59 @@ +{ + "chosen_version": "2016-09-01", + "total_api_version_list": ["2016-09-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "app_service_environments": "AppServiceEnvironmentsOperations", + "app_service_plans": "AppServicePlansOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py index e602176dcbf3..51314bb605e4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py @@ -1,16 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration from .operations import AppServiceEnvironmentsOperations @@ -18,38 +23,52 @@ from . import models -class WebSiteManagementClient(SDKClient): - """WebSite Management Client +class WebSiteManagementClient(object): + """WebSite Management Client. - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration - - :ivar app_service_environments: AppServiceEnvironments operations + :ivar app_service_environments: AppServiceEnvironmentsOperations operations :vartype app_service_environments: azure.mgmt.web.v2016_09_01.operations.AppServiceEnvironmentsOperations - :ivar app_service_plans: AppServicePlans operations + :ivar app_service_plans: AppServicePlansOperations operations :vartype app_service_plans: azure.mgmt.web.v2016_09_01.operations.AppServicePlansOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2016-09-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.app_service_environments = AppServiceEnvironmentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.app_service_plans = AppServicePlansOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py new file mode 100644 index 000000000000..0331c9bd226b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2016-09-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..4df8ab56a42d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import AppServiceEnvironmentsOperations +from .operations_async import AppServicePlansOperations +from .. import models + + +class WebSiteManagementClient(object): + """WebSite Management Client. + + :ivar app_service_environments: AppServiceEnvironmentsOperations operations + :vartype app_service_environments: azure.mgmt.web.v2016_09_01.aio.operations_async.AppServiceEnvironmentsOperations + :ivar app_service_plans: AppServicePlansOperations operations + :vartype app_service_plans: azure.mgmt.web.v2016_09_01.aio.operations_async.AppServicePlansOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.app_service_environments = AppServiceEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.app_service_plans = AppServicePlansOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..2189b42e4cdb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__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_service_environments_operations_async import AppServiceEnvironmentsOperations +from ._app_service_plans_operations_async import AppServicePlansOperations + +__all__ = [ + 'AppServiceEnvironmentsOperations', + 'AppServicePlansOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py new file mode 100644 index 000000000000..0464e4c3494b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py @@ -0,0 +1,3237 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServiceEnvironmentsOperations: + """AppServiceEnvironmentsOperations 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.web.v2016_09_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AppServiceEnvironmentCollection"]: + """Get all App Service Environments for a subscription. + + Get all App Service Environments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('AppServiceEnvironmentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/hostingEnvironments'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceEnvironmentCollection"]: + """Get all App Service Environments in a resource group. + + Get all App Service Environments in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServiceEnvironmentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AppServiceEnvironmentResource": + """Get the properties of an App Service Environment. + + Get the properties of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentResource", + **kwargs + ) -> Optional["models.AppServiceEnvironmentResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') + 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, 400, 404, 409]: + 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('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentResource", + **kwargs + ) -> AsyncLROPoller["models.AppServiceEnvironmentResource"]: + """Create or update an App Service Environment. + + Create or update an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceEnvironmentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + lro_delay = kwargs.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, + name=name, + hosting_environment_envelope=hosting_environment_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/hostingEnvironments/{name}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + name: str, + force_delete: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if force_delete is not None: + query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 400, 404, 409]: + 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.Web/hostingEnvironments/{name}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + name: str, + force_delete: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete an App Service Environment. + + Delete an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param force_delete: Specify :code:`true` to force the deletion even if the App + Service Environment contains resources. The default is :code:`false`. + :type force_delete: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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, + name=name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentPatchResource", + **kwargs + ) -> Optional["models.AppServiceEnvironmentResource"]: + """Create or update an App Service Environment. + + Create or update an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') + 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, 400, 404, 409]: + 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('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def list_capacities( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.StampCapacityCollection"]: + """Get the used, available, and total worker capacity an App Service Environment. + + Get the used, available, and total worker capacity an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StampCapacityCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.StampCapacityCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_capacities.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('StampCapacityCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} # type: ignore + + async def list_vips( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AddressResponse": + """Get IP addresses assigned to an App Service Environment. + + Get IP addresses assigned to an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AddressResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_vips.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AddressResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} # type: ignore + + async def list_diagnostics( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.HostingEnvironmentDiagnostics"]: + """Get diagnostic information for an App Service Environment. + + Get diagnostic information for an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_diagnostics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} # type: ignore + + async def get_diagnostics_item( + self, + resource_group_name: str, + name: str, + diagnostics_name: str, + **kwargs + ) -> "models.HostingEnvironmentDiagnostics": + """Get a diagnostics item for an App Service Environment. + + Get a diagnostics item for an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param diagnostics_name: Name of the diagnostics item. + :type diagnostics_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_diagnostics_item.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} # type: ignore + + async def list_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MetricDefinition": + """Get global metric definitions of an App Service Environment. + + Get global metric definitions of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetricDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.MetricDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MetricDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'} # type: ignore + + def list_metrics( + self, + resource_group_name: str, + name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get global metrics of an App Service Environment. + + Get global metrics of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'} # type: ignore + + def list_multi_role_pools( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WorkerPoolCollection"]: + """Get all multi-role pools. + + Get all multi-role pools. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pools.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WorkerPoolCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} # type: ignore + + async def get_multi_role_pool( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WorkerPoolResource": + """Get properties of a multi-role pool. + + Get properties of a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_multi_role_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def _create_or_update_multi_role_pool_initial( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def begin_create_or_update_multi_role_pool( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> AsyncLROPoller["models.WorkerPoolResource"]: + """Create or update a multi-role pool. + + Create or update a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param multi_role_pool_envelope: Properties of the multi-role pool. + :type multi_role_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.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_multi_role_pool_initial( + resource_group_name=resource_group_name, + name=name, + multi_role_pool_envelope=multi_role_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def update_multi_role_pool( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + """Create or update a multi-role pool. + + Create or update a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param multi_role_pool_envelope: Properties of the multi-role pool. + :type multi_role_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_multi_role_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + def list_multi_role_pool_instance_metric_definitions( + self, + resource_group_name: str, + name: str, + instance: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + + Get metric definitions for a specific instance of a multi-role pool of an App Service + Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param instance: Name of the instance in the multi-role pool. + :type instance: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} # type: ignore + + def list_multi_role_pool_instance_metrics( + self, + resource_group_name: str, + name: str, + instance: str, + details: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param instance: Name of the instance in the multi-role pool. + :type instance: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_instance_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'} # type: ignore + + def list_multi_role_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a multi-role pool of an App Service Environment. + + Get metric definitions for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} # type: ignore + + def list_multi_role_metrics( + self, + resource_group_name: str, + name: str, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + time_grain: Optional[str] = None, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a multi-role pool of an App Service Environment. + + Get metrics for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param start_time: Beginning time of the metrics query. + :type start_time: str + :param end_time: End time of the metrics query. + :type end_time: str + :param time_grain: Time granularity of the metrics query. + :type time_grain: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'str') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'} # type: ignore + + def list_multi_role_pool_skus( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SkuInfoCollection"]: + """Get available SKUs for scaling a multi-role pool. + + Get available SKUs for scaling a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SkuInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} # type: ignore + + def list_multi_role_usages( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.UsageCollection"]: + """Get usage metrics for a multi-role pool of an App Service Environment. + + Get usage metrics for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('UsageCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} # type: ignore + + async def list_operations( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.Operation"]: + """List all currently running operations on the App Service Environment. + + List all currently running operations on the App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Operation, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.Operation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_operations.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[Operation]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} # type: ignore + + async def reboot( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Reboot all machines in an App Service Environment. + + Reboot all machines in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.reboot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 400, 404, 409]: + 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, {}) + + reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} # type: ignore + + async def _resume_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self._resume_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + 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('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + async def begin_resume( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Resume an App Service Environment. + + Resume an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.resume.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._resume_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + def list_app_service_plans( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans in an App Service Environment. + + Get all App Service plans in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_app_service_plans.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} # type: ignore + + def list_web_apps( + self, + resource_group_name: str, + name: str, + properties_to_include: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps in an App Service Environment. + + Get all apps in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param properties_to_include: Comma separated list of app properties to include. + :type properties_to_include: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if properties_to_include is not None: + query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} # type: ignore + + async def _suspend_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self._suspend_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + 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('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + async def begin_suspend( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Suspend an App Service Environment. + + Suspend an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.suspend.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._suspend_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Get global usage metrics of an App Service Environment. + + Get global usage metrics of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} # type: ignore + + def list_worker_pools( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WorkerPoolCollection"]: + """Get all worker pools of an App Service Environment. + + Get all worker pools of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pools.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WorkerPoolCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} # type: ignore + + async def get_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> "models.WorkerPoolResource": + """Get properties of a worker pool. + + Get properties of a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_worker_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def _create_or_update_worker_pool_initial( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def begin_create_or_update_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> AsyncLROPoller["models.WorkerPoolResource"]: + """Create or update a worker pool. + + Create or update a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param worker_pool_envelope: Properties of the worker pool. + :type worker_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.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_worker_pool_initial( + resource_group_name=resource_group_name, + name=name, + worker_pool_name=worker_pool_name, + worker_pool_envelope=worker_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def update_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + """Create or update a worker pool. + + Create or update a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param worker_pool_envelope: Properties of the worker pool. + :type worker_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_worker_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + def list_worker_pool_instance_metric_definitions( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + instance: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param instance: Name of the instance in the worker pool. + :type instance: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_instance_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} # type: ignore + + def list_worker_pool_instance_metrics( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + instance: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a specific instance of a worker pool of an App Service Environment. + + Get metrics for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param instance: Name of the instance in the worker pool. + :type instance: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_instance_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'} # type: ignore + + def list_web_worker_metric_definitions( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a worker pool of an App Service Environment. + + Get metric definitions for a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} # type: ignore + + def list_web_worker_metrics( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of worker pool. + :type worker_pool_name: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'} # type: ignore + + def list_worker_pool_skus( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.SkuInfoCollection"]: + """Get available SKUs for scaling a worker pool. + + Get available SKUs for scaling a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('SkuInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} # type: ignore + + def list_web_worker_usages( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.UsageCollection"]: + """Get usage metrics for a worker pool of an App Service Environment. + + Get usage metrics for a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('UsageCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py new file mode 100644 index 000000000000..faefaec6eb9a --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py @@ -0,0 +1,2055 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServicePlansOperations: + """AppServicePlansOperations 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.web.v2016_09_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 + + def list( + self, + detailed: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans for a subscription. + + Get all App Service plans for a subscription. + + :param detailed: Specify :code:`true` to return all App Service plan properties. + The default is :code:`false`, which returns a subset of the properties. + Retrieval of all properties may increase the API latency. + :type detailed: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if detailed is not None: + query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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.Web/serverfarms'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans in a resource group. + + Get all App Service plans in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.AppServicePlan"]: + """Get an App Service plan. + + Get an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlan", + **kwargs + ) -> "models.AppServicePlan": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_plan, 'AppServicePlan') + 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]: + 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('AppServicePlan', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlan", + **kwargs + ) -> AsyncLROPoller["models.AppServicePlan"]: + """Creates or updates an App Service Plan. + + Creates or updates an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param app_service_plan: Details of the App Service plan. + :type app_service_plan: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServicePlan or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + lro_delay = kwargs.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, + name=name, + app_service_plan=app_service_plan, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/serverfarms/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete an App Service plan. + + Delete an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlanPatchResource", + **kwargs + ) -> "models.AppServicePlan": + """Creates or updates an App Service Plan. + + Creates or updates an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param app_service_plan: Details of the App Service plan. + :type app_service_plan: ~azure.mgmt.web.v2016_09_01.models.AppServicePlanPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') + 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]: + 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('AppServicePlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def list_capabilities( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.Capability"]: + """List all capabilities of an App Service plan. + + List all capabilities of an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Capability, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.Capability] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_capabilities.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[Capability]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} # type: ignore + + async def get_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieve a Hybrid Connection in use in an App Service plan. + + Retrieve a Hybrid Connection in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: Name of the Service Bus relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> None: + """Delete a Hybrid Connection in use in an App Service plan. + + Delete a Hybrid Connection in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: Name of the Service Bus relay. + :type relay_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.delete_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Get the send key name and value of a Hybrid Connection. + + Get the send key name and value of a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: The name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: The name of the Service Bus relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + def list_web_apps_by_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceCollection"]: + """Get all apps that use a Hybrid Connection in an App Service Plan. + + Get all apps that use a Hybrid Connection in an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Hybrid Connection namespace. + :type namespace_name: str + :param relay_name: Name of the Hybrid Connection relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps_by_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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: + 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('ResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} # type: ignore + + async def get_hybrid_connection_plan_limit( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HybridConnectionLimits": + """Get the maximum number of Hybrid Connections allowed in an App Service plan. + + Get the maximum number of Hybrid Connections allowed in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionLimits, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnectionLimits + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionLimits', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} # type: ignore + + def list_hybrid_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.HybridConnectionCollection"]: + """Retrieve all Hybrid Connections in use in an App Service plan. + + Retrieve all Hybrid Connections in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridConnectionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.HybridConnectionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_hybrid_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('HybridConnectionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} # type: ignore + + def list_metric_defintions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metrics that can be queried for an App Service plan, and their definitions. + + Get metrics that can be queried for an App Service plan, and their definitions. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metric_defintions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'} # type: ignore + + def list_metrics( + self, + resource_group_name: str, + name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for an App Service plan. + + Get metrics for an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'} # type: ignore + + async def restart_web_apps( + self, + resource_group_name: str, + name: str, + soft_restart: Optional[bool] = None, + **kwargs + ) -> None: + """Restart all apps in an App Service plan. + + Restart all apps in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param soft_restart: Specify :code:`true` to perform a soft restart, applies the + configuration settings and restarts the apps if necessary. The default is + :code:`false`, which always restarts and reprovisions the apps. + :type soft_restart: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.restart_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} # type: ignore + + def list_web_apps( + self, + resource_group_name: str, + name: str, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps associated with an App Service plan. + + Get all apps associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param skip_token: Skip to a web app in the list of webapps associated with app service plan. + If specified, the resulting list will contain web apps starting from (including) the skipToken. + Otherwise, the resulting list contains web apps from the start of the list. + :type skip_token: str + :param filter: Supported filter: $filter=state eq running. Returns only web apps that are + currently running. + :type filter: str + :param top: List page size. If specified, results are paged. + :type top: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} # type: ignore + + async def get_server_farm_skus( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> object: + """Gets all selectable SKUs for a given App Service Plan. + + Gets all selectable SKUs for a given App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of App Service Plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_server_farm_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets server farm usage information. + + Gets server farm usage information. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of App Service Plan. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} # type: ignore + + async def list_vnets( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Get all Virtual Networks associated with an App Service plan. + + Get all Virtual Networks associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_vnets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_from_server_farm( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> Optional["models.VnetInfo"]: + """Get a Virtual Network associated with an App Service plan. + + Get a Virtual Network associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + **kwargs + ) -> "models.VnetGateway": + """Get a Virtual Network gateway. + + Get a Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_vnet_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Update a Virtual Network gateway. + + Update a Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. + :type gateway_name: str + :param connection_envelope: Definition of the gateway. + :type connection_envelope: ~azure.mgmt.web.v2016_09_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def list_routes_for_vnet( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> List["models.VnetRoute"]: + """Get all routes that are associated with a Virtual Network in an App Service plan. + + Get all routes that are associated with a Virtual Network in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.list_routes_for_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetRoute]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} # type: ignore + + async def get_route_for_vnet( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + **kwargs + ) -> Optional[List["models.VnetRoute"]]: + """Get a Virtual Network route in an App Service plan. + + Get a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.get_route_for_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('[VnetRoute]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def create_or_update_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + route: "models.VnetRoute", + **kwargs + ) -> Optional["models.VnetRoute"]: + """Create or update a Virtual Network route in an App Service plan. + + Create or update a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :param route: Definition of the Virtual Network route. + :type route: ~azure.mgmt.web.v2016_09_01.models.VnetRoute + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(route, 'VnetRoute') + 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, 400, 404]: + 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('VnetRoute', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def delete_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + **kwargs + ) -> None: + """Delete a Virtual Network route in an App Service plan. + + Delete a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.delete_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def update_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + route: "models.VnetRoute", + **kwargs + ) -> Optional["models.VnetRoute"]: + """Create or update a Virtual Network route in an App Service plan. + + Create or update a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :param route: Definition of the Virtual Network route. + :type route: ~azure.mgmt.web.v2016_09_01.models.VnetRoute + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(route, 'VnetRoute') + 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, 400, 404]: + 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('VnetRoute', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def reboot_worker( + self, + resource_group_name: str, + name: str, + worker_name: str, + **kwargs + ) -> None: + """Reboot a worker machine in an App Service plan. + + Reboot a worker machine in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param worker_name: Name of worker machine, which typically starts with RD. + :type worker_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + # Construct URL + url = self.reboot_worker.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerName': self._serialize.url("worker_name", worker_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/__init__.py index b5cf3731c734..c83286962e2d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/__init__.py @@ -1,20 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import AddressResponse from ._models_py3 import ApiDefinitionInfo + from ._models_py3 import AppServiceEnvironmentCollection from ._models_py3 import AppServiceEnvironmentPatchResource from ._models_py3 import AppServiceEnvironmentResource from ._models_py3 import AppServicePlan + from ._models_py3 import AppServicePlanCollection from ._models_py3 import AppServicePlanPatchResource from ._models_py3 import AutoHealActions from ._models_py3 import AutoHealCustomAction @@ -25,16 +24,17 @@ from ._models_py3 import ConnStringInfo from ._models_py3 import CorsSettings from ._models_py3 import CsmUsageQuota + from ._models_py3 import CsmUsageQuotaCollection from ._models_py3 import ErrorEntity from ._models_py3 import Experiments from ._models_py3 import HandlerMapping + from ._models_py3 import HostNameSslState from ._models_py3 import HostingEnvironmentDiagnostics from ._models_py3 import HostingEnvironmentProfile - from ._models_py3 import HostNameSslState from ._models_py3 import HybridConnection + from ._models_py3 import HybridConnectionCollection from ._models_py3 import HybridConnectionKey from ._models_py3 import HybridConnectionLimits - from ._models_py3 import Identifier from ._models_py3 import IpSecurityRestriction from ._models_py3 import LocalizableString from ._models_py3 import ManagedServiceIdentity @@ -48,9 +48,12 @@ from ._models_py3 import RampUpRule from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource + from ._models_py3 import ResourceCollection from ._models_py3 import ResourceMetric from ._models_py3 import ResourceMetricAvailability + from ._models_py3 import ResourceMetricCollection from ._models_py3 import ResourceMetricDefinition + from ._models_py3 import ResourceMetricDefinitionCollection from ._models_py3 import ResourceMetricName from ._models_py3 import ResourceMetricProperty from ._models_py3 import ResourceMetricValue @@ -61,14 +64,16 @@ from ._models_py3 import SkuCapacity from ._models_py3 import SkuDescription from ._models_py3 import SkuInfo + from ._models_py3 import SkuInfoCollection from ._models_py3 import SlotSwapStatus from ._models_py3 import SlowRequestsBasedTrigger from ._models_py3 import SnapshotRecoveryRequest from ._models_py3 import SnapshotRecoveryTarget from ._models_py3 import StampCapacity + from ._models_py3 import StampCapacityCollection from ._models_py3 import StatusCodesBasedTrigger from ._models_py3 import Usage - from ._models_py3 import User + from ._models_py3 import UsageCollection from ._models_py3 import VirtualApplication from ._models_py3 import VirtualDirectory from ._models_py3 import VirtualIPMapping @@ -78,118 +83,119 @@ from ._models_py3 import VnetRoute from ._models_py3 import WebAppCollection from ._models_py3 import WorkerPool + from ._models_py3 import WorkerPoolCollection from ._models_py3 import WorkerPoolResource except (SyntaxError, ImportError): - from ._models import AddressResponse - from ._models import ApiDefinitionInfo - from ._models import AppServiceEnvironmentPatchResource - from ._models import AppServiceEnvironmentResource - from ._models import AppServicePlan - from ._models import AppServicePlanPatchResource - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import Capability - from ._models import CloningInfo - from ._models import ConnStringInfo - from ._models import CorsSettings - from ._models import CsmUsageQuota - from ._models import ErrorEntity - from ._models import Experiments - from ._models import HandlerMapping - from ._models import HostingEnvironmentDiagnostics - from ._models import HostingEnvironmentProfile - from ._models import HostNameSslState - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import HybridConnectionLimits - from ._models import Identifier - from ._models import IpSecurityRestriction - from ._models import LocalizableString - from ._models import ManagedServiceIdentity - from ._models import MetricAvailabilily - from ._models import MetricDefinition - from ._models import NameValuePair - from ._models import NetworkAccessControlEntry - from ._models import Operation - from ._models import ProxyOnlyResource - from ._models import PushSettings - from ._models import RampUpRule - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceMetric - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import ResourceMetricName - from ._models import ResourceMetricProperty - from ._models import ResourceMetricValue - from ._models import Site - from ._models import SiteConfig - from ._models import SiteLimits - from ._models import SiteMachineKey - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SkuInfo - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import SnapshotRecoveryRequest - from ._models import SnapshotRecoveryTarget - from ._models import StampCapacity - from ._models import StatusCodesBasedTrigger - from ._models import Usage - from ._models import User - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VirtualIPMapping - from ._models import VirtualNetworkProfile - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetRoute - from ._models import WebAppCollection - from ._models import WorkerPool - from ._models import WorkerPoolResource -from ._paged_models import AppServiceEnvironmentResourcePaged -from ._paged_models import AppServicePlanPaged -from ._paged_models import CsmUsageQuotaPaged -from ._paged_models import HybridConnectionPaged -from ._paged_models import ResourceMetricDefinitionPaged -from ._paged_models import ResourceMetricPaged -from ._paged_models import SitePaged -from ._paged_models import SkuInfoPaged -from ._paged_models import StampCapacityPaged -from ._paged_models import StrPaged -from ._paged_models import UsagePaged -from ._paged_models import WorkerPoolResourcePaged + from ._models import AddressResponse # type: ignore + from ._models import ApiDefinitionInfo # type: ignore + from ._models import AppServiceEnvironmentCollection # type: ignore + from ._models import AppServiceEnvironmentPatchResource # type: ignore + from ._models import AppServiceEnvironmentResource # type: ignore + from ._models import AppServicePlan # type: ignore + from ._models import AppServicePlanCollection # type: ignore + from ._models import AppServicePlanPatchResource # type: ignore + from ._models import AutoHealActions # type: ignore + from ._models import AutoHealCustomAction # type: ignore + from ._models import AutoHealRules # type: ignore + from ._models import AutoHealTriggers # type: ignore + from ._models import Capability # type: ignore + from ._models import CloningInfo # type: ignore + from ._models import ConnStringInfo # type: ignore + from ._models import CorsSettings # type: ignore + from ._models import CsmUsageQuota # type: ignore + from ._models import CsmUsageQuotaCollection # type: ignore + from ._models import ErrorEntity # type: ignore + from ._models import Experiments # type: ignore + from ._models import HandlerMapping # type: ignore + from ._models import HostNameSslState # type: ignore + from ._models import HostingEnvironmentDiagnostics # type: ignore + from ._models import HostingEnvironmentProfile # type: ignore + from ._models import HybridConnection # type: ignore + from ._models import HybridConnectionCollection # type: ignore + from ._models import HybridConnectionKey # type: ignore + from ._models import HybridConnectionLimits # type: ignore + from ._models import IpSecurityRestriction # type: ignore + from ._models import LocalizableString # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import MetricAvailabilily # type: ignore + from ._models import MetricDefinition # type: ignore + from ._models import NameValuePair # type: ignore + from ._models import NetworkAccessControlEntry # type: ignore + from ._models import Operation # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import PushSettings # type: ignore + from ._models import RampUpRule # type: ignore + from ._models import RequestsBasedTrigger # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceCollection # type: ignore + from ._models import ResourceMetric # type: ignore + from ._models import ResourceMetricAvailability # type: ignore + from ._models import ResourceMetricCollection # type: ignore + from ._models import ResourceMetricDefinition # type: ignore + from ._models import ResourceMetricDefinitionCollection # type: ignore + from ._models import ResourceMetricName # type: ignore + from ._models import ResourceMetricProperty # type: ignore + from ._models import ResourceMetricValue # type: ignore + from ._models import Site # type: ignore + from ._models import SiteConfig # type: ignore + from ._models import SiteLimits # type: ignore + from ._models import SiteMachineKey # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import SkuInfo # type: ignore + from ._models import SkuInfoCollection # type: ignore + from ._models import SlotSwapStatus # type: ignore + from ._models import SlowRequestsBasedTrigger # type: ignore + from ._models import SnapshotRecoveryRequest # type: ignore + from ._models import SnapshotRecoveryTarget # type: ignore + from ._models import StampCapacity # type: ignore + from ._models import StampCapacityCollection # type: ignore + from ._models import StatusCodesBasedTrigger # type: ignore + from ._models import Usage # type: ignore + from ._models import UsageCollection # type: ignore + from ._models import VirtualApplication # type: ignore + from ._models import VirtualDirectory # type: ignore + from ._models import VirtualIPMapping # type: ignore + from ._models import VirtualNetworkProfile # type: ignore + from ._models import VnetGateway # type: ignore + from ._models import VnetInfo # type: ignore + from ._models import VnetRoute # type: ignore + from ._models import WebAppCollection # type: ignore + from ._models import WorkerPool # type: ignore + from ._models import WorkerPoolCollection # type: ignore + from ._models import WorkerPoolResource # type: ignore + from ._web_site_management_client_enums import ( - ProvisioningState, - HostingEnvironmentStatus, - InternalLoadBalancingMode, - ComputeModeOptions, - WorkerSizeOptions, AccessControlEntryAction, - RouteType, - ManagedServiceIdentityType, AutoHealActionType, + ComputeModeOptions, ConnectionStringType, - ScmType, + HostType, + HostingEnvironmentStatus, + InternalLoadBalancingMode, ManagedPipelineMode, + ManagedServiceIdentityType, + OperationStatus, + ProvisioningState, + RouteType, + ScmType, + SiteAvailabilityState, SiteLoadBalancing, - SupportedTlsVersions, SslState, - HostType, - UsageState, - SiteAvailabilityState, StatusOptions, - OperationStatus, + SupportedTlsVersions, + UsageState, + WorkerSizeOptions, ) __all__ = [ 'AddressResponse', 'ApiDefinitionInfo', + 'AppServiceEnvironmentCollection', 'AppServiceEnvironmentPatchResource', 'AppServiceEnvironmentResource', 'AppServicePlan', + 'AppServicePlanCollection', 'AppServicePlanPatchResource', 'AutoHealActions', 'AutoHealCustomAction', @@ -200,16 +206,17 @@ 'ConnStringInfo', 'CorsSettings', 'CsmUsageQuota', + 'CsmUsageQuotaCollection', 'ErrorEntity', 'Experiments', 'HandlerMapping', + 'HostNameSslState', 'HostingEnvironmentDiagnostics', 'HostingEnvironmentProfile', - 'HostNameSslState', 'HybridConnection', + 'HybridConnectionCollection', 'HybridConnectionKey', 'HybridConnectionLimits', - 'Identifier', 'IpSecurityRestriction', 'LocalizableString', 'ManagedServiceIdentity', @@ -223,9 +230,12 @@ 'RampUpRule', 'RequestsBasedTrigger', 'Resource', + 'ResourceCollection', 'ResourceMetric', 'ResourceMetricAvailability', + 'ResourceMetricCollection', 'ResourceMetricDefinition', + 'ResourceMetricDefinitionCollection', 'ResourceMetricName', 'ResourceMetricProperty', 'ResourceMetricValue', @@ -236,14 +246,16 @@ 'SkuCapacity', 'SkuDescription', 'SkuInfo', + 'SkuInfoCollection', 'SlotSwapStatus', 'SlowRequestsBasedTrigger', 'SnapshotRecoveryRequest', 'SnapshotRecoveryTarget', 'StampCapacity', + 'StampCapacityCollection', 'StatusCodesBasedTrigger', 'Usage', - 'User', + 'UsageCollection', 'VirtualApplication', 'VirtualDirectory', 'VirtualIPMapping', @@ -253,37 +265,26 @@ 'VnetRoute', 'WebAppCollection', 'WorkerPool', + 'WorkerPoolCollection', 'WorkerPoolResource', - 'AppServiceEnvironmentResourcePaged', - 'StampCapacityPaged', - 'ResourceMetricPaged', - 'WorkerPoolResourcePaged', - 'ResourceMetricDefinitionPaged', - 'SkuInfoPaged', - 'UsagePaged', - 'AppServicePlanPaged', - 'SitePaged', - 'CsmUsageQuotaPaged', - 'StrPaged', - 'HybridConnectionPaged', - 'ProvisioningState', - 'HostingEnvironmentStatus', - 'InternalLoadBalancingMode', - 'ComputeModeOptions', - 'WorkerSizeOptions', 'AccessControlEntryAction', - 'RouteType', - 'ManagedServiceIdentityType', 'AutoHealActionType', + 'ComputeModeOptions', 'ConnectionStringType', - 'ScmType', + 'HostType', + 'HostingEnvironmentStatus', + 'InternalLoadBalancingMode', 'ManagedPipelineMode', + 'ManagedServiceIdentityType', + 'OperationStatus', + 'ProvisioningState', + 'RouteType', + 'ScmType', + 'SiteAvailabilityState', 'SiteLoadBalancing', - 'SupportedTlsVersions', 'SslState', - 'HostType', - 'UsageState', - 'SiteAvailabilityState', 'StatusOptions', - 'OperationStatus', + 'SupportedTlsVersions', + 'UsageState', + 'WorkerSizeOptions', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models.py index 0b12570bcbc3..0a1d21756fcd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models.py @@ -1,31 +1,26 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import msrest.serialization -class AddressResponse(Model): +class AddressResponse(msrest.serialization.Model): """Describes main public IP address and any extra virtual IPs. :param service_ip_address: Main public virtual IP. :type service_ip_address: str - :param internal_ip_address: Virtual Network internal IP address of the App - Service Environment if it is in internal load-balancing mode. + :param internal_ip_address: Virtual Network internal IP address of the App Service Environment + if it is in internal load-balancing mode. :type internal_ip_address: str - :param outbound_ip_addresses: IP addresses appearing on outbound - connections. + :param outbound_ip_addresses: IP addresses appearing on outbound connections. :type outbound_ip_addresses: list[str] :param vip_mappings: Additional virtual IPs. - :type vip_mappings: - list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] + :type vip_mappings: list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] """ _attribute_map = { @@ -35,7 +30,10 @@ class AddressResponse(Model): 'vip_mappings': {'key': 'vipMappings', 'type': '[VirtualIPMapping]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AddressResponse, self).__init__(**kwargs) self.service_ip_address = kwargs.get('service_ip_address', None) self.internal_ip_address = kwargs.get('internal_ip_address', None) @@ -43,7 +41,7 @@ def __init__(self, **kwargs): self.vip_mappings = kwargs.get('vip_mappings', None) -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -54,17 +52,50 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = kwargs.get('url', None) -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class AppServiceEnvironmentCollection(msrest.serialization.Model): + """Collection of App Service Environments. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceEnvironmentCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. + + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -89,7 +120,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -100,10 +134,7 @@ def __init__(self, **kwargs): class AppServiceEnvironmentPatchResource(ProxyOnlyResource): """ARM resource for a app service environment. - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -113,54 +144,46 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_environment_patch_resource_name: Required. Name of the - App Service Environment. - :type app_service_environment_patch_resource_name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location: Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2016_09_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2016_09_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -168,35 +191,29 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2016_09_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -204,25 +221,23 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] """ @@ -230,12 +245,8 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_environment_patch_resource_name': {'required': True}, - 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -258,15 +269,15 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_environment_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -296,9 +307,12 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'user_whitelisted_ip_ranges': {'key': 'properties.userWhitelistedIpRanges', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironmentPatchResource, self).__init__(**kwargs) - self.app_service_environment_patch_resource_name = kwargs.get('app_service_environment_patch_resource_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.location = kwargs.get('location', None) self.provisioning_state = None self.status = None @@ -336,11 +350,10 @@ def __init__(self, **kwargs): self.user_whitelisted_ip_ranges = kwargs.get('user_whitelisted_ip_ranges', None) -class Resource(Model): +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -354,7 +367,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -374,12 +387,15 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.type = None self.tags = kwargs.get('tags', None) @@ -387,8 +403,7 @@ def __init__(self, **kwargs): class AppServiceEnvironmentResource(Resource): """App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -402,56 +417,48 @@ class AppServiceEnvironmentResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_environment_resource_name: Required. Name of the App - Service Environment. - :type app_service_environment_resource_name: str - :param app_service_environment_resource_location: Required. Location of - the App Service Environment, e.g. "West US". - :type app_service_environment_resource_location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location_properties_location: Location of the App Service Environment, e.g. "West US". + :type location_properties_location: str + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2016_09_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2016_09_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -459,35 +466,29 @@ class AppServiceEnvironmentResource(Resource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2016_09_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -495,25 +496,23 @@ class AppServiceEnvironmentResource(Resource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] """ @@ -522,12 +521,8 @@ class AppServiceEnvironmentResource(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_environment_resource_name': {'required': True}, - 'app_service_environment_resource_location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -552,15 +547,15 @@ class AppServiceEnvironmentResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_environment_resource_name': {'key': 'properties.name', 'type': 'str'}, - 'app_service_environment_resource_location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -590,10 +585,13 @@ class AppServiceEnvironmentResource(Resource): 'user_whitelisted_ip_ranges': {'key': 'properties.userWhitelistedIpRanges', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironmentResource, self).__init__(**kwargs) - self.app_service_environment_resource_name = kwargs.get('app_service_environment_resource_name', None) - self.app_service_environment_resource_location = kwargs.get('app_service_environment_resource_location', None) + self.name_properties_name = kwargs.get('name_properties_name', None) + self.location_properties_location = kwargs.get('location_properties_location', None) self.provisioning_state = None self.status = None self.vnet_name = kwargs.get('vnet_name', None) @@ -633,8 +631,7 @@ def __init__(self, **kwargs): class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -648,58 +645,52 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription + :param name_properties_name: Name for the App Service plan. + :type name_properties_name: str + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str :param admin_site_name: App Service plan administration site. :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState """ _validation = { @@ -707,7 +698,6 @@ class AppServicePlan(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, 'status': {'readonly': True}, 'subscription': {'readonly': True}, 'maximum_number_of_workers': {'readonly': True}, @@ -724,9 +714,10 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, @@ -740,13 +731,16 @@ class AppServicePlan(Resource): 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlan, self).__init__(**kwargs) - self.app_service_plan_name = kwargs.get('app_service_plan_name', None) + self.sku = kwargs.get('sku', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None self.subscription = None @@ -763,16 +757,41 @@ def __init__(self, **kwargs): self.target_worker_count = kwargs.get('target_worker_count', None) self.target_worker_size_id = kwargs.get('target_worker_size_id', None) self.provisioning_state = None - self.sku = kwargs.get('sku', None) + + +class AppServicePlanCollection(msrest.serialization.Model): + """Collection of App Service plans. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] + :param next_link: Link to next page of resources. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServicePlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServicePlanCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) class AppServicePlanPatchResource(ProxyOnlyResource): """ARM resource for a app service plan. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -782,62 +801,54 @@ class AppServicePlanPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_plan_patch_resource_name: Required. Name for the App - Service plan. - :type app_service_plan_patch_resource_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param name_properties_name: Name for the App Service plan. + :type name_properties_name: str + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str :param admin_site_name: App Service plan administration site. :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_plan_patch_resource_name': {'required': True}, 'status': {'readonly': True}, 'subscription': {'readonly': True}, 'maximum_number_of_workers': {'readonly': True}, @@ -852,9 +863,9 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_plan_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, @@ -868,12 +879,15 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlanPatchResource, self).__init__(**kwargs) - self.app_service_plan_patch_resource_name = kwargs.get('app_service_plan_patch_resource_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None self.subscription = None @@ -892,37 +906,38 @@ def __init__(self, **kwargs): self.provisioning_state = None -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2016_09_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2016_09_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2016_09_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2016_09_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) self.custom_action = kwargs.get('custom_action', None) self.min_process_execution_time = kwargs.get('min_process_execution_time', None) -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -935,17 +950,19 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = kwargs.get('exe', None) self.parameters = kwargs.get('parameters', None) -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2016_09_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2016_09_01.models.AutoHealActions @@ -956,13 +973,16 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = kwargs.get('triggers', None) self.actions = kwargs.get('actions', None) -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -970,11 +990,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2016_09_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2016_09_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2016_09_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2016_09_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -984,7 +1002,10 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = kwargs.get('requests', None) self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) @@ -992,7 +1013,7 @@ def __init__(self, **kwargs): self.slow_requests = kwargs.get('slow_requests', None) -class Capability(Model): +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -1009,58 +1030,59 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) self.reason = kwargs.get('reason', None) -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. + :param ignore_quotas: :code:`true` if quotas should be ignored; otherwise, + :code:`false`. :type ignore_quotas: bool """ @@ -1082,13 +1104,16 @@ class CloningInfo(Model): 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = kwargs.get('correlation_id', None) self.overwrite = kwargs.get('overwrite', None) self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) + self.source_web_app_id = kwargs['source_web_app_id'] self.hosting_environment = kwargs.get('hosting_environment', None) self.app_settings_overrides = kwargs.get('app_settings_overrides', None) self.configure_load_balancing = kwargs.get('configure_load_balancing', None) @@ -1097,45 +1122,40 @@ def __init__(self, **kwargs): self.ignore_quotas = kwargs.get('ignore_quotas', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_09_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.connection_string = kwargs.get('connection_string', None) self.type = kwargs.get('type', None) -class CorsSettings(Model): +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] """ @@ -1144,18 +1164,21 @@ class CorsSettings(Model): 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = kwargs.get('allowed_origins', None) -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -1172,7 +1195,10 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = kwargs.get('unit', None) self.next_reset_time = kwargs.get('next_reset_time', None) @@ -1181,7 +1207,39 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) -class ErrorEntity(Model): +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -1207,7 +1265,10 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = kwargs.get('extended_code', None) self.message_template = kwargs.get('message_template', None) @@ -1217,7 +1278,7 @@ def __init__(self, **kwargs): self.message = kwargs.get('message', None) -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -1228,24 +1289,24 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = kwargs.get('ramp_up_rules', None) -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -1255,14 +1316,17 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = kwargs.get('extension', None) self.script_processor = kwargs.get('script_processor', None) self.arguments = kwargs.get('arguments', None) -class HostingEnvironmentDiagnostics(Model): +class HostingEnvironmentDiagnostics(msrest.serialization.Model): """Diagnostics for an App Service Environment. :param name: Name/identifier of the diagnostics. @@ -1276,17 +1340,19 @@ class HostingEnvironmentDiagnostics(Model): 'diagnosics_output': {'key': 'diagnosicsOutput', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentDiagnostics, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.diagnosics_output = kwargs.get('diagnosics_output', None) -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -1307,43 +1373,48 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None self.type = None -class HostNameSslState(Model): +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_09_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2016_09_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.ssl_state = kwargs.get('ssl_state', None) @@ -1356,8 +1427,7 @@ def __init__(self, **kwargs): class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1377,15 +1447,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -1410,7 +1480,10 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnection, self).__init__(**kwargs) self.service_bus_namespace = kwargs.get('service_bus_namespace', None) self.relay_name = kwargs.get('relay_name', None) @@ -1422,12 +1495,42 @@ def __init__(self, **kwargs): self.service_bus_suffix = kwargs.get('service_bus_suffix', None) +class HybridConnectionCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.HybridConnection] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HybridConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HybridConnectionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1460,18 +1563,19 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionKey, self).__init__(**kwargs) self.send_key_name = None self.send_key_value = None class HybridConnectionLimits(ProxyOnlyResource): - """Hybrid Connection limits contract. This is used to return the plan limits - of Hybrid Connections. + """Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1504,59 +1608,23 @@ class HybridConnectionLimits(ProxyOnlyResource): 'maximum': {'key': 'properties.maximum', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionLimits, self).__init__(**kwargs) self.current = None self.maximum = None -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) - - -class IpSecurityRestriction(Model): +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP address the security restriction is valid - for. + :param ip_address: Required. IP address the security restriction is valid for. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str """ @@ -1569,13 +1637,16 @@ class IpSecurityRestriction(Model): 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = kwargs.get('ip_address', None) + self.ip_address = kwargs['ip_address'] self.subnet_mask = kwargs.get('subnet_mask', None) -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -1589,22 +1660,22 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned". + :type type: str or ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. @@ -1622,14 +1693,17 @@ class ManagedServiceIdentity(Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.tenant_id = None self.principal_id = None -class MetricAvailabilily(Model): +class MetricAvailabilily(msrest.serialization.Model): """Metric availability and retention. :param time_grain: Time grain. @@ -1643,7 +1717,10 @@ class MetricAvailabilily(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricAvailabilily, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.retention = kwargs.get('retention', None) @@ -1652,8 +1729,7 @@ def __init__(self, **kwargs): class MetricDefinition(ProxyOnlyResource): """Metadata for a metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1663,16 +1739,15 @@ class MetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar metric_definition_name: Name of the metric. - :vartype metric_definition_name: str + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: str :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2016_09_01.models.MetricAvailabilily] + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. + :vartype metric_availabilities: list[~azure.mgmt.web.v2016_09_01.models.MetricAvailabilily] :ivar display_name: Friendly name shown in the UI. :vartype display_name: str """ @@ -1681,7 +1756,7 @@ class MetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, @@ -1693,23 +1768,26 @@ class MetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'metric_definition_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[MetricAvailabilily]'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDefinition, self).__init__(**kwargs) - self.metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.display_name = None -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -1723,18 +1801,20 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2016_09_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2016_09_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -1744,13 +1824,16 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = kwargs.get('action', None) self.description = kwargs.get('description', None) @@ -1758,24 +1841,24 @@ def __init__(self, **kwargs): self.remote_subnet = kwargs.get('remote_subnet', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2016_09_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2016_09_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -1783,7 +1866,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -1791,7 +1874,10 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -1806,10 +1892,7 @@ def __init__(self, **kwargs): class PushSettings(ProxyOnlyResource): """Push settings for the App. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1819,22 +1902,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -1842,7 +1922,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -1856,7 +1935,10 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PushSettings, self).__init__(**kwargs) self.is_push_enabled = kwargs.get('is_push_enabled', None) self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) @@ -1864,40 +1946,38 @@ def __init__(self, **kwargs): self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -1912,7 +1992,10 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = kwargs.get('action_host_name', None) self.reroute_percentage = kwargs.get('reroute_percentage', None) @@ -1924,7 +2007,7 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -1938,38 +2021,70 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = kwargs.get('count', None) self.time_interval = kwargs.get('time_interval', None) -class ResourceMetric(Model): +class ResourceCollection(msrest.serialization.Model): + """Collection of resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[str] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2016_09_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] """ _validation = { @@ -1996,7 +2111,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -2009,11 +2127,10 @@ def __init__(self, **kwargs): self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -2031,17 +2148,51 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None +class ResourceMetricCollection(msrest.serialization.Model): + """Collection of metric responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetric]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2051,21 +2202,20 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricName + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: ~azure.mgmt.web.v2016_09_01.models.ResourceMetricName :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str + :ivar id_properties_id: Resource ID. + :vartype id_properties_id: str :ivar properties: Resource metric definition properties. :vartype properties: dict[str, str] """ @@ -2074,12 +2224,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, 'properties': {'readonly': True}, } @@ -2088,31 +2238,65 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(**kwargs) - self.resource_metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.resource_uri = None - self.resource_metric_definition_id = None + self.id_properties_id = None self.properties = None -class ResourceMetricName(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -2130,13 +2314,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -2150,17 +2337,19 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.value = kwargs.get('value', None) -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -2175,8 +2364,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] """ _validation = { @@ -2199,7 +2387,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -2213,8 +2404,7 @@ def __init__(self, **kwargs): class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2228,117 +2418,99 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_09_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_09_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_09_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_09_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_09_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_09_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_09_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_09_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_09_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentity """ _validation = { @@ -2372,13 +2544,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -2404,11 +2577,14 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Site, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -2441,21 +2617,18 @@ def __init__(self, **kwargs): self.default_host_name = None self.slot_swap_status = None self.https_only = kwargs.get('https_only', None) - self.identity = kwargs.get('identity', None) -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -2463,52 +2636,50 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_09_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_09_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_09_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_09_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_09_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_09_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -2518,24 +2689,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_09_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_09_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_09_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_09_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_09_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_09_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_09_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_09_01.models.AutoHealRules @@ -2547,25 +2714,21 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2016_09_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_09_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_09_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_09_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_09_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_09_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_09_01.models.SupportedTlsVersions """ _validation = { @@ -2601,9 +2764,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -2620,7 +2783,10 @@ class SiteConfig(Model): 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -2669,7 +2835,7 @@ def __init__(self, **kwargs): self.min_tls_version = kwargs.get('min_tls_version', None) -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -2686,14 +2852,17 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) self.max_disk_size_in_mb = kwargs.get('max_disk_size_in_mb', None) -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -2713,7 +2882,10 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = kwargs.get('validation', None) self.validation_key = kwargs.get('validation_key', None) @@ -2721,7 +2893,7 @@ def __init__(self, **kwargs): self.decryption_key = kwargs.get('decryption_key', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -2741,7 +2913,10 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs.get('minimum', None) self.maximum = kwargs.get('maximum', None) @@ -2749,7 +2924,7 @@ def __init__(self, **kwargs): self.scale_type = kwargs.get('scale_type', None) -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -2766,8 +2941,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2016_09_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2016_09_01.models.Capability] """ @@ -2782,7 +2956,10 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -2794,7 +2971,7 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class SkuInfo(Model): +class SkuInfo(msrest.serialization.Model): """SKU discovery information. :param resource_type: Resource type that this SKU applies to. @@ -2811,25 +2988,58 @@ class SkuInfo(Model): 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuInfo, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.sku = kwargs.get('sku', None) self.capacity = kwargs.get('capacity', None) -class SlotSwapStatus(Model): +class SkuInfoCollection(msrest.serialization.Model): + """Collection of SKU information. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.SkuInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -2845,14 +3055,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -2869,7 +3082,10 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = kwargs.get('time_taken', None) self.count = kwargs.get('count', None) @@ -2879,10 +3095,7 @@ def __init__(self, **kwargs): class SnapshotRecoveryRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2892,21 +3105,19 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app recovery should be attempted, formatted as + a DateTime string. :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. + :param recovery_target: Specifies the web app that snapshot contents will be written to. + :type recovery_target: ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryTarget + :param overwrite: If :code:`true` the recovery operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool """ @@ -2915,7 +3126,6 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -2930,7 +3140,10 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoveryRequest, self).__init__(**kwargs) self.snapshot_time = kwargs.get('snapshot_time', None) self.recovery_target = kwargs.get('recovery_target', None) @@ -2939,16 +3152,16 @@ def __init__(self, **kwargs): self.ignore_conflicting_host_names = kwargs.get('ignore_conflicting_host_names', None) -class SnapshotRecoveryTarget(Model): +class SnapshotRecoveryTarget(msrest.serialization.Model): """Specifies the web app that snapshot contents will be written to. - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the target web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -2958,44 +3171,42 @@ class SnapshotRecoveryTarget(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoveryTarget, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.id = kwargs.get('id', None) -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Default', 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3' - :type worker_size: str or - ~azure.mgmt.web.v2016_09_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Default", "Small", + "Medium", "Large", "D1", "D2", "D3". + :type worker_size: str or ~azure.mgmt.web.v2016_09_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str @@ -3006,15 +3217,18 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, 'site_mode': {'key': 'siteMode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available_capacity = kwargs.get('available_capacity', None) @@ -3028,7 +3242,39 @@ def __init__(self, **kwargs): self.site_mode = kwargs.get('site_mode', None) -class StatusCodesBasedTrigger(Model): +class StampCapacityCollection(msrest.serialization.Model): + """Collection of stamp capacities. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StampCapacity]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StampCapacityCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -3051,7 +3297,10 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.sub_status = kwargs.get('sub_status', None) @@ -3063,8 +3312,7 @@ def __init__(self, **kwargs): class Usage(ProxyOnlyResource): """Usage of the quota resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3076,8 +3324,8 @@ class Usage(ProxyOnlyResource): :vartype type: str :ivar display_name: Friendly name shown in the UI. :vartype display_name: str - :ivar usage_name: Name of the quota. - :vartype usage_name: str + :ivar name_properties_name: Name of the quota. + :vartype name_properties_name: str :ivar resource_name: Name of the quota resource. :vartype resource_name: str :ivar unit: Units of measurement for the quota resource. @@ -3087,11 +3335,10 @@ class Usage(ProxyOnlyResource): :ivar limit: The resource limit. :vartype limit: long :ivar next_reset_time: Next reset time for the resource counter. - :vartype next_reset_time: datetime - :ivar compute_mode: Compute mode used for this usage. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :vartype compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :vartype next_reset_time: ~datetime.datetime + :ivar compute_mode: Compute mode used for this usage. Possible values include: "Shared", + "Dedicated", "Dynamic". + :vartype compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions :ivar site_mode: Site mode used for this usage. :vartype site_mode: str """ @@ -3101,7 +3348,7 @@ class Usage(ProxyOnlyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'display_name': {'readonly': True}, - 'usage_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'resource_name': {'readonly': True}, 'unit': {'readonly': True}, 'current_value': {'readonly': True}, @@ -3117,20 +3364,23 @@ class Usage(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'usage_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'current_value': {'key': 'properties.currentValue', 'type': 'long'}, 'limit': {'key': 'properties.limit', 'type': 'long'}, 'next_reset_time': {'key': 'properties.nextResetTime', 'type': 'iso-8601'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'site_mode': {'key': 'properties.siteMode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Usage, self).__init__(**kwargs) self.display_name = None - self.usage_name = None + self.name_properties_name = None self.resource_name = None self.unit = None self.current_value = None @@ -3140,76 +3390,50 @@ def __init__(self, **kwargs): self.site_mode = None -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class UsageCollection(msrest.serialization.Model): + """Collection of usages. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param user_name: Username - :type user_name: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.Usage] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.name', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(User, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.publishing_user_name = kwargs.get('publishing_user_name', None) - self.publishing_password = kwargs.get('publishing_password', None) - self.publishing_password_hash = kwargs.get('publishing_password_hash', None) - self.publishing_password_hash_salt = kwargs.get('publishing_password_hash_salt', None) + def __init__( + self, + **kwargs + ): + super(UsageCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2016_09_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2016_09_01.models.VirtualDirectory] """ _attribute_map = { @@ -3219,7 +3443,10 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) @@ -3227,7 +3454,7 @@ def __init__(self, **kwargs): self.virtual_directories = kwargs.get('virtual_directories', None) -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -3241,13 +3468,16 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -3267,7 +3497,10 @@ class VirtualIPMapping(Model): 'in_use': {'key': 'inUse', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = kwargs.get('virtual_ip', None) self.internal_http_port = kwargs.get('internal_http_port', None) @@ -3275,11 +3508,10 @@ def __init__(self, **kwargs): self.in_use = kwargs.get('in_use', None) -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -3303,7 +3535,10 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None @@ -3312,13 +3547,9 @@ def __init__(self, **kwargs): class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3330,8 +3561,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -3339,7 +3569,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -3351,7 +3580,10 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetGateway, self).__init__(**kwargs) self.vnet_name = kwargs.get('vnet_name', None) self.vpn_package_uri = kwargs.get('vpn_package_uri', None) @@ -3360,8 +3592,7 @@ def __init__(self, **kwargs): class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3375,17 +3606,17 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: bytearray :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str """ @@ -3411,7 +3642,10 @@ class VnetInfo(ProxyOnlyResource): 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetInfo, self).__init__(**kwargs) self.vnet_resource_id = kwargs.get('vnet_resource_id', None) self.cert_thumbprint = None @@ -3422,11 +3656,9 @@ def __init__(self, **kwargs): class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3436,23 +3668,22 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. + :param vnet_route_name: The name of this route. This is only returned by the server and does + not need to be set by the client. :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2016_09_01.models.RouteType """ @@ -3473,7 +3704,10 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetRoute, self).__init__(**kwargs) self.vnet_route_name = kwargs.get('vnet_route_name', None) self.start_address = kwargs.get('start_address', None) @@ -3481,11 +3715,10 @@ def __init__(self, **kwargs): self.route_type = kwargs.get('route_type', None) -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3505,30 +3738,30 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.next_link = None -class WorkerPool(Model): +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -3538,13 +3771,16 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) @@ -3553,11 +3789,42 @@ def __init__(self, **kwargs): self.instance_names = None +class WorkerPoolCollection(msrest.serialization.Model): + """Collection of worker pools. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkerPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkerPoolCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class WorkerPoolResource(ProxyOnlyResource): """Worker pool of an App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3567,21 +3834,19 @@ class WorkerPoolResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] - :param sku: - :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription """ _validation = { @@ -3596,19 +3861,22 @@ class WorkerPoolResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_size_id': {'key': 'properties.workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'worker_size': {'key': 'properties.workerSize', 'type': 'str'}, 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, 'instance_names': {'key': 'properties.instanceNames', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPoolResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) self.worker_size = kwargs.get('worker_size', None) self.worker_count = kwargs.get('worker_count', None) self.instance_names = None - self.sku = kwargs.get('sku', None) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models_py3.py index a3bcc9501f2f..3bf75f518d3c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_models_py3.py @@ -1,31 +1,31 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import datetime +from typing import Dict, List, Optional, Union +import msrest.serialization -class AddressResponse(Model): +from ._web_site_management_client_enums import * + + +class AddressResponse(msrest.serialization.Model): """Describes main public IP address and any extra virtual IPs. :param service_ip_address: Main public virtual IP. :type service_ip_address: str - :param internal_ip_address: Virtual Network internal IP address of the App - Service Environment if it is in internal load-balancing mode. + :param internal_ip_address: Virtual Network internal IP address of the App Service Environment + if it is in internal load-balancing mode. :type internal_ip_address: str - :param outbound_ip_addresses: IP addresses appearing on outbound - connections. + :param outbound_ip_addresses: IP addresses appearing on outbound connections. :type outbound_ip_addresses: list[str] :param vip_mappings: Additional virtual IPs. - :type vip_mappings: - list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] + :type vip_mappings: list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] """ _attribute_map = { @@ -35,7 +35,15 @@ class AddressResponse(Model): 'vip_mappings': {'key': 'vipMappings', 'type': '[VirtualIPMapping]'}, } - def __init__(self, *, service_ip_address: str=None, internal_ip_address: str=None, outbound_ip_addresses=None, vip_mappings=None, **kwargs) -> None: + def __init__( + self, + *, + service_ip_address: Optional[str] = None, + internal_ip_address: Optional[str] = None, + outbound_ip_addresses: Optional[List[str]] = None, + vip_mappings: Optional[List["VirtualIPMapping"]] = None, + **kwargs + ): super(AddressResponse, self).__init__(**kwargs) self.service_ip_address = service_ip_address self.internal_ip_address = internal_ip_address @@ -43,7 +51,7 @@ def __init__(self, *, service_ip_address: str=None, internal_ip_address: str=Non self.vip_mappings = vip_mappings -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -54,17 +62,54 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = url -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class AppServiceEnvironmentCollection(msrest.serialization.Model): + """Collection of App Service Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceEnvironmentResource"], + **kwargs + ): + super(AppServiceEnvironmentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -89,7 +134,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -100,10 +150,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class AppServiceEnvironmentPatchResource(ProxyOnlyResource): """ARM resource for a app service environment. - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -113,54 +160,46 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_environment_patch_resource_name: Required. Name of the - App Service Environment. - :type app_service_environment_patch_resource_name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location: Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2016_09_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2016_09_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -168,35 +207,29 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2016_09_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -204,25 +237,23 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] """ @@ -230,12 +261,8 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_environment_patch_resource_name': {'required': True}, - 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -258,15 +285,15 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_environment_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -296,9 +323,33 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'user_whitelisted_ip_ranges': {'key': 'properties.userWhitelistedIpRanges', 'type': '[str]'}, } - def __init__(self, *, app_service_environment_patch_resource_name: str, location: str, virtual_network, worker_pools, kind: str=None, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + location: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + virtual_network: Optional["VirtualNetworkProfile"] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + worker_pools: Optional[List["WorkerPool"]] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + **kwargs + ): super(AppServiceEnvironmentPatchResource, self).__init__(kind=kind, **kwargs) - self.app_service_environment_patch_resource_name = app_service_environment_patch_resource_name + self.name_properties_name = name_properties_name self.location = location self.provisioning_state = None self.status = None @@ -336,11 +387,10 @@ def __init__(self, *, app_service_environment_patch_resource_name: str, location self.user_whitelisted_ip_ranges = user_whitelisted_ip_ranges -class Resource(Model): +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -354,7 +404,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -374,7 +424,14 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -387,8 +444,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> Non class AppServiceEnvironmentResource(Resource): """App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -402,56 +458,48 @@ class AppServiceEnvironmentResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_environment_resource_name: Required. Name of the App - Service Environment. - :type app_service_environment_resource_name: str - :param app_service_environment_resource_location: Required. Location of - the App Service Environment, e.g. "West US". - :type app_service_environment_resource_location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location_properties_location: Location of the App Service Environment, e.g. "West US". + :type location_properties_location: str + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2016_09_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2016_09_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2016_09_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -459,35 +507,29 @@ class AppServiceEnvironmentResource(Resource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2016_09_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2016_09_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -495,25 +537,23 @@ class AppServiceEnvironmentResource(Resource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] """ @@ -522,12 +562,8 @@ class AppServiceEnvironmentResource(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_environment_resource_name': {'required': True}, - 'app_service_environment_resource_location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -552,15 +588,15 @@ class AppServiceEnvironmentResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_environment_resource_name': {'key': 'properties.name', 'type': 'str'}, - 'app_service_environment_resource_location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -590,10 +626,36 @@ class AppServiceEnvironmentResource(Resource): 'user_whitelisted_ip_ranges': {'key': 'properties.userWhitelistedIpRanges', 'type': '[str]'}, } - def __init__(self, *, location: str, app_service_environment_resource_name: str, app_service_environment_resource_location: str, virtual_network, worker_pools, kind: str=None, tags=None, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + name_properties_name: Optional[str] = None, + location_properties_location: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + virtual_network: Optional["VirtualNetworkProfile"] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + worker_pools: Optional[List["WorkerPool"]] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + **kwargs + ): super(AppServiceEnvironmentResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_environment_resource_name = app_service_environment_resource_name - self.app_service_environment_resource_location = app_service_environment_resource_location + self.name_properties_name = name_properties_name + self.location_properties_location = location_properties_location self.provisioning_state = None self.status = None self.vnet_name = vnet_name @@ -633,8 +695,7 @@ def __init__(self, *, location: str, app_service_environment_resource_name: str, class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -648,58 +709,52 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_plan_name: Required. Name for the App Service plan. - :type app_service_plan_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription + :param name_properties_name: Name for the App Service plan. + :type name_properties_name: str + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str :param admin_site_name: App Service plan administration site. :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState """ _validation = { @@ -707,7 +762,6 @@ class AppServicePlan(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_plan_name': {'required': True}, 'status': {'readonly': True}, 'subscription': {'readonly': True}, 'maximum_number_of_workers': {'readonly': True}, @@ -724,9 +778,10 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_plan_name': {'key': 'properties.name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, @@ -740,13 +795,31 @@ class AppServicePlan(Resource): 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, tags=None, worker_tier_name: str=None, admin_site_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, is_spot: bool=None, spot_expiration_time=None, reserved: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SkuDescription"] = None, + name_properties_name: Optional[str] = None, + worker_tier_name: Optional[str] = None, + admin_site_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_plan_name = app_service_plan_name + self.sku = sku + self.name_properties_name = name_properties_name self.worker_tier_name = worker_tier_name self.status = None self.subscription = None @@ -763,16 +836,44 @@ def __init__(self, *, location: str, app_service_plan_name: str, kind: str=None, self.target_worker_count = target_worker_count self.target_worker_size_id = target_worker_size_id self.provisioning_state = None - self.sku = sku + + +class AppServicePlanCollection(msrest.serialization.Model): + """Collection of App Service plans. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] + :param next_link: Link to next page of resources. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServicePlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServicePlan"], + next_link: Optional[str] = None, + **kwargs + ): + super(AppServicePlanCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link class AppServicePlanPatchResource(ProxyOnlyResource): """ARM resource for a app service plan. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -782,62 +883,54 @@ class AppServicePlanPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_plan_patch_resource_name: Required. Name for the App - Service plan. - :type app_service_plan_patch_resource_name: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param name_properties_name: Name for the App Service plan. + :type name_properties_name: str + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2016_09_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str :param admin_site_name: App Service plan administration site. :type admin_site_name: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2016_09_01.models.ProvisioningState + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2016_09_01.models.ProvisioningState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_plan_patch_resource_name': {'required': True}, 'status': {'readonly': True}, 'subscription': {'readonly': True}, 'maximum_number_of_workers': {'readonly': True}, @@ -852,9 +945,9 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_plan_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'admin_site_name': {'key': 'properties.adminSiteName', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, @@ -868,12 +961,27 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, app_service_plan_patch_resource_name: str, kind: str=None, worker_tier_name: str=None, admin_site_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, is_spot: bool=None, spot_expiration_time=None, reserved: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + worker_tier_name: Optional[str] = None, + admin_site_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlanPatchResource, self).__init__(kind=kind, **kwargs) - self.app_service_plan_patch_resource_name = app_service_plan_patch_resource_name + self.name_properties_name = name_properties_name self.worker_tier_name = worker_tier_name self.status = None self.subscription = None @@ -892,37 +1000,42 @@ def __init__(self, *, app_service_plan_patch_resource_name: str, kind: str=None, self.provisioning_state = None -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2016_09_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2016_09_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2016_09_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2016_09_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "AutoHealActionType"]] = None, + custom_action: Optional["AutoHealCustomAction"] = None, + min_process_execution_time: Optional[str] = None, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = action_type self.custom_action = custom_action self.min_process_execution_time = min_process_execution_time -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -935,17 +1048,22 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: + def __init__( + self, + *, + exe: Optional[str] = None, + parameters: Optional[str] = None, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = exe self.parameters = parameters -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2016_09_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2016_09_01.models.AutoHealActions @@ -956,13 +1074,19 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + triggers: Optional["AutoHealTriggers"] = None, + actions: Optional["AutoHealActions"] = None, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = triggers self.actions = actions -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -970,11 +1094,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2016_09_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2016_09_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2016_09_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2016_09_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -984,7 +1106,15 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: + def __init__( + self, + *, + requests: Optional["RequestsBasedTrigger"] = None, + private_bytes_in_kb: Optional[int] = None, + status_codes: Optional[List["StatusCodesBasedTrigger"]] = None, + slow_requests: Optional["SlowRequestsBasedTrigger"] = None, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = requests self.private_bytes_in_kb = private_bytes_in_kb @@ -992,7 +1122,7 @@ def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes self.slow_requests = slow_requests -class Capability(Model): +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -1009,58 +1139,63 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + reason: Optional[str] = None, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = name self.value = value self.reason = reason -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str - :param ignore_quotas: true if quotas should be ignored; - otherwise, false. + :param ignore_quotas: :code:`true` if quotas should be ignored; otherwise, + :code:`false`. :type ignore_quotas: bool """ @@ -1082,7 +1217,22 @@ class CloningInfo(Model): 'ignore_quotas': {'key': 'ignoreQuotas', 'type': 'bool'}, } - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, ignore_quotas: bool=None, **kwargs) -> None: + def __init__( + self, + *, + source_web_app_id: str, + correlation_id: Optional[str] = None, + overwrite: Optional[bool] = None, + clone_custom_host_names: Optional[bool] = None, + clone_source_control: Optional[bool] = None, + hosting_environment: Optional[str] = None, + app_settings_overrides: Optional[Dict[str, str]] = None, + configure_load_balancing: Optional[bool] = None, + traffic_manager_profile_id: Optional[str] = None, + traffic_manager_profile_name: Optional[str] = None, + ignore_quotas: Optional[bool] = None, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = correlation_id self.overwrite = overwrite @@ -1097,45 +1247,44 @@ def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrit self.ignore_quotas = ignore_quotas -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2016_09_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + connection_string: Optional[str] = None, + type: Optional[Union[str, "ConnectionStringType"]] = None, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = name self.connection_string = connection_string self.type = type -class CorsSettings(Model): +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] """ @@ -1144,18 +1293,23 @@ class CorsSettings(Model): 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, } - def __init__(self, *, allowed_origins=None, **kwargs) -> None: + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = allowed_origins -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -1172,7 +1326,16 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=None, limit: int=None, name=None, **kwargs) -> None: + def __init__( + self, + *, + unit: Optional[str] = None, + next_reset_time: Optional[datetime.datetime] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["LocalizableString"] = None, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = unit self.next_reset_time = next_reset_time @@ -1181,7 +1344,41 @@ def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=N self.name = name -class ErrorEntity(Model): +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmUsageQuota"], + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -1207,7 +1404,17 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, extended_code: str=None, message_template: str=None, parameters=None, inner_errors=None, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["ErrorEntity"]] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = extended_code self.message_template = message_template @@ -1217,7 +1424,7 @@ def __init__(self, *, extended_code: str=None, message_template: str=None, param self.message = message -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -1228,24 +1435,26 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: + def __init__( + self, + *, + ramp_up_rules: Optional[List["RampUpRule"]] = None, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = ramp_up_rules -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -1255,14 +1464,21 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: + def __init__( + self, + *, + extension: Optional[str] = None, + script_processor: Optional[str] = None, + arguments: Optional[str] = None, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = extension self.script_processor = script_processor self.arguments = arguments -class HostingEnvironmentDiagnostics(Model): +class HostingEnvironmentDiagnostics(msrest.serialization.Model): """Diagnostics for an App Service Environment. :param name: Name/identifier of the diagnostics. @@ -1276,17 +1492,22 @@ class HostingEnvironmentDiagnostics(Model): 'diagnosics_output': {'key': 'diagnosicsOutput', 'type': 'str'}, } - def __init__(self, *, name: str=None, diagnosics_output: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + diagnosics_output: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentDiagnostics, self).__init__(**kwargs) self.name = name self.diagnosics_output = diagnosics_output -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -1307,43 +1528,57 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = id self.name = None self.type = None -class HostNameSslState(Model): +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2016_09_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2016_09_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + virtual_ip: Optional[str] = None, + thumbprint: Optional[str] = None, + to_update: Optional[bool] = None, + host_type: Optional[Union[str, "HostType"]] = None, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = name self.ssl_state = ssl_state @@ -1356,8 +1591,7 @@ def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thum class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1377,15 +1611,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -1410,7 +1644,20 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + service_bus_namespace: Optional[str] = None, + relay_name: Optional[str] = None, + relay_arm_uri: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + send_key_name: Optional[str] = None, + send_key_value: Optional[str] = None, + service_bus_suffix: Optional[str] = None, + **kwargs + ): super(HybridConnection, self).__init__(kind=kind, **kwargs) self.service_bus_namespace = service_bus_namespace self.relay_name = relay_name @@ -1422,12 +1669,44 @@ def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_nam self.service_bus_suffix = service_bus_suffix +class HybridConnectionCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.HybridConnection] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HybridConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["HybridConnection"], + **kwargs + ): + super(HybridConnectionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1460,18 +1739,21 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) self.send_key_name = None self.send_key_value = None class HybridConnectionLimits(ProxyOnlyResource): - """Hybrid Connection limits contract. This is used to return the plan limits - of Hybrid Connections. + """Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1504,59 +1786,25 @@ class HybridConnectionLimits(ProxyOnlyResource): 'maximum': {'key': 'properties.maximum', 'type': 'int'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionLimits, self).__init__(kind=kind, **kwargs) self.current = None self.maximum = None -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: - super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id - - -class IpSecurityRestriction(Model): +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP address the security restriction is valid - for. + :param ip_address: Required. IP address the security restriction is valid for. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str """ @@ -1569,13 +1817,19 @@ class IpSecurityRestriction(Model): 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, } - def __init__(self, *, ip_address: str, subnet_mask: str=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: str, + subnet_mask: Optional[str] = None, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = ip_address self.subnet_mask = subnet_mask -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -1589,22 +1843,25 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = value self.localized_value = localized_value -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned' - :type type: str or - ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned". + :type type: str or ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. @@ -1622,14 +1879,19 @@ class ManagedServiceIdentity(Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, } - def __init__(self, *, type=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = type self.tenant_id = None self.principal_id = None -class MetricAvailabilily(Model): +class MetricAvailabilily(msrest.serialization.Model): """Metric availability and retention. :param time_grain: Time grain. @@ -1643,7 +1905,13 @@ class MetricAvailabilily(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, *, time_grain: str=None, retention: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_grain: Optional[str] = None, + retention: Optional[str] = None, + **kwargs + ): super(MetricAvailabilily, self).__init__(**kwargs) self.time_grain = time_grain self.retention = retention @@ -1652,8 +1920,7 @@ def __init__(self, *, time_grain: str=None, retention: str=None, **kwargs) -> No class MetricDefinition(ProxyOnlyResource): """Metadata for a metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1663,16 +1930,15 @@ class MetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar metric_definition_name: Name of the metric. - :vartype metric_definition_name: str + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: str :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2016_09_01.models.MetricAvailabilily] + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. + :vartype metric_availabilities: list[~azure.mgmt.web.v2016_09_01.models.MetricAvailabilily] :ivar display_name: Friendly name shown in the UI. :vartype display_name: str """ @@ -1681,7 +1947,7 @@ class MetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, @@ -1693,23 +1959,28 @@ class MetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'metric_definition_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[MetricAvailabilily]'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MetricDefinition, self).__init__(kind=kind, **kwargs) - self.metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.display_name = None -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -1723,18 +1994,23 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = name self.value = value -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2016_09_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2016_09_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -1744,13 +2020,21 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, *, action=None, description: str=None, order: int=None, remote_subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + action: Optional[Union[str, "AccessControlEntryAction"]] = None, + description: Optional[str] = None, + order: Optional[int] = None, + remote_subnet: Optional[str] = None, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = action self.description = description @@ -1758,24 +2042,24 @@ def __init__(self, *, action=None, description: str=None, order: int=None, remot self.remote_subnet = remote_subnet -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2016_09_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2016_09_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -1783,7 +2067,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -1791,7 +2075,19 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, created_time=None, modified_time=None, expiration_time=None, geo_master_operation_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "OperationStatus"]] = None, + errors: Optional[List["ErrorEntity"]] = None, + created_time: Optional[datetime.datetime] = None, + modified_time: Optional[datetime.datetime] = None, + expiration_time: Optional[datetime.datetime] = None, + geo_master_operation_id: Optional[str] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = id self.name = name @@ -1806,10 +2102,7 @@ def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, cr class PushSettings(ProxyOnlyResource): """Push settings for the App. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1819,22 +2112,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -1842,7 +2132,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -1856,7 +2145,16 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + is_push_enabled: Optional[bool] = None, + tag_whitelist_json: Optional[str] = None, + tags_requiring_auth: Optional[str] = None, + dynamic_tags_json: Optional[str] = None, + **kwargs + ): super(PushSettings, self).__init__(kind=kind, **kwargs) self.is_push_enabled = is_push_enabled self.tag_whitelist_json = tag_whitelist_json @@ -1864,40 +2162,38 @@ def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: self.dynamic_tags_json = dynamic_tags_json -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -1912,7 +2208,19 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_host_name: Optional[str] = None, + reroute_percentage: Optional[float] = None, + change_step: Optional[float] = None, + change_interval_in_minutes: Optional[int] = None, + min_reroute_percentage: Optional[float] = None, + max_reroute_percentage: Optional[float] = None, + change_decision_callback_url: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = action_host_name self.reroute_percentage = reroute_percentage @@ -1924,7 +2232,7 @@ def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None self.name = name -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -1938,38 +2246,75 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = count self.time_interval = time_interval -class ResourceMetric(Model): +class ResourceCollection(msrest.serialization.Model): + """Collection of resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[str] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List[str], + **kwargs + ): + super(ResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2016_09_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] """ _validation = { @@ -1996,7 +2341,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -2009,11 +2357,10 @@ def __init__(self, **kwargs) -> None: self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -2031,17 +2378,53 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None +class ResourceMetricCollection(msrest.serialization.Model): + """Collection of metric responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetric]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetric"], + **kwargs + ): + super(ResourceMetricCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2051,21 +2434,20 @@ class ResourceMetricDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar resource_metric_definition_name: Name of the metric. - :vartype resource_metric_definition_name: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricName + :ivar name_properties_name: Name of the metric. + :vartype name_properties_name: ~azure.mgmt.web.v2016_09_01.models.ResourceMetricName :ivar unit: Unit of the metric. :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. :vartype resource_uri: str - :ivar resource_metric_definition_id: Resource ID. - :vartype resource_metric_definition_id: str + :ivar id_properties_id: Resource ID. + :vartype id_properties_id: str :ivar properties: Resource metric definition properties. :vartype properties: dict[str, str] """ @@ -2074,12 +2456,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'resource_metric_definition_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'unit': {'readonly': True}, 'primary_aggregation_type': {'readonly': True}, 'metric_availabilities': {'readonly': True}, 'resource_uri': {'readonly': True}, - 'resource_metric_definition_id': {'readonly': True}, + 'id_properties_id': {'readonly': True}, 'properties': {'readonly': True}, } @@ -2088,31 +2470,69 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'resource_metric_definition_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceMetricName'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'resource_metric_definition_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) - self.resource_metric_definition_name = None + self.name_properties_name = None self.unit = None self.primary_aggregation_type = None self.metric_availabilities = None self.resource_uri = None - self.resource_metric_definition_id = None + self.id_properties_id = None self.properties = None -class ResourceMetricName(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetricDefinition"], + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -2130,13 +2550,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -2150,17 +2573,22 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = key self.value = value -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -2175,8 +2603,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2016_09_01.models.ResourceMetricProperty] """ _validation = { @@ -2199,7 +2626,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -2213,8 +2643,7 @@ def __init__(self, **kwargs) -> None: class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2228,117 +2657,99 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2016_09_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2016_09_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2016_09_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2016_09_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2016_09_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2016_09_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2016_09_01.models.CloningInfo - :param snapshot_info: If specified during app creation, the app is created - from a previous snapshot. - :type snapshot_info: - ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryRequest - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :param snapshot_info: If specified during app creation, the app is created from a previous + snapshot. + :type snapshot_info: ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryRequest + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2016_09_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2016_09_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param identity: - :type identity: ~azure.mgmt.web.v2016_09_01.models.ManagedServiceIdentity """ _validation = { @@ -2372,13 +2783,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -2404,11 +2816,34 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, snapshot_info=None, https_only: bool=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + snapshot_info: Optional["SnapshotRecoveryRequest"] = None, + https_only: Optional[bool] = None, + **kwargs + ): super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -2441,21 +2876,18 @@ def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=No self.default_host_name = None self.slot_swap_status = None self.https_only = https_only - self.identity = identity -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -2463,52 +2895,50 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2016_09_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2016_09_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2016_09_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2016_09_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2016_09_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2016_09_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2016_09_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -2518,24 +2948,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2016_09_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2016_09_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2016_09_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2016_09_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2016_09_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2016_09_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2016_09_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2016_09_01.models.AutoHealRules @@ -2547,25 +2973,21 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2016_09_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2016_09_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2016_09_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool :param ip_security_restrictions: IP security restrictions. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2016_09_01.models.IpSecurityRestriction] - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :type ip_security_restrictions: list[~azure.mgmt.web.v2016_09_01.models.IpSecurityRestriction] + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2016_09_01.models.SupportedTlsVersions + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2016_09_01.models.SupportedTlsVersions """ _validation = { @@ -2601,9 +3023,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -2620,7 +3042,55 @@ class SiteConfig(Model): 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, } - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, ip_security_restrictions=None, http20_enabled: bool=True, min_tls_version=None, **kwargs) -> None: + def __init__( + self, + *, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -2669,7 +3139,7 @@ def __init__(self, *, number_of_workers: int=None, default_documents=None, net_f self.min_tls_version = min_tls_version -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -2686,14 +3156,21 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: + def __init__( + self, + *, + max_percentage_cpu: Optional[float] = None, + max_memory_in_mb: Optional[int] = None, + max_disk_size_in_mb: Optional[int] = None, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = max_percentage_cpu self.max_memory_in_mb = max_memory_in_mb self.max_disk_size_in_mb = max_disk_size_in_mb -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -2713,7 +3190,15 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + validation: Optional[str] = None, + validation_key: Optional[str] = None, + decryption: Optional[str] = None, + decryption_key: Optional[str] = None, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = validation self.validation_key = validation_key @@ -2721,7 +3206,7 @@ def __init__(self, *, validation: str=None, validation_key: str=None, decryption self.decryption_key = decryption_key -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -2741,7 +3226,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[str] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2749,7 +3242,7 @@ def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, s self.scale_type = scale_type -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -2766,8 +3259,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2016_09_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2016_09_01.models.Capability] """ @@ -2782,7 +3274,19 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + sku_capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2794,7 +3298,7 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class SkuInfo(Model): +class SkuInfo(msrest.serialization.Model): """SKU discovery information. :param resource_type: Resource type that this SKU applies to. @@ -2811,25 +3315,64 @@ class SkuInfo(Model): 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, } - def __init__(self, *, resource_type: str=None, sku=None, capacity=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional["SkuDescription"] = None, + capacity: Optional["SkuCapacity"] = None, + **kwargs + ): super(SkuInfo, self).__init__(**kwargs) self.resource_type = resource_type self.sku = sku self.capacity = capacity -class SlotSwapStatus(Model): +class SkuInfoCollection(msrest.serialization.Model): + """Collection of SKU information. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.SkuInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SkuInfo"], + **kwargs + ): + super(SkuInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -2845,14 +3388,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -2869,7 +3415,14 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_taken: Optional[str] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = time_taken self.count = count @@ -2879,10 +3432,7 @@ def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str= class SnapshotRecoveryRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2892,21 +3442,19 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app recovery should be - attempted, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app recovery should be attempted, formatted as + a DateTime string. :type snapshot_time: str - :param recovery_target: Specifies the web app that snapshot contents will - be written to. - :type recovery_target: - ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryTarget - :param overwrite: Required. If true the recovery operation - can overwrite source app; otherwise, false. + :param recovery_target: Specifies the web app that snapshot contents will be written to. + :type recovery_target: ~azure.mgmt.web.v2016_09_01.models.SnapshotRecoveryTarget + :param overwrite: If :code:`true` the recovery operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool """ @@ -2915,7 +3463,6 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -2930,7 +3477,17 @@ class SnapshotRecoveryRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, } - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_target=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + snapshot_time: Optional[str] = None, + recovery_target: Optional["SnapshotRecoveryTarget"] = None, + overwrite: Optional[bool] = None, + recover_configuration: Optional[bool] = None, + ignore_conflicting_host_names: Optional[bool] = None, + **kwargs + ): super(SnapshotRecoveryRequest, self).__init__(kind=kind, **kwargs) self.snapshot_time = snapshot_time self.recovery_target = recovery_target @@ -2939,16 +3496,16 @@ def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, self.ignore_conflicting_host_names = ignore_conflicting_host_names -class SnapshotRecoveryTarget(Model): +class SnapshotRecoveryTarget(msrest.serialization.Model): """Specifies the web app that snapshot contents will be written to. - :param location: Geographical location of the target web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the target web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the target app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -2958,44 +3515,45 @@ class SnapshotRecoveryTarget(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): super(SnapshotRecoveryTarget, self).__init__(**kwargs) self.location = location self.id = id -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Default', 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3' - :type worker_size: str or - ~azure.mgmt.web.v2016_09_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Default", "Small", + "Medium", "Large", "D1", "D2", "D3". + :type worker_size: str or ~azure.mgmt.web.v2016_09_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str @@ -3006,15 +3564,29 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, 'site_mode': {'key': 'siteMode', 'type': 'str'}, } - def __init__(self, *, name: str=None, available_capacity: int=None, total_capacity: int=None, unit: str=None, compute_mode=None, worker_size=None, worker_size_id: int=None, exclude_from_capacity_allocation: bool=None, is_applicable_for_all_compute_modes: bool=None, site_mode: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available_capacity: Optional[int] = None, + total_capacity: Optional[int] = None, + unit: Optional[str] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[Union[str, "WorkerSizeOptions"]] = None, + worker_size_id: Optional[int] = None, + exclude_from_capacity_allocation: Optional[bool] = None, + is_applicable_for_all_compute_modes: Optional[bool] = None, + site_mode: Optional[str] = None, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = name self.available_capacity = available_capacity @@ -3028,7 +3600,41 @@ def __init__(self, *, name: str=None, available_capacity: int=None, total_capaci self.site_mode = site_mode -class StatusCodesBasedTrigger(Model): +class StampCapacityCollection(msrest.serialization.Model): + """Collection of stamp capacities. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.StampCapacity] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StampCapacity]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StampCapacity"], + **kwargs + ): + super(StampCapacityCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -3051,7 +3657,16 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[int] = None, + sub_status: Optional[int] = None, + win32_status: Optional[int] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = status self.sub_status = sub_status @@ -3063,8 +3678,7 @@ def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int= class Usage(ProxyOnlyResource): """Usage of the quota resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3076,8 +3690,8 @@ class Usage(ProxyOnlyResource): :vartype type: str :ivar display_name: Friendly name shown in the UI. :vartype display_name: str - :ivar usage_name: Name of the quota. - :vartype usage_name: str + :ivar name_properties_name: Name of the quota. + :vartype name_properties_name: str :ivar resource_name: Name of the quota resource. :vartype resource_name: str :ivar unit: Units of measurement for the quota resource. @@ -3087,11 +3701,10 @@ class Usage(ProxyOnlyResource): :ivar limit: The resource limit. :vartype limit: long :ivar next_reset_time: Next reset time for the resource counter. - :vartype next_reset_time: datetime - :ivar compute_mode: Compute mode used for this usage. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :vartype compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :vartype next_reset_time: ~datetime.datetime + :ivar compute_mode: Compute mode used for this usage. Possible values include: "Shared", + "Dedicated", "Dynamic". + :vartype compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions :ivar site_mode: Site mode used for this usage. :vartype site_mode: str """ @@ -3101,7 +3714,7 @@ class Usage(ProxyOnlyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'display_name': {'readonly': True}, - 'usage_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'resource_name': {'readonly': True}, 'unit': {'readonly': True}, 'current_value': {'readonly': True}, @@ -3117,20 +3730,25 @@ class Usage(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'usage_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, 'unit': {'key': 'properties.unit', 'type': 'str'}, 'current_value': {'key': 'properties.currentValue', 'type': 'long'}, 'limit': {'key': 'properties.limit', 'type': 'long'}, 'next_reset_time': {'key': 'properties.nextResetTime', 'type': 'iso-8601'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'site_mode': {'key': 'properties.siteMode', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(Usage, self).__init__(kind=kind, **kwargs) self.display_name = None - self.usage_name = None + self.name_properties_name = None self.resource_name = None self.unit = None self.current_value = None @@ -3140,76 +3758,52 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.site_mode = None -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class UsageCollection(msrest.serialization.Model): + """Collection of usages. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param user_name: Username - :type user_name: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.Usage] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_name': {'key': 'properties.name', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, publishing_user_name: str, kind: str=None, user_name: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, **kwargs) -> None: - super(User, self).__init__(kind=kind, **kwargs) - self.user_name = user_name - self.publishing_user_name = publishing_user_name - self.publishing_password = publishing_password - self.publishing_password_hash = publishing_password_hash - self.publishing_password_hash_salt = publishing_password_hash_salt + def __init__( + self, + *, + value: List["Usage"], + **kwargs + ): + super(UsageCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2016_09_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2016_09_01.models.VirtualDirectory] """ _attribute_map = { @@ -3219,7 +3813,15 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + preload_enabled: Optional[bool] = None, + virtual_directories: Optional[List["VirtualDirectory"]] = None, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path @@ -3227,7 +3829,7 @@ def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_e self.virtual_directories = virtual_directories -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -3241,13 +3843,19 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -3267,7 +3875,15 @@ class VirtualIPMapping(Model): 'in_use': {'key': 'inUse', 'type': 'bool'}, } - def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, internal_https_port: int=None, in_use: bool=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_ip: Optional[str] = None, + internal_http_port: Optional[int] = None, + internal_https_port: Optional[int] = None, + in_use: Optional[bool] = None, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = virtual_ip self.internal_http_port = internal_http_port @@ -3275,11 +3891,10 @@ def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, intern self.in_use = in_use -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -3303,7 +3918,13 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + subnet: Optional[str] = None, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = id self.name = None @@ -3312,13 +3933,9 @@ def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3330,8 +3947,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -3339,7 +3955,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -3351,7 +3966,14 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_name: Optional[str] = None, + vpn_package_uri: Optional[str] = None, + **kwargs + ): super(VnetGateway, self).__init__(kind=kind, **kwargs) self.vnet_name = vnet_name self.vpn_package_uri = vpn_package_uri @@ -3360,8 +3982,7 @@ def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3375,17 +3996,17 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: bytearray :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str """ @@ -3411,7 +4032,15 @@ class VnetInfo(ProxyOnlyResource): 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: bytearray=None, dns_servers: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_id: Optional[str] = None, + cert_blob: Optional[bytearray] = None, + dns_servers: Optional[str] = None, + **kwargs + ): super(VnetInfo, self).__init__(kind=kind, **kwargs) self.vnet_resource_id = vnet_resource_id self.cert_thumbprint = None @@ -3422,11 +4051,9 @@ def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: byt class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3436,23 +4063,22 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_route_name: The name of this route. This is only returned by - the server and does not need to be set by the client. + :param vnet_route_name: The name of this route. This is only returned by the server and does + not need to be set by the client. :type vnet_route_name: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2016_09_01.models.RouteType """ @@ -3473,7 +4099,16 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_route_name: Optional[str] = None, + start_address: Optional[str] = None, + end_address: Optional[str] = None, + route_type: Optional[Union[str, "RouteType"]] = None, + **kwargs + ): super(VnetRoute, self).__init__(kind=kind, **kwargs) self.vnet_route_name = vnet_route_name self.start_address = start_address @@ -3481,11 +4116,10 @@ def __init__(self, *, kind: str=None, vnet_route_name: str=None, start_address: self.route_type = route_type -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -3505,30 +4139,32 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["Site"], + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) self.value = value self.next_link = None -class WorkerPool(Model): +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -3538,13 +4174,21 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = worker_size_id self.compute_mode = compute_mode @@ -3553,11 +4197,44 @@ def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: self.instance_names = None +class WorkerPoolCollection(msrest.serialization.Model): + """Collection of worker pools. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkerPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["WorkerPoolResource"], + **kwargs + ): + super(WorkerPoolCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WorkerPoolResource(ProxyOnlyResource): """Worker pool of an App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3567,21 +4244,19 @@ class WorkerPoolResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2016_09_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] - :param sku: - :type sku: ~azure.mgmt.web.v2016_09_01.models.SkuDescription """ _validation = { @@ -3596,19 +4271,29 @@ class WorkerPoolResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_size_id': {'key': 'properties.workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'worker_size': {'key': 'properties.workerSize', 'type': 'str'}, 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, 'instance_names': {'key': 'properties.instanceNames', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, *, kind: str=None, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional["SkuDescription"] = None, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPoolResource, self).__init__(kind=kind, **kwargs) + self.sku = sku self.worker_size_id = worker_size_id self.compute_mode = compute_mode self.worker_size = worker_size self.worker_count = worker_count self.instance_names = None - self.sku = sku diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_web_site_management_client_enums.py index 9ea4b6e131ed..d6ec8893b776 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_web_site_management_client_enums.py @@ -1,175 +1,216 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" - - -class HostingEnvironmentStatus(str, Enum): - - preparing = "Preparing" - ready = "Ready" - scaling = "Scaling" - deleting = "Deleting" - - -class InternalLoadBalancingMode(str, Enum): - - none = "None" - web = "Web" - publishing = "Publishing" - - -class ComputeModeOptions(str, Enum): - - shared = "Shared" - dedicated = "Dedicated" - dynamic = "Dynamic" - - -class WorkerSizeOptions(str, Enum): - - default = "Default" - small = "Small" - medium = "Medium" - large = "Large" - d1 = "D1" - d2 = "D2" - d3 = "D3" - - -class AccessControlEntryAction(str, Enum): - - permit = "Permit" - deny = "Deny" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" - - -class OperationStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AccessControlEntryAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action object. + """ + + PERMIT = "Permit" + DENY = "Deny" + +class AutoHealActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Predefined action to be taken. + """ + + RECYCLE = "Recycle" + LOG_EVENT = "LogEvent" + CUSTOM_ACTION = "CustomAction" + +class ComputeModeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Shared/dedicated workers. + """ + + SHARED = "Shared" + DEDICATED = "Dedicated" + DYNAMIC = "Dynamic" + +class ConnectionStringType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of database. + """ + + MY_SQL = "MySql" + SQL_SERVER = "SQLServer" + SQL_AZURE = "SQLAzure" + CUSTOM = "Custom" + NOTIFICATION_HUB = "NotificationHub" + SERVICE_BUS = "ServiceBus" + EVENT_HUB = "EventHub" + API_HUB = "ApiHub" + DOC_DB = "DocDb" + REDIS_CACHE = "RedisCache" + POSTGRE_SQL = "PostgreSQL" + +class HostingEnvironmentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the App Service Environment. + """ + + PREPARING = "Preparing" + READY = "Ready" + SCALING = "Scaling" + DELETING = "Deleting" + +class HostType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether the hostname is a standard or repository hostname. + """ + + STANDARD = "Standard" + REPOSITORY = "Repository" + +class InternalLoadBalancingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies which endpoints to serve internally in the Virtual Network for the App Service + Environment. + """ + + NONE = "None" + WEB = "Web" + PUBLISHING = "Publishing" + +class ManagedPipelineMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Managed pipeline mode. + """ + + INTEGRATED = "Integrated" + CLASSIC = "Classic" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the operation. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App Service Environment. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" + +class RouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of route this is: + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 + INHERITED - Routes inherited from the real Virtual Network routes + STATIC - Static route set on the app only + + These values will be used for syncing an app's routes with those from a Virtual Network. + """ + + DEFAULT = "DEFAULT" + INHERITED = "INHERITED" + STATIC = "STATIC" + +class ScmType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SCM type. + """ + + NONE = "None" + DROPBOX = "Dropbox" + TFS = "Tfs" + LOCAL_GIT = "LocalGit" + GIT_HUB = "GitHub" + CODE_PLEX_GIT = "CodePlexGit" + CODE_PLEX_HG = "CodePlexHg" + BITBUCKET_GIT = "BitbucketGit" + BITBUCKET_HG = "BitbucketHg" + EXTERNAL_GIT = "ExternalGit" + EXTERNAL_HG = "ExternalHg" + ONE_DRIVE = "OneDrive" + VSO = "VSO" + +class SiteAvailabilityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Management information availability state for the app. + """ + + NORMAL = "Normal" + LIMITED = "Limited" + DISASTER_RECOVERY_MODE = "DisasterRecoveryMode" + +class SiteLoadBalancing(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site load balancing. + """ + + WEIGHTED_ROUND_ROBIN = "WeightedRoundRobin" + LEAST_REQUESTS = "LeastRequests" + LEAST_RESPONSE_TIME = "LeastResponseTime" + WEIGHTED_TOTAL_TRAFFIC = "WeightedTotalTraffic" + REQUEST_HASH = "RequestHash" + +class SslState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SSL type. + """ + + DISABLED = "Disabled" + SNI_ENABLED = "SniEnabled" + IP_BASED_ENABLED = "IpBasedEnabled" + +class StatusOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plan status. + """ + + READY = "Ready" + PENDING = "Pending" + CREATING = "Creating" + +class SupportedTlsVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """MinTlsVersion: configures the minimum version of TLS required for SSL requests + """ + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" + +class UsageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State indicating whether the app has exceeded its quota usage. Read-only. + """ + + NORMAL = "Normal" + EXCEEDED = "Exceeded" + +class WorkerSizeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Size of the machines. + """ + + DEFAULT = "Default" + SMALL = "Small" + MEDIUM = "Medium" + LARGE = "Large" + D1 = "D1" + D2 = "D2" + D3 = "D3" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/__init__.py index 7366e58aee45..5d511905f8ab 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._app_service_environments_operations import AppServiceEnvironmentsOperations diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py index 437b21d791ec..f016f17d1bc2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py @@ -1,1520 +1,1534 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServiceEnvironmentsOperations(object): """AppServiceEnvironmentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_09_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. - :ivar api_version: API Version. Constant value: "2016-09-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-09-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceEnvironmentCollection"] """Get all App Service Environments for a subscription. Get all App Service Environments for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceEnvironmentResource - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResourcePaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceEnvironmentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceEnvironmentCollection"] """Get all App Service Environments in a resource group. Get all App Service Environments in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceEnvironmentResource - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResourcePaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceEnvironmentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceEnvironmentResource" """Get the properties of an App Service Environment. Get the properties of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceEnvironmentResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServiceEnvironmentResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceEnvironmentResource"] """Create or update an App Service Environment. Create or update an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param hosting_environment_envelope: Configuration details of the App - Service Environment. - :type hosting_environment_envelope: - ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceEnvironmentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceEnvironmentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - hosting_environment_envelope=hosting_environment_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceEnvironmentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + hosting_environment_envelope=hosting_environment_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} - + 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 + ) + 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.Web/hostingEnvironments/{name}'} # type: ignore def _delete_initial( - self, resource_group_name, name, force_delete=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + force_delete=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if force_delete is not None: query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, name, force_delete=None, custom_headers=None, raw=False, polling=True, **operation_config): + 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.Web/hostingEnvironments/{name}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + name, # type: str + force_delete=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete an App Service Environment. Delete an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param force_delete: Specify true to force the deletion - even if the App Service Environment contains resources. The default is - false. + :param force_delete: Specify :code:`true` to force the deletion even if the App + Service Environment contains resources. The default is :code:`false`. :type force_delete: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - name=name, - force_delete=force_delete, - custom_headers=custom_headers, - raw=True, - **operation_config + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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, + name=name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def update( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentPatchResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServiceEnvironmentResource"] """Create or update an App Service Environment. Create or update an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param hosting_environment_envelope: Configuration details of the App - Service Environment. - :type hosting_environment_envelope: - ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceEnvironmentResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def list_capacities( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the used, available, and total worker capacity an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StampCapacityCollection"] + """Get the used, available, and total worker capacity an App Service Environment. - Get the used, available, and total worker capacity an App Service - Environment. + Get the used, available, and total worker capacity an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StampCapacity - :rtype: - ~azure.mgmt.web.v2016_09_01.models.StampCapacityPaged[~azure.mgmt.web.v2016_09_01.models.StampCapacity] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StampCapacityCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.StampCapacityCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_capacities.metadata['url'] + url = self.list_capacities.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StampCapacityCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StampCapacityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} + return ItemPaged( + get_next, extract_data + ) + list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} # type: ignore def list_vips( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AddressResponse" """Get IP addresses assigned to an App Service Environment. Get IP addresses assigned to an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AddressResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.AddressResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AddressResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_vips.metadata['url'] + url = self.list_vips.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AddressResponse', response) + deserialized = self._deserialize('AddressResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} + list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} # type: ignore def list_diagnostics( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.HostingEnvironmentDiagnostics"] """Get diagnostic information for an App Service Environment. Get diagnostic information for an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_diagnostics.metadata['url'] + url = self.list_diagnostics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[HostingEnvironmentDiagnostics]', response) + deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} + list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} # type: ignore def get_diagnostics_item( - self, resource_group_name, name, diagnostics_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + diagnostics_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostingEnvironmentDiagnostics" """Get a diagnostics item for an App Service Environment. Get a diagnostics item for an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param diagnostics_name: Name of the diagnostics item. :type diagnostics_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostingEnvironmentDiagnostics or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_diagnostics_item.metadata['url'] + url = self.get_diagnostics_item.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HostingEnvironmentDiagnostics', response) + deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} + get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} # type: ignore def list_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MetricDefinition" """Get global metric definitions of an App Service Environment. Get global metric definitions of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MetricDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.MetricDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetricDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.MetricDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_metric_definitions.metadata['url'] + url = self.list_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MetricDefinition', response) + deserialized = self._deserialize('MetricDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'} + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'} # type: ignore def list_metrics( - self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Get global metrics of an App Service Environment. Get global metrics of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics.metadata['url'] + url = self.list_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'} # type: ignore def list_multi_role_pools( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkerPoolCollection"] """Get all multi-role pools. Get all multi-role pools. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WorkerPoolResource - :rtype: - ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResourcePaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pools.metadata['url'] + url = self.list_multi_role_pools.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkerPoolCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkerPoolResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} # type: ignore def get_multi_role_pool( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Get properties of a multi-role pool. Get properties of a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_multi_role_pool.metadata['url'] + url = self.get_multi_role_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} - + get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def _create_or_update_multi_role_pool_initial( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_multi_role_pool.metadata['url'] + url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_multi_role_pool( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + def begin_create_or_update_multi_role_pool( + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WorkerPoolResource"] """Create or update a multi-role pool. Create or update a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param multi_role_pool_envelope: Properties of the multi-role pool. - :type multi_role_pool_envelope: - ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type multi_role_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkerPoolResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_multi_role_pool_initial( - resource_group_name=resource_group_name, - name=name, - multi_role_pool_envelope=multi_role_pool_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkerPoolResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_multi_role_pool_initial( + resource_group_name=resource_group_name, + name=name, + multi_role_pool_envelope=multi_role_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def update_multi_role_pool( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] """Create or update a multi-role pool. Create or update a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param multi_role_pool_envelope: Properties of the multi-role pool. - :type multi_role_pool_envelope: - ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type multi_role_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_multi_role_pool.metadata['url'] + url = self.update_multi_role_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} + update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def list_multi_role_pool_instance_metric_definitions( - self, resource_group_name, name, instance, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a specific instance of a multi-role pool of - an App Service Environment. - - Get metric definitions for a specific instance of a multi-role pool of - an App Service Environment. + self, + resource_group_name, # type: str + name, # type: str + instance, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + + Get metric definitions for a specific instance of a multi-role pool of an App Service + Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param instance: Name of the instance in the multi-role pool. :type instance: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] + url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} # type: ignore def list_multi_role_pool_instance_metrics( - self, resource_group_name, name, instance, details=None, custom_headers=None, raw=False, **operation_config): - """Get metrics for a specific instance of a multi-role pool of an App - Service Environment. - - Get metrics for a specific instance of a multi-role pool of an App - Service Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + instance, # type: str + details=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] + """Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param instance: Name of the instance in the multi-role pool. :type instance: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_instance_metrics.metadata['url'] + url = self.list_multi_role_pool_instance_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'} # type: ignore def list_multi_role_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a multi-role pool of an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a multi-role pool of an App Service Environment. - Get metric definitions for a multi-role pool of an App Service - Environment. + Get metric definitions for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_metric_definitions.metadata['url'] + url = self.list_multi_role_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} # type: ignore def list_multi_role_metrics( - self, resource_group_name, name, start_time=None, end_time=None, time_grain=None, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + start_time=None, # type: Optional[str] + end_time=None, # type: Optional[str] + time_grain=None, # type: Optional[str] + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Get metrics for a multi-role pool of an App Service Environment. Get metrics for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -1524,38 +1538,40 @@ def list_multi_role_metrics( :type end_time: str :param time_grain: Time granularity of the metrics query. :type time_grain: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_metrics.metadata['url'] + url = self.list_multi_role_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') if end_time is not None: @@ -1566,1089 +1582,1219 @@ def prepare_request(next_link=None): query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'} # type: ignore def list_multi_role_pool_skus( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SkuInfoCollection"] """Get available SKUs for scaling a multi-role pool. Get available SKUs for scaling a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SkuInfo - :rtype: - ~azure.mgmt.web.v2016_09_01.models.SkuInfoPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_skus.metadata['url'] + url = self.list_multi_role_pool_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SkuInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} # type: ignore def list_multi_role_usages( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UsageCollection"] """Get usage metrics for a multi-role pool of an App Service Environment. Get usage metrics for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Usage - :rtype: - ~azure.mgmt.web.v2016_09_01.models.UsagePaged[~azure.mgmt.web.v2016_09_01.models.Usage] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_usages.metadata['url'] + url = self.list_multi_role_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} # type: ignore def list_operations( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.Operation"] """List all currently running operations on the App Service Environment. List all currently running operations on the App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_09_01.models.Operation] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Operation, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.Operation] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_operations.metadata['url'] + url = self.list_operations.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[Operation]', response) + deserialized = self._deserialize('[Operation]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} + list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} # type: ignore def reboot( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reboot all machines in an App Service Environment. Reboot all machines in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.reboot.metadata['url'] + url = self.reboot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} + if cls: + return cls(pipeline_response, None, {}) + reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} # type: ignore def _resume_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.resume.metadata['url'] + url = self._resume_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def resume( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + def begin_resume( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Resume an App Service Environment. Resume an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_09_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._resume_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.resume.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - return deserialized + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if response.status_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 + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._resume_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore def list_app_service_plans( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans in an App Service Environment. Get all App Service plans in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServicePlanPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_app_service_plans.metadata['url'] + url = self.list_app_service_plans.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} # type: ignore def list_web_apps( - self, resource_group_name, name, properties_to_include=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + properties_to_include=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps in an App Service Environment. Get all apps in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param properties_to_include: Comma separated list of app properties - to include. + :param properties_to_include: Comma separated list of app properties to include. :type properties_to_include: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2016_09_01.models.SitePaged[~azure.mgmt.web.v2016_09_01.models.Site] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps.metadata['url'] + url = self.list_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if properties_to_include is not None: query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} # type: ignore def _suspend_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.suspend.metadata['url'] + url = self._suspend_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def suspend( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + def begin_suspend( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Suspend an App Service Environment. Suspend an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_09_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._suspend_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + if not next_link: + # Construct URL + url = self.suspend.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request - return deserialized + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_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 + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._suspend_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] """Get global usage metrics of an App Service Environment. Get global usage metrics of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuota] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} # type: ignore def list_worker_pools( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkerPoolCollection"] """Get all worker pools of an App Service Environment. Get all worker pools of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WorkerPoolResource - :rtype: - ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResourcePaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pools.metadata['url'] + url = self.list_worker_pools.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkerPoolCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkerPoolResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} # type: ignore def get_worker_pool( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Get properties of a worker pool. Get properties of a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_worker_pool.metadata['url'] + url = self.get_worker_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} - + get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def _create_or_update_worker_pool_initial( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_worker_pool.metadata['url'] + url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_worker_pool( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + def begin_create_or_update_worker_pool( + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WorkerPoolResource"] """Create or update a worker pool. Create or update a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str :param worker_pool_envelope: Properties of the worker pool. - :type worker_pool_envelope: - ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type worker_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkerPoolResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_worker_pool_initial( - resource_group_name=resource_group_name, - name=name, - worker_pool_name=worker_pool_name, - worker_pool_envelope=worker_pool_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkerPoolResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_worker_pool_initial( + resource_group_name=resource_group_name, + name=name, + worker_pool_name=worker_pool_name, + worker_pool_envelope=worker_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def update_worker_pool( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] """Create or update a worker pool. Create or update a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str :param worker_pool_envelope: Properties of the worker pool. - :type worker_pool_envelope: - ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type worker_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_worker_pool.metadata['url'] + url = self.update_worker_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} + update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def list_worker_pool_instance_metric_definitions( - self, resource_group_name, name, worker_pool_name, instance, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a specific instance of a worker pool of an - App Service Environment. - - Get metric definitions for a specific instance of a worker pool of an - App Service Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + instance, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -2656,82 +2802,83 @@ def list_worker_pool_instance_metric_definitions( :type worker_pool_name: str :param instance: Name of the instance in the worker pool. :type instance: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_instance_metric_definitions.metadata['url'] + url = self.list_worker_pool_instance_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} # type: ignore def list_worker_pool_instance_metrics( - self, resource_group_name, name, worker_pool_name, instance, details=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get metrics for a specific instance of a worker pool of an App Service - Environment. - - Get metrics for a specific instance of a worker pool of an App Service - Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + instance, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] + """Get metrics for a specific instance of a worker pool of an App Service Environment. + + Get metrics for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -2739,408 +2886,401 @@ def list_worker_pool_instance_metrics( :type worker_pool_name: str :param instance: Name of the instance in the worker pool. :type instance: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_instance_metrics.metadata['url'] + url = self.list_worker_pool_instance_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'} # type: ignore def list_web_worker_metric_definitions( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] """Get metric definitions for a worker pool of an App Service Environment. Get metric definitions for a worker pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_metric_definitions.metadata['url'] + url = self.list_web_worker_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} # type: ignore def list_web_worker_metrics( - self, resource_group_name, name, worker_pool_name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get metrics for a worker pool of a AppServiceEnvironment (App Service - Environment). - - Get metrics for a worker pool of a AppServiceEnvironment (App Service - Environment). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] + """Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param worker_pool_name: Name of worker pool + :param worker_pool_name: Name of worker pool. :type worker_pool_name: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_metrics.metadata['url'] + url = self.list_web_worker_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'} # type: ignore def list_worker_pool_skus( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SkuInfoCollection"] """Get available SKUs for scaling a worker pool. Get available SKUs for scaling a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SkuInfo - :rtype: - ~azure.mgmt.web.v2016_09_01.models.SkuInfoPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_skus.metadata['url'] + url = self.list_worker_pool_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SkuInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} # type: ignore def list_web_worker_usages( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UsageCollection"] """Get usage metrics for a worker pool of an App Service Environment. Get usage metrics for a worker pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Usage - :rtype: - ~azure.mgmt.web.v2016_09_01.models.UsagePaged[~azure.mgmt.web.v2016_09_01.models.Usage] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_usages.metadata['url'] + url = self.list_web_worker_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py index 3eb56a1d2c32..2aef22f98539 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py @@ -1,566 +1,579 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServicePlansOperations(object): """AppServicePlansOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2016_09_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. - :ivar api_version: API Version. Constant value: "2016-09-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-09-01" - - self.config = config + self._config = config def list( - self, detailed=None, custom_headers=None, raw=False, **operation_config): + self, + detailed=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans for a subscription. Get all App Service plans for a subscription. - :param detailed: Specify true to return all App Service - plan properties. The default is false, which returns a - subset of the properties. - Retrieval of all properties may increase the API latency. + :param detailed: Specify :code:`true` to return all App Service plan properties. + The default is :code:`false`, which returns a subset of the properties. + Retrieval of all properties may increase the API latency. :type detailed: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServicePlanPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if detailed is not None: query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans in a resource group. Get all App Service plans in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2016_09_01.models.AppServicePlanPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServicePlan"] """Get an App Service plan. Get an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServicePlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlan" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServicePlan" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + 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('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlan" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServicePlan"] """Creates or updates an App Service Plan. Creates or updates an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param app_service_plan: Details of the App Service plan. - :type app_service_plan: - ~azure.mgmt.web.v2016_09_01.models.AppServicePlan - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type app_service_plan: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns AppServicePlan or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2016_09_01.models.AppServicePlan]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServicePlan or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2016_09_01.models.AppServicePlan] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - app_service_plan=app_service_plan, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServicePlan', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + app_service_plan=app_service_plan, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + 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 + ) + 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.Web/serverfarms/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an App Service plan. Delete an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def update( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlanPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServicePlan" """Creates or updates an App Service Plan. Creates or updates an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param app_service_plan: Details of the App Service plan. - :type app_service_plan: - ~azure.mgmt.web.v2016_09_01.models.AppServicePlanPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServicePlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type app_service_plan: ~azure.mgmt.web.v2016_09_01.models.AppServicePlanPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServicePlan + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def list_capabilities( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.Capability"] """List all capabilities of an App Service plan. List all capabilities of an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_09_01.models.Capability] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Capability, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.Capability] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_capabilities.metadata['url'] + url = self.list_capabilities.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[Capability]', response) + deserialized = self._deserialize('[Capability]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} + list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} # type: ignore def get_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieve a Hybrid Connection in use in an App Service plan. Retrieve a Hybrid Connection in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -568,69 +581,65 @@ def get_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_hybrid_connection.metadata['url'] + url = self.get_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Hybrid Connection in use in an App Service plan. Delete a Hybrid Connection in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -638,61 +647,61 @@ def delete_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.delete_hybrid_connection.metadata['url'] + url = self.delete_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Get the send key name and value of a Hybrid Connection. Get the send key name and value of a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -700,69 +709,65 @@ def list_hybrid_connection_keys( :type namespace_name: str :param relay_name: The name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_hybrid_connection_keys.metadata['url'] + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_web_apps_by_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceCollection"] """Get all apps that use a Hybrid Connection in an App Service Plan. Get all apps that use a Hybrid Connection in an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -770,1032 +775,991 @@ def list_web_apps_by_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Hybrid Connection relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of str - :rtype: ~azure.mgmt.web.v2016_09_01.models.StrPaged[str] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps_by_hybrid_connection.metadata['url'] + url = self.list_web_apps_by_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StrPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} + return ItemPaged( + get_next, extract_data + ) + list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} # type: ignore def get_hybrid_connection_plan_limit( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the maximum number of Hybrid Connections allowed in an App Service - plan. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionLimits" + """Get the maximum number of Hybrid Connections allowed in an App Service plan. - Get the maximum number of Hybrid Connections allowed in an App Service - plan. + Get the maximum number of Hybrid Connections allowed in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionLimits or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnectionLimits or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionLimits, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.HybridConnectionLimits + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_hybrid_connection_plan_limit.metadata['url'] + url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('HybridConnectionLimits', response) + deserialized = self._deserialize('HybridConnectionLimits', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} + get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} # type: ignore def list_hybrid_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HybridConnectionCollection"] """Retrieve all Hybrid Connections in use in an App Service plan. Retrieve all Hybrid Connections in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HybridConnection - :rtype: - ~azure.mgmt.web.v2016_09_01.models.HybridConnectionPaged[~azure.mgmt.web.v2016_09_01.models.HybridConnection] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridConnectionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.HybridConnectionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_hybrid_connections.metadata['url'] + url = self.list_hybrid_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HybridConnectionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} + return ItemPaged( + get_next, extract_data + ) + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} # type: ignore def list_metric_defintions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get metrics that can be queried for an App Service plan, and their - definitions. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metrics that can be queried for an App Service plan, and their definitions. - Get metrics that can be queried for an App Service plan, and their - definitions. + Get metrics that can be queried for an App Service plan, and their definitions. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinition] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metric_defintions.metadata['url'] + url = self.list_metric_defintions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'} # type: ignore def list_metrics( - self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Get metrics for an App Service plan. Get metrics for an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and - timeGrain eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2016_09_01.models.ResourceMetricPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetric] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics.metadata['url'] + url = self.list_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'} # type: ignore def restart_web_apps( - self, resource_group_name, name, soft_restart=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + soft_restart=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restart all apps in an App Service plan. Restart all apps in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param soft_restart: Specify true to perform a soft - restart, applies the configuration settings and restarts the apps if - necessary. The default is false, which always restarts - and reprovisions the apps + :param soft_restart: Specify :code:`true` to perform a soft restart, applies the + configuration settings and restarts the apps if necessary. The default is + :code:`false`, which always restarts and reprovisions the apps. :type soft_restart: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.restart_web_apps.metadata['url'] + url = self.restart_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} + restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} # type: ignore def list_web_apps( - self, resource_group_name, name, skip_token=None, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + top=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps associated with an App Service plan. Get all apps associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param skip_token: Skip to a web app in the list of webapps associated - with app service plan. If specified, the resulting list will contain - web apps starting from (including) the skipToken. Otherwise, the - resulting list contains web apps from the start of the list + :param skip_token: Skip to a web app in the list of webapps associated with app service plan. + If specified, the resulting list will contain web apps starting from (including) the skipToken. + Otherwise, the resulting list contains web apps from the start of the list. :type skip_token: str - :param filter: Supported filter: $filter=state eq running. Returns - only web apps that are currently running + :param filter: Supported filter: $filter=state eq running. Returns only web apps that are + currently running. :type filter: str :param top: List page size. If specified, results are paged. :type top: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2016_09_01.models.SitePaged[~azure.mgmt.web.v2016_09_01.models.Site] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps.metadata['url'] + url = self.list_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} + return ItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} # type: ignore def get_server_farm_skus( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> object """Gets all selectable SKUs for a given App Service Plan. Gets all selectable SKUs for a given App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of App Service Plan + :param name: Name of App Service Plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_server_farm_skus.metadata['url'] + url = self.get_server_farm_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} + get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] """Gets server farm usage information. Gets server farm usage information. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of App Service Plan + :param name: Name of App Service Plan. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2'). + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuota] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} # type: ignore def list_vnets( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Get all Virtual Networks associated with an App Service plan. Get all Virtual Networks associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_vnets.metadata['url'] + url = self.list_vnets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} + list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} # type: ignore def get_vnet_from_server_farm( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetInfo"] """Get a Virtual Network associated with an App Service plan. Get a Virtual Network associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_vnet_from_server_farm.metadata['url'] + url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} + get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_gateway( - self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" """Get a Virtual Network gateway. Get a Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Only the 'primary' gateway - is supported. + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. :type gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_vnet_gateway.metadata['url'] + url = self.get_vnet_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" """Update a Virtual Network gateway. Update a Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Only the 'primary' gateway - is supported. + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. :type gateway_name: str :param connection_envelope: Definition of the gateway. - :type connection_envelope: - ~azure.mgmt.web.v2016_09_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type connection_envelope: ~azure.mgmt.web.v2016_09_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_gateway.metadata['url'] + url = self.update_vnet_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_routes_for_vnet( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Get all routes that are associated with a Virtual Network in an App - Service plan. - - Get all routes that are associated with a Virtual Network in an App - Service plan. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetRoute"] + """Get all routes that are associated with a Virtual Network in an App Service plan. + + Get all routes that are associated with a Virtual Network in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.list_routes_for_vnet.metadata['url'] + url = self.list_routes_for_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[VnetRoute]', response) + deserialized = self._deserialize('[VnetRoute]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} + list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} # type: ignore def get_route_for_vnet( - self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[List["models.VnetRoute"]] """Get a Virtual Network route in an App Service plan. Get a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1803,69 +1767,68 @@ def get_route_for_vnet( :type vnet_name: str :param route_name: Name of the Virtual Network route. :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2016_09_01.models.VnetRoute] or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.get_route_for_vnet.metadata['url'] + url = self.get_route_for_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[VnetRoute]', response) + deserialized = self._deserialize('[VnetRoute]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def create_or_update_vnet_route( - self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + route, # type: "models.VnetRoute" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetRoute"] """Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1875,73 +1838,73 @@ def create_or_update_vnet_route( :type route_name: str :param route: Definition of the Virtual Network route. :type route: ~azure.mgmt.web.v2016_09_01.models.VnetRoute - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetRoute or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetRoute or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_route.metadata['url'] + url = self.create_or_update_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 400, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetRoute', response) + deserialized = self._deserialize('VnetRoute', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def delete_vnet_route( - self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Virtual Network route in an App Service plan. Delete a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1949,61 +1912,62 @@ def delete_vnet_route( :type vnet_name: str :param route_name: Name of the Virtual Network route. :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.delete_vnet_route.metadata['url'] + url = self.delete_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def update_vnet_route( - self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + route, # type: "models.VnetRoute" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetRoute"] """Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -2013,121 +1977,113 @@ def update_vnet_route( :type route_name: str :param route: Definition of the Virtual Network route. :type route: ~azure.mgmt.web.v2016_09_01.models.VnetRoute - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetRoute or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetRoute or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2016_09_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_route.metadata['url'] + url = self.update_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 400, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetRoute', response) + deserialized = self._deserialize('VnetRoute', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def reboot_worker( - self, resource_group_name, name, worker_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reboot a worker machine in an App Service plan. Reboot a worker machine in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param worker_name: Name of worker machine, which typically starts - with RD. + :param worker_name: Name of worker machine, which typically starts with RD. :type worker_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-09-01" + # Construct URL - url = self.reboot_worker.metadata['url'] + url = self.reboot_worker.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerName': self._serialize.url("worker_name", worker_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} + 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, {}) + + reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py index b96e0933169e..9f338026cff6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2018-02-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json new file mode 100644 index 000000000000..291d81148549 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json @@ -0,0 +1,275 @@ +{ + "chosen_version": "2018-02-01", + "total_api_version_list": ["2018-02-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "app_service_certificate_orders": "AppServiceCertificateOrdersOperations", + "certificate_registration_provider": "CertificateRegistrationProviderOperations", + "domains": "DomainsOperations", + "top_level_domains": "TopLevelDomainsOperations", + "domain_registration_provider": "DomainRegistrationProviderOperations", + "certificates": "CertificatesOperations", + "deleted_web_apps": "DeletedWebAppsOperations", + "diagnostics": "DiagnosticsOperations", + "provider": "ProviderOperations", + "recommendations": "RecommendationsOperations", + "web_apps": "WebAppsOperations", + "app_service_environments": "AppServiceEnvironmentsOperations", + "app_service_plans": "AppServicePlansOperations", + "resource_health_metadata": "ResourceHealthMetadataOperations" + }, + "operation_mixins": { + "get_publishing_user" : { + "sync": { + "signature": "def get_publishing_user(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets publishing user.\n\nGets publishing user.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_publishing_user(\n self,\n **kwargs\n) -\u003e \"models.User\":\n", + "doc": "\"\"\"Gets publishing user.\n\nGets publishing user.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "update_publishing_user" : { + "sync": { + "signature": "def update_publishing_user(\n self,\n user_details, # type: \"models.User\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates publishing user.\n\nUpdates publishing user.\n\n:param user_details: Details of publishing user.\n:type user_details: ~azure.mgmt.web.v2018_02_01.models.User\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_publishing_user(\n self,\n user_details: \"models.User\",\n **kwargs\n) -\u003e \"models.User\":\n", + "doc": "\"\"\"Updates publishing user.\n\nUpdates publishing user.\n\n:param user_details: Details of publishing user.\n:type user_details: ~azure.mgmt.web.v2018_02_01.models.User\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "user_details" + }, + "list_source_controls" : { + "sync": { + "signature": "def list_source_controls(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the source controls available for Azure websites.\n\nGets the source controls available for Azure websites.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SourceControlCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SourceControlCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_source_controls(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SourceControlCollection\"]:\n", + "doc": "\"\"\"Gets the source controls available for Azure websites.\n\nGets the source controls available for Azure websites.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SourceControlCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SourceControlCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "get_source_control" : { + "sync": { + "signature": "def get_source_control(\n self,\n source_control_type, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets source control token.\n\nGets source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_source_control(\n self,\n source_control_type: str,\n **kwargs\n) -\u003e \"models.SourceControl\":\n", + "doc": "\"\"\"Gets source control token.\n\nGets source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "source_control_type" + }, + "update_source_control" : { + "sync": { + "signature": "def update_source_control(\n self,\n source_control_type, # type: str\n request_message, # type: \"models.SourceControl\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates source control token.\n\nUpdates source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:param request_message: Source control token information.\n:type request_message: ~azure.mgmt.web.v2018_02_01.models.SourceControl\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_source_control(\n self,\n source_control_type: str,\n request_message: \"models.SourceControl\",\n **kwargs\n) -\u003e \"models.SourceControl\":\n", + "doc": "\"\"\"Updates source control token.\n\nUpdates source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:param request_message: Source control token information.\n:type request_message: ~azure.mgmt.web.v2018_02_01.models.SourceControl\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "source_control_type, request_message" + }, + "list_billing_meters" : { + "sync": { + "signature": "def list_billing_meters(\n self,\n billing_location=None, # type: Optional[str]\n os_type=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets a list of meters for a given location.\n\nGets a list of meters for a given location.\n\n:param billing_location: Azure Location of billable resource.\n:type billing_location: str\n:param os_type: App Service OS type meters used for.\n:type os_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BillingMeterCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.BillingMeterCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_billing_meters(\n self,\n billing_location: Optional[str] = None,\n os_type: Optional[str] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.BillingMeterCollection\"]:\n", + "doc": "\"\"\"Gets a list of meters for a given location.\n\nGets a list of meters for a given location.\n\n:param billing_location: Azure Location of billable resource.\n:type billing_location: str\n:param os_type: App Service OS type meters used for.\n:type os_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BillingMeterCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.BillingMeterCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "billing_location, os_type" + }, + "check_name_availability" : { + "sync": { + "signature": "def check_name_availability(\n self,\n name, # type: str\n type, # type: Union[str, \"models.CheckNameResourceTypes\"]\n is_fqdn=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Check if a resource name is available.\n\nCheck if a resource name is available.\n\n:param name: Resource name to verify.\n:type name: str\n:param type: Resource type used for verification.\n:type type: str or ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes\n:param is_fqdn: Is fully qualified domain name.\n:type is_fqdn: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceNameAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceNameAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_name_availability(\n self,\n name: str,\n type: Union[str, \"models.CheckNameResourceTypes\"],\n is_fqdn: Optional[bool] = None,\n **kwargs\n) -\u003e \"models.ResourceNameAvailability\":\n", + "doc": "\"\"\"Check if a resource name is available.\n\nCheck if a resource name is available.\n\n:param name: Resource name to verify.\n:type name: str\n:param type: Resource type used for verification.\n:type type: str or ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes\n:param is_fqdn: Is fully qualified domain name.\n:type is_fqdn: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceNameAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceNameAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "name, type, is_fqdn" + }, + "get_subscription_deployment_locations" : { + "sync": { + "signature": "def get_subscription_deployment_locations(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets list of available geo regions plus ministamps.\n\nGets list of available geo regions plus ministamps.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeploymentLocations, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.DeploymentLocations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_subscription_deployment_locations(\n self,\n **kwargs\n) -\u003e \"models.DeploymentLocations\":\n", + "doc": "\"\"\"Gets list of available geo regions plus ministamps.\n\nGets list of available geo regions plus ministamps.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeploymentLocations, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.DeploymentLocations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "list_geo_regions" : { + "sync": { + "signature": "def list_geo_regions(\n self,\n sku=None, # type: Optional[Union[str, \"models.SkuName\"]]\n linux_workers_enabled=None, # type: Optional[bool]\n xenon_workers_enabled=None, # type: Optional[bool]\n linux_dynamic_workers_enabled=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get a list of available geographical regions.\n\nGet a list of available geographical regions.\n\n:param sku: Name of SKU used to filter the regions.\n:type sku: str or ~azure.mgmt.web.v2018_02_01.models.SkuName\n:param linux_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Linux workers.\n:type linux_workers_enabled: bool\n:param xenon_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Xenon workers.\n:type xenon_workers_enabled: bool\n:param linux_dynamic_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter\n to only regions that support Linux Consumption Workers.\n:type linux_dynamic_workers_enabled: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either GeoRegionCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.GeoRegionCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_geo_regions(\n self,\n sku: Optional[Union[str, \"models.SkuName\"]] = None,\n linux_workers_enabled: Optional[bool] = None,\n xenon_workers_enabled: Optional[bool] = None,\n linux_dynamic_workers_enabled: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.GeoRegionCollection\"]:\n", + "doc": "\"\"\"Get a list of available geographical regions.\n\nGet a list of available geographical regions.\n\n:param sku: Name of SKU used to filter the regions.\n:type sku: str or ~azure.mgmt.web.v2018_02_01.models.SkuName\n:param linux_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Linux workers.\n:type linux_workers_enabled: bool\n:param xenon_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Xenon workers.\n:type xenon_workers_enabled: bool\n:param linux_dynamic_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter\n to only regions that support Linux Consumption Workers.\n:type linux_dynamic_workers_enabled: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either GeoRegionCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.GeoRegionCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "sku, linux_workers_enabled, xenon_workers_enabled, linux_dynamic_workers_enabled" + }, + "list_site_identifiers_assigned_to_host_name" : { + "sync": { + "signature": "def list_site_identifiers_assigned_to_host_name(\n self,\n name_identifier, # type: \"models.NameIdentifier\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all apps that are assigned to a hostname.\n\nList all apps that are assigned to a hostname.\n\n:param name_identifier: Hostname information.\n:type name_identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either IdentifierCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_site_identifiers_assigned_to_host_name(\n self,\n name_identifier: \"models.NameIdentifier\",\n **kwargs\n) -\u003e AsyncItemPaged[\"models.IdentifierCollection\"]:\n", + "doc": "\"\"\"List all apps that are assigned to a hostname.\n\nList all apps that are assigned to a hostname.\n\n:param name_identifier: Hostname information.\n:type name_identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either IdentifierCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "name_identifier" + }, + "list_premier_add_on_offers" : { + "sync": { + "signature": "def list_premier_add_on_offers(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all premier add-on offers.\n\nList all premier add-on offers.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOfferCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_premier_add_on_offers(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PremierAddOnOfferCollection\"]:\n", + "doc": "\"\"\"List all premier add-on offers.\n\nList all premier add-on offers.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOfferCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "list_skus" : { + "sync": { + "signature": "def list_skus(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all SKUs.\n\nList all SKUs.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuInfos, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.SkuInfos\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def list_skus(\n self,\n **kwargs\n) -\u003e \"models.SkuInfos\":\n", + "doc": "\"\"\"List all SKUs.\n\nList all SKUs.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuInfos, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.SkuInfos\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "verify_hosting_environment_vnet" : { + "sync": { + "signature": "def verify_hosting_environment_vnet(\n self,\n parameters, # type: \"models.VnetParameters\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.\n\nVerifies if this VNET is compatible with an App Service Environment by analyzing the Network\nSecurity Group rules.\n\n:param parameters: VNET information.\n:type parameters: ~azure.mgmt.web.v2018_02_01.models.VnetParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VnetValidationFailureDetails, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.VnetValidationFailureDetails\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def verify_hosting_environment_vnet(\n self,\n parameters: \"models.VnetParameters\",\n **kwargs\n) -\u003e \"models.VnetValidationFailureDetails\":\n", + "doc": "\"\"\"Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.\n\nVerifies if this VNET is compatible with an App Service Environment by analyzing the Network\nSecurity Group rules.\n\n:param parameters: VNET information.\n:type parameters: ~azure.mgmt.web.v2018_02_01.models.VnetParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VnetValidationFailureDetails, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.VnetValidationFailureDetails\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "parameters" + }, + "move" : { + "sync": { + "signature": "def move(\n self,\n resource_group_name, # type: str\n move_resource_envelope, # type: \"models.CsmMoveResourceEnvelope\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Move resources between resource groups.\n\nMove resources between resource groups.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def move(\n self,\n resource_group_name: str,\n move_resource_envelope: \"models.CsmMoveResourceEnvelope\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Move resources between resource groups.\n\nMove resources between resource groups.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, move_resource_envelope" + }, + "validate" : { + "sync": { + "signature": "def validate(\n self,\n resource_group_name, # type: str\n validate_request, # type: \"models.ValidateRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate if a resource can be created.\n\nValidate if a resource can be created.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_request: Request with the resources to validate.\n:type validate_request: ~azure.mgmt.web.v2018_02_01.models.ValidateRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.ValidateResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate(\n self,\n resource_group_name: str,\n validate_request: \"models.ValidateRequest\",\n **kwargs\n) -\u003e \"models.ValidateResponse\":\n", + "doc": "\"\"\"Validate if a resource can be created.\n\nValidate if a resource can be created.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_request: Request with the resources to validate.\n:type validate_request: ~azure.mgmt.web.v2018_02_01.models.ValidateRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2018_02_01.models.ValidateResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, validate_request" + }, + "validate_container_settings" : { + "sync": { + "signature": "def validate_container_settings(\n self,\n resource_group_name, # type: str\n validate_container_settings_request, # type: \"models.ValidateContainerSettingsRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate if the container settings are correct.\n\nValidate if the container settings are correct.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_container_settings_request:\n:type validate_container_settings_request: ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: object, or the result of cls(response)\n:rtype: object\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate_container_settings(\n self,\n resource_group_name: str,\n validate_container_settings_request: \"models.ValidateContainerSettingsRequest\",\n **kwargs\n) -\u003e object:\n", + "doc": "\"\"\"Validate if the container settings are correct.\n\nValidate if the container settings are correct.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_container_settings_request:\n:type validate_container_settings_request: ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: object, or the result of cls(response)\n:rtype: object\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, validate_container_settings_request" + }, + "validate_move" : { + "sync": { + "signature": "def validate_move(\n self,\n resource_group_name, # type: str\n move_resource_envelope, # type: \"models.CsmMoveResourceEnvelope\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate whether a resource can be moved.\n\nValidate whether a resource can be moved.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate_move(\n self,\n resource_group_name: str,\n move_resource_envelope: \"models.CsmMoveResourceEnvelope\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Validate whether a resource can be moved.\n\nValidate whether a resource can be moved.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, move_resource_envelope" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py index 4180ebdb5d7a..d322680c76e8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py @@ -1,19 +1,23 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration -from .operations import WebSiteManagementClientOperationsMixin from .operations import AppServiceCertificateOrdersOperations from .operations import CertificateRegistrationProviderOperations from .operations import DomainsOperations @@ -24,6 +28,7 @@ from .operations import DiagnosticsOperations from .operations import ProviderOperations from .operations import RecommendationsOperations +from .operations import WebSiteManagementClientOperationsMixin from .operations import WebAppsOperations from .operations import AppServiceEnvironmentsOperations from .operations import AppServicePlansOperations @@ -31,86 +36,100 @@ from . import models -class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, SDKClient): - """WebSite Management Client - - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): + """WebSite Management Client. - :ivar app_service_certificate_orders: AppServiceCertificateOrders operations + :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations :vartype app_service_certificate_orders: azure.mgmt.web.v2018_02_01.operations.AppServiceCertificateOrdersOperations - :ivar certificate_registration_provider: CertificateRegistrationProvider operations + :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations :vartype certificate_registration_provider: azure.mgmt.web.v2018_02_01.operations.CertificateRegistrationProviderOperations - :ivar domains: Domains operations + :ivar domains: DomainsOperations operations :vartype domains: azure.mgmt.web.v2018_02_01.operations.DomainsOperations - :ivar top_level_domains: TopLevelDomains operations + :ivar top_level_domains: TopLevelDomainsOperations operations :vartype top_level_domains: azure.mgmt.web.v2018_02_01.operations.TopLevelDomainsOperations - :ivar domain_registration_provider: DomainRegistrationProvider operations + :ivar domain_registration_provider: DomainRegistrationProviderOperations operations :vartype domain_registration_provider: azure.mgmt.web.v2018_02_01.operations.DomainRegistrationProviderOperations - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.web.v2018_02_01.operations.CertificatesOperations - :ivar deleted_web_apps: DeletedWebApps operations + :ivar deleted_web_apps: DeletedWebAppsOperations operations :vartype deleted_web_apps: azure.mgmt.web.v2018_02_01.operations.DeletedWebAppsOperations - :ivar diagnostics: Diagnostics operations + :ivar diagnostics: DiagnosticsOperations operations :vartype diagnostics: azure.mgmt.web.v2018_02_01.operations.DiagnosticsOperations - :ivar provider: Provider operations + :ivar provider: ProviderOperations operations :vartype provider: azure.mgmt.web.v2018_02_01.operations.ProviderOperations - :ivar recommendations: Recommendations operations + :ivar recommendations: RecommendationsOperations operations :vartype recommendations: azure.mgmt.web.v2018_02_01.operations.RecommendationsOperations - :ivar web_apps: WebApps operations + :ivar web_apps: WebAppsOperations operations :vartype web_apps: azure.mgmt.web.v2018_02_01.operations.WebAppsOperations - :ivar app_service_environments: AppServiceEnvironments operations + :ivar app_service_environments: AppServiceEnvironmentsOperations operations :vartype app_service_environments: azure.mgmt.web.v2018_02_01.operations.AppServiceEnvironmentsOperations - :ivar app_service_plans: AppServicePlans operations + :ivar app_service_plans: AppServicePlansOperations operations :vartype app_service_plans: azure.mgmt.web.v2018_02_01.operations.AppServicePlansOperations - :ivar resource_health_metadata: ResourceHealthMetadata operations + :ivar resource_health_metadata: ResourceHealthMetadataOperations operations :vartype resource_health_metadata: azure.mgmt.web.v2018_02_01.operations.ResourceHealthMetadataOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2018-02-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.app_service_certificate_orders = AppServiceCertificateOrdersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificate_registration_provider = CertificateRegistrationProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.domains = DomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.top_level_domains = TopLevelDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.domain_registration_provider = DomainRegistrationProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deleted_web_apps = DeletedWebAppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.diagnostics = DiagnosticsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.provider = ProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.recommendations = RecommendationsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.web_apps = WebAppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.app_service_environments = AppServiceEnvironmentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.app_service_plans = AppServicePlansOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.resource_health_metadata = ResourceHealthMetadataOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py new file mode 100644 index 000000000000..e19d910addc6 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-02-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..d0a2d875a28b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import AppServiceCertificateOrdersOperations +from .operations_async import CertificateRegistrationProviderOperations +from .operations_async import DomainsOperations +from .operations_async import TopLevelDomainsOperations +from .operations_async import DomainRegistrationProviderOperations +from .operations_async import CertificatesOperations +from .operations_async import DeletedWebAppsOperations +from .operations_async import DiagnosticsOperations +from .operations_async import ProviderOperations +from .operations_async import RecommendationsOperations +from .operations_async import WebSiteManagementClientOperationsMixin +from .operations_async import WebAppsOperations +from .operations_async import AppServiceEnvironmentsOperations +from .operations_async import AppServicePlansOperations +from .operations_async import ResourceHealthMetadataOperations +from .. import models + + +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): + """WebSite Management Client. + + :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations + :vartype app_service_certificate_orders: azure.mgmt.web.v2018_02_01.aio.operations_async.AppServiceCertificateOrdersOperations + :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations + :vartype certificate_registration_provider: azure.mgmt.web.v2018_02_01.aio.operations_async.CertificateRegistrationProviderOperations + :ivar domains: DomainsOperations operations + :vartype domains: azure.mgmt.web.v2018_02_01.aio.operations_async.DomainsOperations + :ivar top_level_domains: TopLevelDomainsOperations operations + :vartype top_level_domains: azure.mgmt.web.v2018_02_01.aio.operations_async.TopLevelDomainsOperations + :ivar domain_registration_provider: DomainRegistrationProviderOperations operations + :vartype domain_registration_provider: azure.mgmt.web.v2018_02_01.aio.operations_async.DomainRegistrationProviderOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.web.v2018_02_01.aio.operations_async.CertificatesOperations + :ivar deleted_web_apps: DeletedWebAppsOperations operations + :vartype deleted_web_apps: azure.mgmt.web.v2018_02_01.aio.operations_async.DeletedWebAppsOperations + :ivar diagnostics: DiagnosticsOperations operations + :vartype diagnostics: azure.mgmt.web.v2018_02_01.aio.operations_async.DiagnosticsOperations + :ivar provider: ProviderOperations operations + :vartype provider: azure.mgmt.web.v2018_02_01.aio.operations_async.ProviderOperations + :ivar recommendations: RecommendationsOperations operations + :vartype recommendations: azure.mgmt.web.v2018_02_01.aio.operations_async.RecommendationsOperations + :ivar web_apps: WebAppsOperations operations + :vartype web_apps: azure.mgmt.web.v2018_02_01.aio.operations_async.WebAppsOperations + :ivar app_service_environments: AppServiceEnvironmentsOperations operations + :vartype app_service_environments: azure.mgmt.web.v2018_02_01.aio.operations_async.AppServiceEnvironmentsOperations + :ivar app_service_plans: AppServicePlansOperations operations + :vartype app_service_plans: azure.mgmt.web.v2018_02_01.aio.operations_async.AppServicePlansOperations + :ivar resource_health_metadata: ResourceHealthMetadataOperations operations + :vartype resource_health_metadata: azure.mgmt.web.v2018_02_01.aio.operations_async.ResourceHealthMetadataOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificate_registration_provider = CertificateRegistrationProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.domains = DomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.top_level_domains = TopLevelDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.domain_registration_provider = DomainRegistrationProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deleted_web_apps = DeletedWebAppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostics = DiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.provider = ProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.recommendations = RecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_apps = WebAppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.app_service_environments = AppServiceEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.app_service_plans = AppServicePlansOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_health_metadata = ResourceHealthMetadataOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..6de2329231bb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_service_certificate_orders_operations_async import AppServiceCertificateOrdersOperations +from ._certificate_registration_provider_operations_async import CertificateRegistrationProviderOperations +from ._domains_operations_async import DomainsOperations +from ._top_level_domains_operations_async import TopLevelDomainsOperations +from ._domain_registration_provider_operations_async import DomainRegistrationProviderOperations +from ._certificates_operations_async import CertificatesOperations +from ._deleted_web_apps_operations_async import DeletedWebAppsOperations +from ._diagnostics_operations_async import DiagnosticsOperations +from ._provider_operations_async import ProviderOperations +from ._recommendations_operations_async import RecommendationsOperations +from ._web_site_management_client_operations_async import WebSiteManagementClientOperationsMixin +from ._web_apps_operations_async import WebAppsOperations +from ._app_service_environments_operations_async import AppServiceEnvironmentsOperations +from ._app_service_plans_operations_async import AppServicePlansOperations +from ._resource_health_metadata_operations_async import ResourceHealthMetadataOperations + +__all__ = [ + 'AppServiceCertificateOrdersOperations', + 'CertificateRegistrationProviderOperations', + 'DomainsOperations', + 'TopLevelDomainsOperations', + 'DomainRegistrationProviderOperations', + 'CertificatesOperations', + 'DeletedWebAppsOperations', + 'DiagnosticsOperations', + 'ProviderOperations', + 'RecommendationsOperations', + 'WebSiteManagementClientOperationsMixin', + 'WebAppsOperations', + 'AppServiceEnvironmentsOperations', + 'AppServicePlansOperations', + 'ResourceHealthMetadataOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py new file mode 100644 index 000000000000..0d2297aeca88 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py @@ -0,0 +1,1411 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServiceCertificateOrdersOperations: + """AppServiceCertificateOrdersOperations 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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateOrderCollection"]: + """List all certificate orders in a subscription. + + List all certificate orders 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 AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('AppServiceCertificateOrderCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore + + async def validate_purchase_information( + self, + app_service_certificate_order: "models.AppServiceCertificateOrder", + **kwargs + ) -> None: + """Validate information for a certificate order. + + Validate information for a certificate order. + + :param app_service_certificate_order: Information for a certificate order. + :type app_service_certificate_order: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_purchase_information.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') + 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 [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, {}) + + validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateOrderCollection"]: + """Get certificate orders in a resource group. + + Get certificate orders in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServiceCertificateOrderCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore + + async def get( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> "models.AppServiceCertificateOrder": + """Get a certificate order. + + Get a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order.. + :type certificate_order_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrder", + **kwargs + ) -> "models.AppServiceCertificateOrder": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrder", + **kwargs + ) -> AsyncLROPoller["models.AppServiceCertificateOrder"]: + """Create or update a certificate purchase order. + + Create or update a certificate purchase order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceCertificateOrder or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + lro_delay = kwargs.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, + certificate_order_name=certificate_order_name, + certificate_distinguished_name=certificate_distinguished_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Delete an existing certificate order. + + Delete an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrderPatchResource", + **kwargs + ) -> "models.AppServiceCertificateOrder": + """Create or update a certificate purchase order. + + Create or update a certificate purchase order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + def list_certificates( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateCollection"]: + """List all certificates associated with a certificate order. + + List all certificates associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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: + 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('AppServiceCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} # type: ignore + + async def get_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + **kwargs + ) -> "models.AppServiceCertificateResource": + """Get the certificate associated with a certificate order. + + Get the certificate associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def _create_or_update_certificate_initial( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificateResource", + **kwargs + ) -> "models.AppServiceCertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def begin_create_or_update_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificateResource", + **kwargs + ) -> AsyncLROPoller["models.AppServiceCertificateResource"]: + """Creates or updates a certificate and associates with key vault secret. + + Creates or updates a certificate and associates with key vault secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :param key_vault_certificate: Key vault certificate resource Id. + :type key_vault_certificate: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceCertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + lro_delay = kwargs.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_certificate_initial( + resource_group_name=resource_group_name, + certificate_order_name=certificate_order_name, + name=name, + key_vault_certificate=key_vault_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def delete_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + **kwargs + ) -> None: + """Delete the certificate associated with a certificate order. + + Delete the certificate associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def update_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificatePatchResource", + **kwargs + ) -> "models.AppServiceCertificateResource": + """Creates or updates a certificate and associates with key vault secret. + + Creates or updates a certificate and associates with key vault secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :param key_vault_certificate: Key vault certificate resource Id. + :type key_vault_certificate: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def reissue( + self, + resource_group_name: str, + certificate_order_name: str, + reissue_certificate_order_request: "models.ReissueCertificateOrderRequest", + **kwargs + ) -> None: + """Reissue an existing certificate order. + + Reissue an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param reissue_certificate_order_request: Parameters for the reissue. + :type reissue_certificate_order_request: ~azure.mgmt.web.v2018_02_01.models.ReissueCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.reissue.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') + 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 [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, {}) + + reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} # type: ignore + + async def renew( + self, + resource_group_name: str, + certificate_order_name: str, + renew_certificate_order_request: "models.RenewCertificateOrderRequest", + **kwargs + ) -> None: + """Renew an existing certificate order. + + Renew an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param renew_certificate_order_request: Renew parameters. + :type renew_certificate_order_request: ~azure.mgmt.web.v2018_02_01.models.RenewCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.renew.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') + 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 [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, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} # type: ignore + + async def resend_email( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Resend certificate email. + + Resend certificate email. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.resend_email.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} # type: ignore + + async def resend_request_emails( + self, + resource_group_name: str, + certificate_order_name: str, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> None: + """Verify domain ownership for this certificate order. + + Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name_identifier: Email address. + :type name_identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.resend_request_emails.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + 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 [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, {}) + + resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} # type: ignore + + async def retrieve_site_seal( + self, + resource_group_name: str, + certificate_order_name: str, + site_seal_request: "models.SiteSealRequest", + **kwargs + ) -> "models.SiteSeal": + """Verify domain ownership for this certificate order. + + Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param site_seal_request: Site seal request. + :type site_seal_request: ~azure.mgmt.web.v2018_02_01.models.SiteSealRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSeal, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSeal + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.retrieve_site_seal.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteSeal', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} # type: ignore + + async def verify_domain_ownership( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Verify domain ownership for this certificate order. + + Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.verify_domain_ownership.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} # type: ignore + + async def retrieve_certificate_actions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.CertificateOrderAction"]: + """Retrieve the list of certificate actions. + + Retrieve the list of certificate actions. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate order. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateOrderAction, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.CertificateOrderAction] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.retrieve_certificate_actions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[CertificateOrderAction]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} # type: ignore + + async def retrieve_certificate_email_history( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.CertificateEmail"]: + """Retrieve email history. + + Retrieve email history. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate order. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateEmail, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.CertificateEmail] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[CertificateEmail]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py new file mode 100644 index 000000000000..25b35b46b051 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py @@ -0,0 +1,3603 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServiceEnvironmentsOperations: + """AppServiceEnvironmentsOperations 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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AppServiceEnvironmentCollection"]: + """Get all App Service Environments for a subscription. + + Get all App Service Environments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('AppServiceEnvironmentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceEnvironmentCollection"]: + """Get all App Service Environments in a resource group. + + Get all App Service Environments in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServiceEnvironmentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AppServiceEnvironmentResource": + """Get the properties of an App Service Environment. + + Get the properties of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentResource", + **kwargs + ) -> Optional["models.AppServiceEnvironmentResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') + 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, 400, 404, 409]: + 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('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentResource", + **kwargs + ) -> AsyncLROPoller["models.AppServiceEnvironmentResource"]: + """Create or update an App Service Environment. + + Create or update an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceEnvironmentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + lro_delay = kwargs.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, + name=name, + hosting_environment_envelope=hosting_environment_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/hostingEnvironments/{name}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + name: str, + force_delete: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if force_delete is not None: + query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 400, 404, 409]: + 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.Web/hostingEnvironments/{name}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + name: str, + force_delete: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete an App Service Environment. + + Delete an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param force_delete: Specify :code:`true` to force the deletion even if the App + Service Environment contains resources. The default is :code:`false`. + :type force_delete: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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, + name=name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentPatchResource", + **kwargs + ) -> Optional["models.AppServiceEnvironmentResource"]: + """Create or update an App Service Environment. + + Create or update an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') + 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, 400, 404, 409]: + 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('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def list_capacities( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.StampCapacityCollection"]: + """Get the used, available, and total worker capacity an App Service Environment. + + Get the used, available, and total worker capacity an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StampCapacityCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.StampCapacityCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_capacities.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('StampCapacityCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} # type: ignore + + async def list_vips( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AddressResponse": + """Get IP addresses assigned to an App Service Environment. + + Get IP addresses assigned to an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AddressResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_vips.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AddressResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} # type: ignore + + async def _change_vnet_initial( + self, + resource_group_name: str, + name: str, + vnet_info: "models.VirtualNetworkProfile", + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._change_vnet_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _change_vnet_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore + + async def begin_change_vnet( + self, + resource_group_name: str, + name: str, + vnet_info: "models.VirtualNetworkProfile", + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Move an App Service Environment to a different VNET. + + Move an App Service Environment to a different VNET. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param vnet_info: Details for the new virtual network. + :type vnet_info: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.change_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._change_vnet_initial( + resource_group_name=resource_group_name, + name=name, + vnet_info=vnet_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_change_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore + + async def list_diagnostics( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.HostingEnvironmentDiagnostics"]: + """Get diagnostic information for an App Service Environment. + + Get diagnostic information for an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDiagnostics] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_diagnostics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} # type: ignore + + async def get_diagnostics_item( + self, + resource_group_name: str, + name: str, + diagnostics_name: str, + **kwargs + ) -> "models.HostingEnvironmentDiagnostics": + """Get a diagnostics item for an App Service Environment. + + Get a diagnostics item for an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param diagnostics_name: Name of the diagnostics item. + :type diagnostics_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDiagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_diagnostics_item.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} # type: ignore + + def get_inbound_network_dependencies_endpoints( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.InboundEnvironmentEndpointCollection"]: + """Get the network endpoints of all inbound dependencies of an App Service Environment. + + Get the network endpoints of all inbound dependencies of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.InboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_inbound_network_dependencies_endpoints.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('InboundEnvironmentEndpointCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_inbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints'} # type: ignore + + async def list_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MetricDefinition": + """Get global metric definitions of an App Service Environment. + + Get global metric definitions of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetricDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MetricDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MetricDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'} # type: ignore + + def list_metrics( + self, + resource_group_name: str, + name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get global metrics of an App Service Environment. + + Get global metrics of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'} # type: ignore + + def list_multi_role_pools( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WorkerPoolCollection"]: + """Get all multi-role pools. + + Get all multi-role pools. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pools.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WorkerPoolCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} # type: ignore + + async def get_multi_role_pool( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WorkerPoolResource": + """Get properties of a multi-role pool. + + Get properties of a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_multi_role_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def _create_or_update_multi_role_pool_initial( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def begin_create_or_update_multi_role_pool( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> AsyncLROPoller["models.WorkerPoolResource"]: + """Create or update a multi-role pool. + + Create or update a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param multi_role_pool_envelope: Properties of the multi-role pool. + :type multi_role_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.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_multi_role_pool_initial( + resource_group_name=resource_group_name, + name=name, + multi_role_pool_envelope=multi_role_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def update_multi_role_pool( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + """Create or update a multi-role pool. + + Create or update a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param multi_role_pool_envelope: Properties of the multi-role pool. + :type multi_role_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_multi_role_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + def list_multi_role_pool_instance_metric_definitions( + self, + resource_group_name: str, + name: str, + instance: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + + Get metric definitions for a specific instance of a multi-role pool of an App Service + Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param instance: Name of the instance in the multi-role pool. + :type instance: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} # type: ignore + + def list_multi_role_pool_instance_metrics( + self, + resource_group_name: str, + name: str, + instance: str, + details: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param instance: Name of the instance in the multi-role pool. + :type instance: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_instance_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'} # type: ignore + + def list_multi_role_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a multi-role pool of an App Service Environment. + + Get metric definitions for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} # type: ignore + + def list_multi_role_metrics( + self, + resource_group_name: str, + name: str, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + time_grain: Optional[str] = None, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a multi-role pool of an App Service Environment. + + Get metrics for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param start_time: Beginning time of the metrics query. + :type start_time: str + :param end_time: End time of the metrics query. + :type end_time: str + :param time_grain: Time granularity of the metrics query. + :type time_grain: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'str') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'} # type: ignore + + def list_multi_role_pool_skus( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SkuInfoCollection"]: + """Get available SKUs for scaling a multi-role pool. + + Get available SKUs for scaling a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SkuInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} # type: ignore + + def list_multi_role_usages( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.UsageCollection"]: + """Get usage metrics for a multi-role pool of an App Service Environment. + + Get usage metrics for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('UsageCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} # type: ignore + + async def list_operations( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.Operation"]: + """List all currently running operations on the App Service Environment. + + List all currently running operations on the App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Operation, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.Operation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_operations.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[Operation]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} # type: ignore + + def get_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.OutboundEnvironmentEndpointCollection"]: + """Get the network endpoints of all outbound dependencies of an App Service Environment. + + Get the network endpoints of all outbound dependencies of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.OutboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('OutboundEnvironmentEndpointCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints'} # type: ignore + + async def reboot( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Reboot all machines in an App Service Environment. + + Reboot all machines in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reboot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 400, 404, 409]: + 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, {}) + + reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} # type: ignore + + async def _resume_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._resume_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + async def begin_resume( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Resume an App Service Environment. + + Resume an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.resume.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._resume_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + def list_app_service_plans( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans in an App Service Environment. + + Get all App Service plans in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_app_service_plans.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} # type: ignore + + def list_web_apps( + self, + resource_group_name: str, + name: str, + properties_to_include: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps in an App Service Environment. + + Get all apps in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param properties_to_include: Comma separated list of app properties to include. + :type properties_to_include: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if properties_to_include is not None: + query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} # type: ignore + + async def _suspend_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._suspend_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + async def begin_suspend( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Suspend an App Service Environment. + + Suspend an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.suspend.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._suspend_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Get global usage metrics of an App Service Environment. + + Get global usage metrics of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} # type: ignore + + def list_worker_pools( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WorkerPoolCollection"]: + """Get all worker pools of an App Service Environment. + + Get all worker pools of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pools.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WorkerPoolCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} # type: ignore + + async def get_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> "models.WorkerPoolResource": + """Get properties of a worker pool. + + Get properties of a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_worker_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def _create_or_update_worker_pool_initial( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def begin_create_or_update_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> AsyncLROPoller["models.WorkerPoolResource"]: + """Create or update a worker pool. + + Create or update a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param worker_pool_envelope: Properties of the worker pool. + :type worker_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.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_worker_pool_initial( + resource_group_name=resource_group_name, + name=name, + worker_pool_name=worker_pool_name, + worker_pool_envelope=worker_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def update_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> Optional["models.WorkerPoolResource"]: + """Create or update a worker pool. + + Create or update a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param worker_pool_envelope: Properties of the worker pool. + :type worker_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_worker_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + 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, 400, 404, 409]: + 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('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + def list_worker_pool_instance_metric_definitions( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + instance: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param instance: Name of the instance in the worker pool. + :type instance: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_instance_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} # type: ignore + + def list_worker_pool_instance_metrics( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + instance: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a specific instance of a worker pool of an App Service Environment. + + Get metrics for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param instance: Name of the instance in the worker pool. + :type instance: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_instance_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'} # type: ignore + + def list_web_worker_metric_definitions( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a worker pool of an App Service Environment. + + Get metric definitions for a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} # type: ignore + + def list_web_worker_metrics( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of worker pool. + :type worker_pool_name: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'} # type: ignore + + def list_worker_pool_skus( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.SkuInfoCollection"]: + """Get available SKUs for scaling a worker pool. + + Get available SKUs for scaling a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('SkuInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} # type: ignore + + def list_web_worker_usages( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.UsageCollection"]: + """Get usage metrics for a worker pool of an App Service Environment. + + Get usage metrics for a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('UsageCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py new file mode 100644 index 000000000000..42d823b97dc4 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py @@ -0,0 +1,2074 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServicePlansOperations: + """AppServicePlansOperations 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.web.v2018_02_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 + + def list( + self, + detailed: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans for a subscription. + + Get all App Service plans for a subscription. + + :param detailed: Specify :code:`true` to return all App Service plan properties. + The default is :code:`false`, which returns a subset of the properties. + Retrieval of all properties may increase the API latency. + :type detailed: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if detailed is not None: + query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans in a resource group. + + Get all App Service plans in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.AppServicePlan"]: + """Get an App Service plan. + + Get an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlan", + **kwargs + ) -> "models.AppServicePlan": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_plan, 'AppServicePlan') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlan", + **kwargs + ) -> AsyncLROPoller["models.AppServicePlan"]: + """Creates or updates an App Service Plan. + + Creates or updates an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param app_service_plan: Details of the App Service plan. + :type app_service_plan: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServicePlan or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + lro_delay = kwargs.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, + name=name, + app_service_plan=app_service_plan, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/serverfarms/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete an App Service plan. + + Delete an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlanPatchResource", + **kwargs + ) -> "models.AppServicePlan": + """Creates or updates an App Service Plan. + + Creates or updates an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param app_service_plan: Details of the App Service plan. + :type app_service_plan: ~azure.mgmt.web.v2018_02_01.models.AppServicePlanPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def list_capabilities( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.Capability"]: + """List all capabilities of an App Service plan. + + List all capabilities of an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Capability, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.Capability] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_capabilities.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[Capability]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} # type: ignore + + async def get_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieve a Hybrid Connection in use in an App Service plan. + + Retrieve a Hybrid Connection in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: Name of the Service Bus relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> None: + """Delete a Hybrid Connection in use in an App Service plan. + + Delete a Hybrid Connection in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: Name of the Service Bus relay. + :type relay_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Get the send key name and value of a Hybrid Connection. + + Get the send key name and value of a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: The name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: The name of the Service Bus relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + def list_web_apps_by_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceCollection"]: + """Get all apps that use a Hybrid Connection in an App Service Plan. + + Get all apps that use a Hybrid Connection in an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Hybrid Connection namespace. + :type namespace_name: str + :param relay_name: Name of the Hybrid Connection relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps_by_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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: + 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('ResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} # type: ignore + + async def get_hybrid_connection_plan_limit( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HybridConnectionLimits": + """Get the maximum number of Hybrid Connections allowed in an App Service plan. + + Get the maximum number of Hybrid Connections allowed in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionLimits, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionLimits + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionLimits', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} # type: ignore + + def list_hybrid_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.HybridConnectionCollection"]: + """Retrieve all Hybrid Connections in use in an App Service plan. + + Retrieve all Hybrid Connections in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridConnectionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.HybridConnectionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_hybrid_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('HybridConnectionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} # type: ignore + + def list_metric_defintions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metrics that can be queried for an App Service plan, and their definitions. + + Get metrics that can be queried for an App Service plan, and their definitions. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metric_defintions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'} # type: ignore + + def list_metrics( + self, + resource_group_name: str, + name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Get metrics for an App Service plan. + + Get metrics for an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. + :type details: bool + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'} # type: ignore + + async def restart_web_apps( + self, + resource_group_name: str, + name: str, + soft_restart: Optional[bool] = None, + **kwargs + ) -> None: + """Restart all apps in an App Service plan. + + Restart all apps in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param soft_restart: Specify :code:`true` to perform a soft restart, applies the + configuration settings and restarts the apps if necessary. The default is + :code:`false`, which always restarts and reprovisions the apps. + :type soft_restart: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.restart_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} # type: ignore + + def list_web_apps( + self, + resource_group_name: str, + name: str, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps associated with an App Service plan. + + Get all apps associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param skip_token: Skip to a web app in the list of webapps associated with app service plan. + If specified, the resulting list will contain web apps starting from (including) the skipToken. + Otherwise, the resulting list contains web apps from the start of the list. + :type skip_token: str + :param filter: Supported filter: $filter=state eq running. Returns only web apps that are + currently running. + :type filter: str + :param top: List page size. If specified, results are paged. + :type top: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} # type: ignore + + async def get_server_farm_skus( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> object: + """Gets all selectable SKUs for a given App Service Plan. + + Gets all selectable SKUs for a given App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of App Service Plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_server_farm_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets server farm usage information. + + Gets server farm usage information. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of App Service Plan. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} # type: ignore + + async def list_vnets( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Get all Virtual Networks associated with an App Service plan. + + Get all Virtual Networks associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_vnets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_from_server_farm( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> Optional["models.VnetInfo"]: + """Get a Virtual Network associated with an App Service plan. + + Get a Virtual Network associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + **kwargs + ) -> "models.VnetGateway": + """Get a Virtual Network gateway. + + Get a Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_vnet_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Update a Virtual Network gateway. + + Update a Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. + :type gateway_name: str + :param connection_envelope: Definition of the gateway. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def list_routes_for_vnet( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> List["models.VnetRoute"]: + """Get all routes that are associated with a Virtual Network in an App Service plan. + + Get all routes that are associated with a Virtual Network in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_routes_for_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetRoute]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} # type: ignore + + async def get_route_for_vnet( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + **kwargs + ) -> Optional[List["models.VnetRoute"]]: + """Get a Virtual Network route in an App Service plan. + + Get a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_route_for_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('[VnetRoute]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def create_or_update_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + route: "models.VnetRoute", + **kwargs + ) -> Optional["models.VnetRoute"]: + """Create or update a Virtual Network route in an App Service plan. + + Create or update a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :param route: Definition of the Virtual Network route. + :type route: ~azure.mgmt.web.v2018_02_01.models.VnetRoute + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(route, 'VnetRoute') + 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, 400, 404]: + 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('VnetRoute', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def delete_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + **kwargs + ) -> None: + """Delete a Virtual Network route in an App Service plan. + + Delete a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def update_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + route: "models.VnetRoute", + **kwargs + ) -> Optional["models.VnetRoute"]: + """Create or update a Virtual Network route in an App Service plan. + + Create or update a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :param route: Definition of the Virtual Network route. + :type route: ~azure.mgmt.web.v2018_02_01.models.VnetRoute + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(route, 'VnetRoute') + 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, 400, 404]: + 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('VnetRoute', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def reboot_worker( + self, + resource_group_name: str, + name: str, + worker_name: str, + **kwargs + ) -> None: + """Reboot a worker machine in an App Service plan. + + Reboot a worker machine in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param worker_name: Name of worker machine, which typically starts with RD. + :type worker_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reboot_worker.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerName': self._serialize.url("worker_name", worker_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py new file mode 100644 index 000000000000..b6a38554fbcf --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificateRegistrationProviderOperations: + """CertificateRegistrationProviderOperations 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.web.v2018_02_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 + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py new file mode 100644 index 000000000000..059398a2c00c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py @@ -0,0 +1,423 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates for a subscription. + + Get all certificates for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates in a resource group. + + Get all certificates in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.Certificate": + """Get a certificate. + + Get a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.Certificate", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_02_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'Certificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete a certificate. + + Delete a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.CertificatePatchResource", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_02_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py new file mode 100644 index 000000000000..41ffdebddde6 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeletedWebAppsOperations: + """DeletedWebAppsOperations 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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DeletedWebAppCollection"]: + """Get all deleted apps for a subscription. + + Get all deleted apps for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('DeletedWebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} # type: ignore + + def list_by_location( + self, + location: str, + **kwargs + ) -> AsyncIterable["models.DeletedWebAppCollection"]: + """Get all deleted apps for a subscription at location. + + Get all deleted apps for a subscription at location. + + :param location: + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + '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: + 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('DeletedWebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites'} # type: ignore + + async def get_deleted_web_app_by_location( + self, + location: str, + deleted_site_id: str, + **kwargs + ) -> "models.DeletedSite": + """Get deleted app for a subscription at location. + + Get deleted app for a subscription at location. + + :param location: + :type location: str + :param deleted_site_id: The numeric ID of the deleted app, e.g. 12345. + :type deleted_site_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSite, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DeletedSite + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'deletedSiteId': self._serialize.url("deleted_site_id", deleted_site_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedSite', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted_web_app_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py new file mode 100644 index 000000000000..5a668416703e --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py @@ -0,0 +1,1740 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticsOperations: + """DiagnosticsOperations 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.web.v2018_02_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 + + def list_hosting_environment_detector_responses( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Hosting Environment Detector Responses. + + List Hosting Environment Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_hosting_environment_detector_responses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} # type: ignore + + async def get_hosting_environment_detector_response( + self, + resource_group_name: str, + name: str, + detector_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get Hosting Environment Detector Response. + + Get Hosting Environment Detector Response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: App Service Environment Name. + :type name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} # type: ignore + + def list_site_detector_responses( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Site Detector Responses. + + List Site Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detector_responses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} # type: ignore + + async def get_site_detector_response( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get site detector response. + + Get site detector response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_detector_response.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} # type: ignore + + def list_site_diagnostic_categories( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticCategoryCollection"]: + """Get Diagnostics Categories. + + Get Diagnostics Categories. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_diagnostic_categories.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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: + 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('DiagnosticCategoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} # type: ignore + + async def get_site_diagnostic_category( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> "models.DiagnosticCategory": + """Get Diagnostics Category. + + Get Diagnostics Category. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_diagnostic_category.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} # type: ignore + + def list_site_analyses( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticAnalysisCollection"]: + """Get Site Analyses. + + Get Site Analyses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_analyses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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: + 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('DiagnosticAnalysisCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore + + async def get_site_analysis( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Get Site Analysis. + + Get Site Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param analysis_name: Analysis Name. + :type analysis_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_analysis.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore + + async def execute_site_analysis( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Execute Analysis. + + Execute Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param analysis_name: Analysis Resource Name. + :type analysis_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.execute_site_analysis.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore + + def list_site_detectors( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detectors. + + Get Detectors. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detectors.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore + + def get_site_detector( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + detector_name: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detector. + + Get Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param detector_name: Detector Name. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_site_detector.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore + + async def execute_site_detector( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + diagnostic_category: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticDetectorResponse": + """Execute Detector. + + Execute Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.execute_site_detector.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore + + def list_site_detector_responses_slot( + self, + resource_group_name: str, + site_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Site Detector Responses. + + List Site Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detector_responses_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} # type: ignore + + async def get_site_detector_response_slot( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get site detector response. + + Get site detector response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_detector_response_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} # type: ignore + + def list_site_diagnostic_categories_slot( + self, + resource_group_name: str, + site_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticCategoryCollection"]: + """Get Diagnostics Categories. + + Get Diagnostics Categories. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_diagnostic_categories_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticCategoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} # type: ignore + + async def get_site_diagnostic_category_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> "models.DiagnosticCategory": + """Get Diagnostics Category. + + Get Diagnostics Category. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} # type: ignore + + def list_site_analyses_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticAnalysisCollection"]: + """Get Site Analyses. + + Get Site Analyses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_analyses_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticAnalysisCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore + + async def get_site_analysis_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + slot: str, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Get Site Analysis. + + Get Site Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param analysis_name: Analysis Name. + :type analysis_name: str + :param slot: Slot - optional. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_analysis_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore + + async def execute_site_analysis_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Execute Analysis. + + Execute Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param analysis_name: Analysis Resource Name. + :type analysis_name: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.execute_site_analysis_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore + + def list_site_detectors_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detectors. + + Get Detectors. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detectors_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore + + def get_site_detector_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + detector_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detector. + + Get Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param detector_name: Detector Name. + :type detector_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_site_detector_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore + + async def execute_site_detector_slot( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + diagnostic_category: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticDetectorResponse": + """Execute Detector. + + Execute Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.execute_site_detector_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py new file mode 100644 index 000000000000..f90d9bff82ce --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainRegistrationProviderOperations: + """DomainRegistrationProviderOperations 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.web.v2018_02_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 + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py new file mode 100644 index 000000000000..ff07ee58a795 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py @@ -0,0 +1,1069 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainsOperations: + """DomainsOperations 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.web.v2018_02_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 + + async def check_availability( + self, + identifier: "models.NameIdentifier", + **kwargs + ) -> "models.DomainAvailablilityCheckResult": + """Check if a domain is available for registration. + + Check if a domain is available for registration. + + :param identifier: Name of the domain. + :type identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainAvailablilityCheckResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainAvailablilityCheckResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_availability.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(identifier, 'NameIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainAvailablilityCheckResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DomainCollection"]: + """Get all domains in a subscription. + + Get all domains 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 DomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('DomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} # type: ignore + + async def get_control_center_sso_request( + self, + **kwargs + ) -> "models.DomainControlCenterSsoRequest": + """Generate a single sign-on request for the domain management portal. + + Generate a single sign-on request for the domain management portal. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainControlCenterSsoRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainControlCenterSsoRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_control_center_sso_request.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainControlCenterSsoRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} # type: ignore + + def list_recommendations( + self, + parameters: "models.DomainRecommendationSearchParameters", + **kwargs + ) -> AsyncIterable["models.NameIdentifierCollection"]: + """Get domain name recommendations based on keywords. + + Get domain name recommendations based on keywords. + + :param parameters: Search parameters for domain name recommendations. + :type parameters: ~azure.mgmt.web.v2018_02_01.models.DomainRecommendationSearchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NameIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.NameIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommendations.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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NameIdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.DomainCollection"]: + """Get all domains in a resource group. + + Get all domains in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 DomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('DomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} # type: ignore + + async def get( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> "models.Domain": + """Get a domain. + + Get a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + domain: "models.Domain", + **kwargs + ) -> "models.Domain": + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain, 'Domain') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Domain', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + domain: "models.Domain", + **kwargs + ) -> AsyncLROPoller["models.Domain"]: + """Creates or updates a domain. + + Creates or updates a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain: Domain registration information. + :type domain: ~azure.mgmt.web.v2018_02_01.models.Domain + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.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, + domain_name=domain_name, + domain=domain, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.DomainRegistration/domains/{domainName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + domain_name: str, + force_hard_delete_domain: Optional[bool] = None, + **kwargs + ) -> None: + """Delete a domain. + + Delete a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param force_hard_delete_domain: Specify :code:`true` to delete the domain + immediately. The default is :code:`false` which deletes the domain after 24 hours. + :type force_hard_delete_domain: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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] + if force_hard_delete_domain is not None: + query_parameters['forceHardDeleteDomain'] = self._serialize.query("force_hard_delete_domain", force_hard_delete_domain, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + domain_name: str, + domain: "models.DomainPatchResource", + **kwargs + ) -> "models.Domain": + """Creates or updates a domain. + + Creates or updates a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain: Domain registration information. + :type domain: ~azure.mgmt.web.v2018_02_01.models.DomainPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain, 'DomainPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Domain', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + def list_ownership_identifiers( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> AsyncIterable["models.DomainOwnershipIdentifierCollection"]: + """Lists domain ownership identifiers. + + Lists domain ownership identifiers. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainOwnershipIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_ownership_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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: + 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('DomainOwnershipIdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} # type: ignore + + async def get_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Get ownership identifier for domain. + + Get ownership identifier for domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def create_or_update_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + domain_ownership_identifier: "models.DomainOwnershipIdentifier", + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def delete_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + **kwargs + ) -> None: + """Delete ownership identifier for domain. + + Delete ownership identifier for domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def update_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + domain_ownership_identifier: "models.DomainOwnershipIdentifier", + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def renew( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> None: + """Renew a domain. + + Renew a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.renew.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 400, 500]: + 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, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py new file mode 100644 index 000000000000..649a181a6b72 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProviderOperations: + """ProviderOperations 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.web.v2018_02_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 + + def get_available_stacks( + self, + os_type_selected: Optional[Union[str, "models.Enum4"]] = None, + **kwargs + ) -> AsyncIterable["models.ApplicationStackCollection"]: + """Get available application frameworks and their versions. + + Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2018_02_01.models.Enum4 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_available_stacks.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if os_type_selected is not None: + query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} # type: ignore + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions. + + Gets all available operations for the Microsoft.Web resource provider. Also exposes resource + metric definitions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} # type: ignore + + def get_available_stacks_on_prem( + self, + os_type_selected: Optional[Union[str, "models.Enum5"]] = None, + **kwargs + ) -> AsyncIterable["models.ApplicationStackCollection"]: + """Get available application frameworks and their versions. + + Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2018_02_01.models.Enum5 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_available_stacks_on_prem.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] + if os_type_selected is not None: + query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py new file mode 100644 index 000000000000..b22e63f3eda8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py @@ -0,0 +1,1047 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RecommendationsOperations: + """RecommendationsOperations 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.web.v2018_02_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 + + def list( + self, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """List all recommendations for a subscription. + + List all recommendations for a subscription. + + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} # type: ignore + + async def reset_all_filters( + self, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for a subscription. + + Reset all recommendation opt-out settings for a subscription. + + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reset_all_filters.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} # type: ignore + + async def disable_recommendation_for_subscription( + self, + name: str, + **kwargs + ) -> None: + """Disables the specified rule so it will not apply to a subscription in the future. + + Disables the specified rule so it will not apply to a subscription in the future. + + :param name: Rule name. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} # type: ignore + + def list_history_for_hosting_environment( + self, + resource_group_name: str, + hosting_environment_name: str, + expired_only: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get past recommendations for an app, optionally specified by the time range. + + Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param hosting_environment_name: Name of the hosting environment. + :type hosting_environment_name: str + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. + :type expired_only: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_history_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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] + if expired_only is not None: + query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_history_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory'} # type: ignore + + def list_recommended_rules_for_hosting_environment( + self, + resource_group_name: str, + hosting_environment_name: str, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get all recommendations for an app. + + Get all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param hosting_environment_name: Name of the app. + :type hosting_environment_name: str + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommended_rules_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations'} # type: ignore + + async def disable_all_for_hosting_environment( + self, + resource_group_name: str, + environment_name: str, + hosting_environment_name: str, + **kwargs + ) -> None: + """Disable all recommendations for an app. + + Disable all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param environment_name: Name of the app. + :type environment_name: str + :param hosting_environment_name: + :type hosting_environment_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.disable_all_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + disable_all_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable'} # type: ignore + + async def reset_all_filters_for_hosting_environment( + self, + resource_group_name: str, + environment_name: str, + hosting_environment_name: str, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for an app. + + Reset all recommendation opt-out settings for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param environment_name: Name of the app. + :type environment_name: str + :param hosting_environment_name: + :type hosting_environment_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reset_all_filters_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reset_all_filters_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset'} # type: ignore + + async def get_rule_details_by_hosting_environment( + self, + resource_group_name: str, + hosting_environment_name: str, + name: str, + update_seen: Optional[bool] = None, + recommendation_id: Optional[str] = None, + **kwargs + ) -> "models.RecommendationRule": + """Get a recommendation rule for an app. + + Get a recommendation rule for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param hosting_environment_name: Name of the hosting environment. + :type hosting_environment_name: str + :param name: Name of the recommendation. + :type name: str + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. + :type update_seen: bool + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if update_seen is not None: + query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') + if recommendation_id is not None: + query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecommendationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_rule_details_by_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}'} # type: ignore + + async def disable_recommendation_for_hosting_environment( + self, + resource_group_name: str, + environment_name: str, + name: str, + hosting_environment_name: str, + **kwargs + ) -> None: + """Disables the specific rule for a web site permanently. + + Disables the specific rule for a web site permanently. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param environment_name: Site name. + :type environment_name: str + :param name: Rule name. + :type name: str + :param hosting_environment_name: + :type hosting_environment_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.disable_recommendation_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_recommendation_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable'} # type: ignore + + def list_history_for_web_app( + self, + resource_group_name: str, + site_name: str, + expired_only: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get past recommendations for an app, optionally specified by the time range. + + Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. + :type expired_only: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_history_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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] + if expired_only is not None: + query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} # type: ignore + + def list_recommended_rules_for_web_app( + self, + resource_group_name: str, + site_name: str, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get all recommendations for an app. + + Get all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommended_rules_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} # type: ignore + + async def disable_all_for_web_app( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> None: + """Disable all recommendations for an app. + + Disable all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.disable_all_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} # type: ignore + + async def reset_all_filters_for_web_app( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for an app. + + Reset all recommendation opt-out settings for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} # type: ignore + + async def get_rule_details_by_web_app( + self, + resource_group_name: str, + site_name: str, + name: str, + update_seen: Optional[bool] = None, + recommendation_id: Optional[str] = None, + **kwargs + ) -> "models.RecommendationRule": + """Get a recommendation rule for an app. + + Get a recommendation rule for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param name: Name of the recommendation. + :type name: str + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. + :type update_seen: bool + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if update_seen is not None: + query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') + if recommendation_id is not None: + query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecommendationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} # type: ignore + + async def disable_recommendation_for_site( + self, + resource_group_name: str, + site_name: str, + name: str, + **kwargs + ) -> None: + """Disables the specific rule for a web site permanently. + + Disables the specific rule for a web site permanently. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site name. + :type site_name: str + :param name: Rule name. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.disable_recommendation_for_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py new file mode 100644 index 000000000000..09ec6ccf96a2 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py @@ -0,0 +1,450 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceHealthMetadataOperations: + """ResourceHealthMetadataOperations 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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """List all ResourceHealthMetadata for all sites in the subscription. + + List all ResourceHealthMetadata for all sites in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """List all ResourceHealthMetadata for all sites in the resource group in the subscription. + + List all ResourceHealthMetadata for all sites in the resource group in the subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore + + def list_by_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} # type: ignore + + async def get_by_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.ResourceHealthMetadata": + """Gets the category of ResourceHealthMetadata to use for the given site. + + Gets the category of ResourceHealthMetadata to use for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_by_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} # type: ignore + + def list_by_site_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_site_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} # type: ignore + + async def get_by_site_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.ResourceHealthMetadata": + """Gets the category of ResourceHealthMetadata to use for the given site. + + Gets the category of ResourceHealthMetadata to use for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_by_site_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py new file mode 100644 index 000000000000..049e7ddfd626 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py @@ -0,0 +1,245 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopLevelDomainsOperations: + """TopLevelDomainsOperations 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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.TopLevelDomainCollection"]: + """Get all top-level domains supported for registration. + + Get all top-level domains supported for registration. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopLevelDomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.TopLevelDomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('TopLevelDomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} # type: ignore + + async def get( + self, + name: str, + **kwargs + ) -> "models.TopLevelDomain": + """Get details of a top-level domain. + + Get details of a top-level domain. + + :param name: Name of the top-level domain. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopLevelDomain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TopLevelDomain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopLevelDomain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} # type: ignore + + def list_agreements( + self, + name: str, + agreement_option: "models.TopLevelDomainAgreementOption", + **kwargs + ) -> AsyncIterable["models.TldLegalAgreementCollection"]: + """Gets all legal agreements that user needs to accept before purchasing a domain. + + Gets all legal agreements that user needs to accept before purchasing a domain. + + :param name: Name of the top-level domain. + :type name: str + :param agreement_option: Domain agreement options. + :type agreement_option: ~azure.mgmt.web.v2018_02_01.models.TopLevelDomainAgreementOption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TldLegalAgreementCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.TldLegalAgreementCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_agreements.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TldLegalAgreementCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py new file mode 100644 index 000000000000..532c466b016f --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py @@ -0,0 +1,26348 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, IO, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebAppsOperations: + """WebAppsOperations 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.web.v2018_02_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps for a subscription. + + Get all apps for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + include_slots: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Gets all web, mobile, and API apps in the specified resource group. + + Gets all web, mobile, and API apps in the specified resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param include_slots: Specify :code:`true` to include deployment slots in + results. The default is false, which only gives you the production slot of all apps. + :type include_slots: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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] + if include_slots is not None: + query_parameters['includeSlots'] = self._serialize.query("include_slots", include_slots, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.Site"]: + """Gets the details of a web, mobile, or API app. + + Gets the details of a web, mobile, or API app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + site_envelope: "models.Site", + **kwargs + ) -> "models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'Site') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + site_envelope: "models.Site", + **kwargs + ) -> AsyncLROPoller["models.Site"]: + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.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, + name=name, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/sites/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + delete_metrics: Optional[bool] = None, + delete_empty_server_farm: Optional[bool] = None, + **kwargs + ) -> None: + """Deletes a web, mobile, or API app, or one of the deployment slots. + + Deletes a web, mobile, or API app, or one of the deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app to delete. + :type name: str + :param delete_metrics: If true, web app metrics are also deleted. + :type delete_metrics: bool + :param delete_empty_server_farm: Specify false if you want to keep empty App Service plan. By + default, empty App Service plan is deleted. + :type delete_empty_server_farm: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if delete_metrics is not None: + query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') + if delete_empty_server_farm is not None: + query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 404]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + site_envelope: "models.SitePatchResource", + **kwargs + ) -> "models.Site": + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'SitePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def analyze_custom_hostname( + self, + resource_group_name: str, + name: str, + host_name: Optional[str] = None, + **kwargs + ) -> "models.CustomHostnameAnalysisResult": + """Analyze a custom hostname. + + Analyze a custom hostname. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param host_name: Custom hostname. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.analyze_custom_hostname.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if host_name is not None: + query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} # type: ignore + + async def apply_slot_config_to_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + """Applies the configuration settings from the target slot onto the current slot. + + Applies the configuration settings from the target slot onto the current slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.apply_slot_config_to_production.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} # type: ignore + + async def backup( + self, + resource_group_name: str, + name: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Creates a backup of an app. + + Creates a backup of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} # type: ignore + + def list_backups( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_backups.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} # type: ignore + + async def get_backup_status( + self, + resource_group_name: str, + name: str, + backup_id: str, + **kwargs + ) -> "models.BackupItem": + """Gets a backup of an app by its ID. + + Gets a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_backup_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore + + async def delete_backup( + self, + resource_group_name: str, + name: str, + backup_id: str, + **kwargs + ) -> None: + """Deletes a backup of an app by its ID. + + Deletes a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore + + async def list_backup_status_secrets( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param backup_id: ID of backup. + :type backup_id: str + :param request: Information on backup request. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_backup_status_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} # type: ignore + + async def _restore_initial( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + 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, {}) + + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + async def begin_restore( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a specific backup to another app (or deployment slot, if specified). + + Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + def list_configurations( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigResourceCollection"]: + """List the configurations of an app. + + List the configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configurations.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteConfigResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} # type: ignore + + async def update_application_settings( + self, + resource_group_name: str, + name: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the application settings of an app. + + Replaces the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_application_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} # type: ignore + + async def list_application_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of an app. + + Gets the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_application_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} # type: ignore + + async def update_auth_settings( + self, + resource_group_name: str, + name: str, + site_auth_settings: "models.SiteAuthSettings", + **kwargs + ) -> "models.SiteAuthSettings": + """Updates the Authentication / Authorization settings associated with web app. + + Updates the Authentication / Authorization settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_auth_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} # type: ignore + + async def get_auth_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteAuthSettings": + """Gets the Authentication/Authorization settings of an app. + + Gets the Authentication/Authorization settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_auth_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} # type: ignore + + async def update_azure_storage_accounts( + self, + resource_group_name: str, + name: str, + azure_storage_accounts: "models.AzureStoragePropertyDictionaryResource", + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Updates the Azure storage account configurations of an app. + + Updates the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_azure_storage_accounts.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts'} # type: ignore + + async def list_azure_storage_accounts( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Gets the Azure storage account configurations of an app. + + Gets the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_azure_storage_accounts.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list'} # type: ignore + + async def update_backup_configuration( + self, + resource_group_name: str, + name: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupRequest": + """Updates the backup configuration of an app. + + Updates the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Edited backup configuration. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore + + async def delete_backup_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes the backup configuration of an app. + + Deletes the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore + + async def get_backup_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.BackupRequest": + """Gets the backup configuration of an app. + + Gets the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} # type: ignore + + async def update_connection_strings( + self, + resource_group_name: str, + name: str, + connection_strings: "models.ConnectionStringDictionary", + **kwargs + ) -> "models.ConnectionStringDictionary": + """Replaces the connection strings of an app. + + Replaces the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_connection_strings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} # type: ignore + + async def list_connection_strings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.ConnectionStringDictionary": + """Gets the connection strings of an app. + + Gets the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_connection_strings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} # type: ignore + + async def get_diagnostic_logs_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteLogsConfig": + """Gets the logging configuration of an app. + + Gets the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore + + async def update_diagnostic_logs_config( + self, + resource_group_name: str, + name: str, + site_logs_config: "models.SiteLogsConfig", + **kwargs + ) -> "models.SiteLogsConfig": + """Updates the logging configuration of an app. + + Updates the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore + + async def update_metadata( + self, + resource_group_name: str, + name: str, + metadata: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the metadata of an app. + + Replaces the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_metadata.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(metadata, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} # type: ignore + + async def list_metadata( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the metadata of an app. + + Gets the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_metadata.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} # type: ignore + + async def _list_publishing_credentials_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.User": + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_publishing_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + async def begin_list_publishing_credentials( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller["models.User"]: + """Gets the Git/FTP publishing credentials of an app. + + Gets the Git/FTP publishing credentials of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.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._list_publishing_credentials_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + async def update_site_push_settings( + self, + resource_group_name: str, + name: str, + push_settings: "models.PushSettings", + **kwargs + ) -> "models.PushSettings": + """Updates the Push settings associated with web app. + + Updates the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param push_settings: Push settings associated with web app. + :type push_settings: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_site_push_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(push_settings, 'PushSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} # type: ignore + + async def list_site_push_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PushSettings": + """Gets the Push settings associated with web app. + + Gets the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_site_push_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} # type: ignore + + async def list_slot_configuration_names( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SlotConfigNamesResource": + """Gets the names of app settings and connection strings that stick to the slot (not swapped). + + Gets the names of app settings and connection strings that stick to the slot (not swapped). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_slot_configuration_names.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore + + async def update_slot_configuration_names( + self, + resource_group_name: str, + name: str, + slot_config_names: "models.SlotConfigNamesResource", + **kwargs + ) -> "models.SlotConfigNamesResource": + """Updates the names of application settings and connection string that remain with the slot during swap operation. + + Updates the names of application settings and connection string that remain with the slot + during swap operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_config_names: Names of application settings and connection strings. See example. + :type slot_config_names: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_slot_configuration_names.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore + + async def get_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. + + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + async def create_or_update_configuration( + self, + resource_group_name: str, + name: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + async def update_configuration( + self, + resource_group_name: str, + name: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + def list_configuration_snapshot_info( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigurationSnapshotInfoCollection"]: + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. + + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configuration_snapshot_info.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteConfigurationSnapshotInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} # type: ignore + + async def get_configuration_snapshot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets a snapshot of the configuration of an app at a previous point in time. + + Gets a snapshot of the configuration of an app at a previous point in time. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_configuration_snapshot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} # type: ignore + + async def recover_site_configuration_snapshot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + **kwargs + ) -> None: + """Reverts the configuration of an app to a previous snapshot. + + Reverts the configuration of an app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} # type: ignore + + async def get_web_site_container_logs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional[IO]: + """Gets the last lines of docker logs for the given site. + + Gets the last lines of docker logs for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_web_site_container_logs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/octet-stream' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} # type: ignore + + async def get_container_logs_zip( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional[IO]: + """Gets the ZIP archived docker log files for the given site. + + Gets the ZIP archived docker log files for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_container_logs_zip.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/zip' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} # type: ignore + + def list_continuous_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ContinuousWebJobCollection"]: + """List continuous web jobs for an app, or a deployment slot. + + List continuous web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_continuous_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ContinuousWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} # type: ignore + + async def get_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> Optional["models.ContinuousWebJob"]: + """Gets a continuous web job by its ID for an app, or a deployment slot. + + Gets a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ContinuousWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore + + async def delete_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Delete a continuous web job by its ID for an app, or a deployment slot. + + Delete a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore + + async def start_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Start a continuous web job for an app, or a deployment slot. + + Start a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.start_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} # type: ignore + + async def stop_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Stop a continuous web job for an app, or a deployment slot. + + Stop a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} # type: ignore + + def list_deployments( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.DeploymentCollection"]: + """List deployments for an app, or a deployment slot. + + List deployments for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_deployments.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('DeploymentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} # type: ignore + + async def get_deployment( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> "models.Deployment": + """Get a deployment by its ID for an app, or a deployment slot. + + Get a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def create_deployment( + self, + resource_group_name: str, + name: str, + id: str, + deployment: "models.Deployment", + **kwargs + ) -> "models.Deployment": + """Create a deployment for an app, or a deployment slot. + + Create a deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: ID of an existing deployment. + :type id: str + :param deployment: Deployment details. + :type deployment: ~azure.mgmt.web.v2018_02_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def delete_deployment( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> None: + """Delete a deployment by its ID for an app, or a deployment slot. + + Delete a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def list_deployment_log( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> "models.Deployment": + """List deployment log for specific deployment for an app, or a deployment slot. + + List deployment log for specific deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_deployment_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} # type: ignore + + async def discover_backup( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreRequest": + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. + + Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to + get information about the databases stored in a backup. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.discover_backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + discover_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup'} # type: ignore + + def list_domain_ownership_identifiers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """Lists ownership identifiers for domain associated with web app. + + Lists ownership identifiers for domain associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_domain_ownership_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} # type: ignore + + async def get_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + **kwargs + ) -> "models.Identifier": + """Get domain ownership identifier for web app. + + Get domain ownership identifier for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def create_or_update_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def delete_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + **kwargs + ) -> None: + """Deletes a domain ownership identifier for a web app. + + Deletes a domain ownership identifier for a web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def update_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def get_ms_deploy_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_ms_deploy_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def _create_ms_deploy_operation_initial( + self, + resource_group_name: str, + name: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def begin_create_ms_deploy_operation( + self, + resource_group_name: str, + name: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def get_ms_deploy_log( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_ms_deploy_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} # type: ignore + + def list_functions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.FunctionEnvelopeCollection"]: + """List the functions for a web site, or a deployment slot. + + List the functions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('FunctionEnvelopeCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} # type: ignore + + async def get_functions_admin_token( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> str: + """Fetch a short lived token that can be exchanged for a master key. + + Fetch a short lived token that can be exchanged for a master key. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_functions_admin_token.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} # type: ignore + + async def get_function( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> Optional["models.FunctionEnvelope"]: + """Get function information by its ID for web site, or a deployment slot. + + Get function information by its ID for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_function.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def _create_function_initial( + self, + resource_group_name: str, + name: str, + function_name: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> "models.FunctionEnvelope": + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_function_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_function_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def begin_create_function( + self, + resource_group_name: str, + name: str, + function_name: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> AsyncLROPoller["models.FunctionEnvelope"]: + """Create function for web site, or a deployment slot. + + Create function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param function_envelope: Function details. + :type function_envelope: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.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_function_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def delete_function( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> None: + """Delete a function for web site, or a deployment slot. + + Delete a function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_function.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def create_or_update_function_secret( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a function secret. + + Add or update a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_name: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_function_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def delete_function_secret( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + **kwargs + ) -> None: + """Delete a function secret. + + Delete a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_function_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def list_function_keys( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> "models.StringDictionary": + """Get function keys for a function in a web site, or a deployment slot. + + Get function keys for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_function_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys'} # type: ignore + + async def list_function_secrets( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> "models.FunctionSecrets": + """Get function secrets for a function in a web site, or a deployment slot. + + Get function secrets for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_function_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} # type: ignore + + async def list_host_keys( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HostKeys": + """Get host secrets for a function app. + + Get host secrets for a function app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_host_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_host_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys'} # type: ignore + + async def list_sync_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """This is to allow calling via powershell and ARM template. + + This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_sync_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + list_sync_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus'} # type: ignore + + async def sync_functions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.sync_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + sync_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync'} # type: ignore + + async def create_or_update_host_secret( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a host level secret. + + Add or update a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_name: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore + + async def delete_host_secret( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + **kwargs + ) -> None: + """Delete a host level secret. + + Delete a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_host_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore + + def list_host_name_bindings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.HostNameBindingCollection"]: + """Get hostname bindings for an app or a deployment slot. + + Get hostname bindings for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_host_name_bindings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('HostNameBindingCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} # type: ignore + + async def get_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + **kwargs + ) -> "models.HostNameBinding": + """Get the named hostname binding for an app (or deployment slot, if specified). + + Get the named hostname binding for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def create_or_update_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + host_name_binding: "models.HostNameBinding", + **kwargs + ) -> "models.HostNameBinding": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def delete_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def get_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def create_or_update_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> None: + """Removes a Hybrid Connection from this site. + + Removes a Hybrid Connection from this site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def update_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Gets the send key name and value for a Hybrid Connection. + + Gets the send key name and value for a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + async def list_hybrid_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves all Service Bus Hybrid Connections used by this Web App. + + Retrieves all Service Bus Hybrid Connections used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_hybrid_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} # type: ignore + + async def list_relay_service_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Gets hybrid connections configured for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_relay_service_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} # type: ignore + + async def get_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets a hybrid connection configuration by its name. + + Gets a hybrid connection configuration by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection. + :type entity_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def create_or_update_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def delete_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + **kwargs + ) -> None: + """Deletes a relay service connection by its name. + + Deletes a relay service connection by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def update_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + def list_instance_identifiers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebAppInstanceCollection"]: + """Gets all scale-out instances of an app. + + Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebAppInstanceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} # type: ignore + + async def get_instance_ms_deploy_status( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def _create_instance_ms_deploy_operation_initial( + self, + resource_group_name: str, + name: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def begin_create_instance_ms_deploy_operation( + self, + resource_group_name: str, + name: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_instance_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def get_instance_ms_deploy_log( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_processes( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_processes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} # type: ignore + + async def get_instance_process( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def delete_instance_process( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_instance_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def get_instance_process_dump( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_dump.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore + + def list_instance_process_modules( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_modules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore + + async def get_instance_process_module( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_module.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_instance_process_threads( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_threads.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore + + async def get_instance_process_thread( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_thread.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore + + async def is_cloneable( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteCloneability": + """Shows whether an app can be cloned to another resource group or subscription. + + Shows whether an app can be cloned to another resource group or subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.is_cloneable.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteCloneability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} # type: ignore + + async def list_sync_function_triggers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.FunctionSecrets": + """This is to allow calling via powershell and ARM template. + + This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_sync_function_triggers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} # type: ignore + + def list_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Gets all metric definitions of an app (or deployment slot, if specified). + + Gets all metric definitions of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions'} # type: ignore + + def list_metrics( + self, + resource_group_name: str, + name: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Gets performance metrics of an app (or deployment slot, if specified). + + Gets performance metrics of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param details: Specify "true" to include metric details in the response. It is "false" by + default. + :type details: bool + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics'} # type: ignore + + async def _migrate_storage_initial( + self, + subscription_name: str, + resource_group_name: str, + name: str, + migration_options: "models.StorageMigrationOptions", + **kwargs + ) -> "models.StorageMigrationResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._migrate_storage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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['subscriptionName'] = self._serialize.query("subscription_name", subscription_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _migrate_storage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + async def begin_migrate_storage( + self, + subscription_name: str, + resource_group_name: str, + name: str, + migration_options: "models.StorageMigrationOptions", + **kwargs + ) -> AsyncLROPoller["models.StorageMigrationResponse"]: + """Restores a web app. + + Restores a web app. + + :param subscription_name: Azure subscription. + :type subscription_name: str + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param migration_options: Migration migrationOptions. + :type migration_options: ~azure.mgmt.web.v2018_02_01.models.StorageMigrationOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageMigrationResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.StorageMigrationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + lro_delay = kwargs.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._migrate_storage_initial( + subscription_name=subscription_name, + resource_group_name=resource_group_name, + name=name, + migration_options=migration_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + async def _migrate_my_sql_initial( + self, + resource_group_name: str, + name: str, + migration_request_envelope: "models.MigrateMySqlRequest", + **kwargs + ) -> "models.Operation": + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._migrate_my_sql_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _migrate_my_sql_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + async def begin_migrate_my_sql( + self, + resource_group_name: str, + name: str, + migration_request_envelope: "models.MigrateMySqlRequest", + **kwargs + ) -> AsyncLROPoller["models.Operation"]: + """Migrates a local (in-app) MySql database to a remote MySql database. + + Migrates a local (in-app) MySql database to a remote MySql database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param migration_request_envelope: MySql migration options. + :type migration_request_envelope: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Operation or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + lro_delay = kwargs.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._migrate_my_sql_initial( + resource_group_name=resource_group_name, + name=name, + migration_request_envelope=migration_request_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + async def get_migrate_my_sql_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MigrateMySqlStatus": + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. + + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} # type: ignore + + async def get_swift_virtual_network_connection( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Gets a Swift Virtual Network connection. + + Gets a Swift Virtual Network connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def create_or_update_swift_virtual_network_connection( + self, + resource_group_name: str, + name: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def delete_swift_virtual_network( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes a Swift Virtual Network connection from an app (or deployment slot). + + Deletes a Swift Virtual Network connection from an app (or deployment slot). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_swift_virtual_network.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_swift_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def update_swift_virtual_network_connection( + self, + resource_group_name: str, + name: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def list_network_features( + self, + resource_group_name: str, + name: str, + view: str, + **kwargs + ) -> Optional["models.NetworkFeatures"]: + """Gets all network features used by the app (or deployment slot, if specified). + + Gets all network features used by the app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param view: The type of view. This can either be "summary" or "detailed". + :type view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_network_features.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'view': self._serialize.url("view", view, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('NetworkFeatures', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} # type: ignore + + async def get_network_trace_operation( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_trace_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}'} # type: ignore + + async def start_web_site_network_trace( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> str: + """Start capturing network packets for the site (To be deprecated). + + Start capturing network packets for the site (To be deprecated). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.start_web_site_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} # type: ignore + + async def _start_web_site_network_trace_operation_initial( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_web_site_network_trace_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore + + async def begin_start_web_site_network_trace_operation( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_web_site_network_trace_operation_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore + + async def stop_web_site_network_trace( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_web_site_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} # type: ignore + + async def get_network_traces( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_traces.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}'} # type: ignore + + async def get_network_trace_operation_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}'} # type: ignore + + async def get_network_traces_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_traces_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}'} # type: ignore + + async def generate_new_site_publishing_password( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Generates a new publishing password for an app (or deployment slot, if specified). + + Generates a new publishing password for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} # type: ignore + + def list_perf_mon_counters( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.PerfMonCounterCollection"]: + """Gets perfmon counters for web app. + + Gets perfmon counters for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_perf_mon_counters.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} # type: ignore + + async def get_site_php_error_log_flag( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SitePhpErrorLogFlag": + """Gets web app's event logs. + + Gets web app's event logs. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} # type: ignore + + async def list_premier_add_ons( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets the premier add-ons of an app. + + Gets the premier add-ons of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_premier_add_ons.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} # type: ignore + + async def get_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets a named add-on of an app. + + Gets a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def add_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + premier_add_on: "models.PremierAddOn", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def delete_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + **kwargs + ) -> None: + """Delete a premier add-on from an app. + + Delete a premier add-on from an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def update_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + premier_add_on: "models.PremierAddOnPatchResource", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def get_private_access( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PrivateAccess": + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. + + Gets data around private site access enablement and authorized Virtual Networks that can access + the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_private_access.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore + + async def put_private_access_vnet( + self, + resource_group_name: str, + name: str, + access: "models.PrivateAccess", + **kwargs + ) -> "models.PrivateAccess": + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. + + Sets data around private site access enablement and authorized Virtual Networks that can access + the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param access: The information for the private access. + :type access: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_private_access_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(access, 'PrivateAccess') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_private_access_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore + + def list_processes( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_processes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} # type: ignore + + async def get_process( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore + + async def delete_process( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore + + async def get_process_dump( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_dump.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} # type: ignore + + def list_process_modules( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_modules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} # type: ignore + + async def get_process_module( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_module.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_process_threads( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_threads.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} # type: ignore + + async def get_process_thread( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_thread.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads/{threadId}'} # type: ignore + + def list_public_certificates( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.PublicCertificateCollection"]: + """Get public certificates for an app or a deployment slot. + + Get public certificates for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_public_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('PublicCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} # type: ignore + + async def get_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + **kwargs + ) -> "models.PublicCertificate": + """Get the named public certificate for an app (or deployment slot, if specified). + + Get the named public certificate for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def create_or_update_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + public_certificate: "models.PublicCertificate", + **kwargs + ) -> "models.PublicCertificate": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(public_certificate, 'PublicCertificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def delete_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def list_publishing_profile_xml_with_secrets( + self, + resource_group_name: str, + name: str, + publishing_profile_options: "models.CsmPublishingProfileOptions", + **kwargs + ) -> IO: + """Gets the publishing profile for an app (or deployment slot, if specified). + + Gets the publishing profile for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2018_02_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} # type: ignore + + async def reset_production_slot_config( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. + + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reset_production_slot_config.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} # type: ignore + + async def restart( + self, + resource_group_name: str, + name: str, + soft_restart: Optional[bool] = None, + synchronous: Optional[bool] = None, + **kwargs + ) -> None: + """Restarts an app (or deployment slot, if specified). + + Restarts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. + :type soft_restart: bool + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). + :type synchronous: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.restart.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + if synchronous is not None: + query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} # type: ignore + + async def _restore_from_backup_blob_initial( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_backup_blob_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + 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, {}) + + _restore_from_backup_blob_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore + + async def begin_restore_from_backup_blob( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores an app from a backup blob in Azure Storage. + + Restores an app from a backup blob in Azure Storage. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_backup_blob_initial( + resource_group_name=resource_group_name, + name=name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore + + async def _restore_from_deleted_app_initial( + self, + resource_group_name: str, + name: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_deleted_app_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + 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]: + 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, {}) + + _restore_from_deleted_app_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore + + async def begin_restore_from_deleted_app( + self, + resource_group_name: str, + name: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a deleted web app to this web app. + + Restores a deleted web app to this web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param restore_request: Deleted web app restore information. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_deleted_app_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore + + async def _restore_snapshot_initial( + self, + resource_group_name: str, + name: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_snapshot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + 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]: + 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, {}) + + _restore_snapshot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore + + async def begin_restore_snapshot( + self, + resource_group_name: str, + name: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a web app from a snapshot. + + Restores a web app from a snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_snapshot_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore + + def list_site_extensions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteExtensionInfoCollection"]: + """Get list of siteextensions for a web site, or a deployment slot. + + Get list of siteextensions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_extensions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteExtensionInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} # type: ignore + + async def get_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + """Get site extension information by its ID for a web site, or a deployment slot. + + Get site extension information by its ID for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_extension.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _install_site_extension_initial( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._install_site_extension_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 429]: + 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('SiteExtensionInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _install_site_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def begin_install_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> AsyncLROPoller["models.SiteExtensionInfo"]: + """Install site extension on a web site, or a deployment slot. + + Install site extension on a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def delete_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> None: + """Remove a site extension from a web site, or a deployment slot. + + Remove a site extension from a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_site_extension.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + def list_slots( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Gets an app's deployment slots. + + Gets an app's deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slots.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} # type: ignore + + async def get_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional["models.Site"]: + """Gets the details of a web, mobile, or API app. + + Gets the details of a web, mobile, or API app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. By default, this API returns the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def _create_or_update_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.Site", + **kwargs + ) -> "models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'Site') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def begin_create_or_update_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.Site", + **kwargs + ) -> AsyncLROPoller["models.Site"]: + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. + :type slot: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.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_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def delete_slot( + self, + resource_group_name: str, + name: str, + slot: str, + delete_metrics: Optional[bool] = None, + delete_empty_server_farm: Optional[bool] = None, + **kwargs + ) -> None: + """Deletes a web, mobile, or API app, or one of the deployment slots. + + Deletes a web, mobile, or API app, or one of the deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app to delete. + :type name: str + :param slot: Name of the deployment slot to delete. By default, the API deletes the production + slot. + :type slot: str + :param delete_metrics: If true, web app metrics are also deleted. + :type delete_metrics: bool + :param delete_empty_server_farm: Specify true if the App Service plan will be empty after app + deletion and you want to delete the empty App Service plan. By default, the empty App Service + plan is not deleted. + :type delete_empty_server_farm: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if delete_metrics is not None: + query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') + if delete_empty_server_farm is not None: + query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 404]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def update_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.SitePatchResource", + **kwargs + ) -> "models.Site": + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. + :type slot: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'SitePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def analyze_custom_hostname_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: Optional[str] = None, + **kwargs + ) -> "models.CustomHostnameAnalysisResult": + """Analyze a custom hostname. + + Analyze a custom hostname. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param host_name: Custom hostname. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if host_name is not None: + query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} # type: ignore + + async def apply_slot_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + """Applies the configuration settings from the target slot onto the current slot. + + Applies the configuration settings from the target slot onto the current slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} # type: ignore + + async def backup_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Creates a backup of an app. + + Creates a backup of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + backup for the production slot. + :type slot: str + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} # type: ignore + + def list_backups_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_backups_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} # type: ignore + + async def get_backup_status_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + **kwargs + ) -> "models.BackupItem": + """Gets a backup of an app by its ID. + + Gets a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a backup + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_backup_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore + + async def delete_backup_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + **kwargs + ) -> None: + """Deletes a backup of an app by its ID. + + Deletes a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + backup of the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore + + async def list_backup_status_secrets_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param backup_id: ID of backup. + :type backup_id: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param request: Information on backup request. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} # type: ignore + + async def _restore_slot_initial( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + 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, {}) + + _restore_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + async def begin_restore_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a specific backup to another app (or deployment slot, if specified). + + Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_slot_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + def list_configurations_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigResourceCollection"]: + """List the configurations of an app. + + List the configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configurations_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteConfigResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} # type: ignore + + async def update_application_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the application settings of an app. + + Replaces the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + application settings for the production slot. + :type slot: str + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_application_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} # type: ignore + + async def list_application_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of an app. + + Gets the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + application settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_application_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} # type: ignore + + async def update_auth_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_auth_settings: "models.SiteAuthSettings", + **kwargs + ) -> "models.SiteAuthSettings": + """Updates the Authentication / Authorization settings associated with web app. + + Updates the Authentication / Authorization settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_auth_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} # type: ignore + + async def get_auth_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteAuthSettings": + """Gets the Authentication/Authorization settings of an app. + + Gets the Authentication/Authorization settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_auth_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} # type: ignore + + async def update_azure_storage_accounts_slot( + self, + resource_group_name: str, + name: str, + slot: str, + azure_storage_accounts: "models.AzureStoragePropertyDictionaryResource", + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Updates the Azure storage account configurations of an app. + + Updates the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. + :type slot: str + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts'} # type: ignore + + async def list_azure_storage_accounts_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Gets the Azure storage account configurations of an app. + + Gets the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list'} # type: ignore + + async def update_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupRequest": + """Updates the backup configuration of an app. + + Updates the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + backup configuration for the production slot. + :type slot: str + :param request: Edited backup configuration. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore + + async def delete_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes the backup configuration of an app. + + Deletes the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + backup configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore + + async def get_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.BackupRequest": + """Gets the backup configuration of an app. + + Gets the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + backup configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} # type: ignore + + async def update_connection_strings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_strings: "models.ConnectionStringDictionary", + **kwargs + ) -> "models.ConnectionStringDictionary": + """Replaces the connection strings of an app. + + Replaces the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + connection settings for the production slot. + :type slot: str + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_connection_strings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} # type: ignore + + async def list_connection_strings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.ConnectionStringDictionary": + """Gets the connection strings of an app. + + Gets the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + connection settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_connection_strings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} # type: ignore + + async def get_diagnostic_logs_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteLogsConfig": + """Gets the logging configuration of an app. + + Gets the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + logging configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore + + async def update_diagnostic_logs_config_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_logs_config: "models.SiteLogsConfig", + **kwargs + ) -> "models.SiteLogsConfig": + """Updates the logging configuration of an app. + + Updates the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + logging configuration for the production slot. + :type slot: str + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore + + async def update_metadata_slot( + self, + resource_group_name: str, + name: str, + slot: str, + metadata: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the metadata of an app. + + Replaces the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + metadata for the production slot. + :type slot: str + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_metadata_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(metadata, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} # type: ignore + + async def list_metadata_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the metadata of an app. + + Gets the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + metadata for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_metadata_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} # type: ignore + + async def _list_publishing_credentials_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.User": + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_publishing_credentials_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + async def begin_list_publishing_credentials_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncLROPoller["models.User"]: + """Gets the Git/FTP publishing credentials of an app. + + Gets the Git/FTP publishing credentials of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing credentials for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.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._list_publishing_credentials_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + async def update_site_push_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + push_settings: "models.PushSettings", + **kwargs + ) -> "models.PushSettings": + """Updates the Push settings associated with web app. + + Updates the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param push_settings: Push settings associated with web app. + :type push_settings: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_site_push_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(push_settings, 'PushSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} # type: ignore + + async def list_site_push_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PushSettings": + """Gets the Push settings associated with web app. + + Gets the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_site_push_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} # type: ignore + + async def get_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. + + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + async def create_or_update_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. + :type slot: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + async def update_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. + :type slot: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + def list_configuration_snapshot_info_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigurationSnapshotInfoCollection"]: + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. + + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configuration_snapshot_info_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteConfigurationSnapshotInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} # type: ignore + + async def get_configuration_snapshot_slot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + slot: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets a snapshot of the configuration of an app at a previous point in time. + + Gets a snapshot of the configuration of an app at a previous point in time. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} # type: ignore + + async def recover_site_configuration_snapshot_slot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + slot: str, + **kwargs + ) -> None: + """Reverts the configuration of an app to a previous snapshot. + + Reverts the configuration of an app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} # type: ignore + + async def get_web_site_container_logs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Gets the last lines of docker logs for the given site. + + Gets the last lines of docker logs for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/octet-stream' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} # type: ignore + + async def get_container_logs_zip_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Gets the ZIP archived docker log files for the given site. + + Gets the ZIP archived docker log files for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/zip' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} # type: ignore + + def list_continuous_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ContinuousWebJobCollection"]: + """List continuous web jobs for an app, or a deployment slot. + + List continuous web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_continuous_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ContinuousWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} # type: ignore + + async def get_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> Optional["models.ContinuousWebJob"]: + """Gets a continuous web job by its ID for an app, or a deployment slot. + + Gets a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ContinuousWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore + + async def delete_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a continuous web job by its ID for an app, or a deployment slot. + + Delete a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore + + async def start_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Start a continuous web job for an app, or a deployment slot. + + Start a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} # type: ignore + + async def stop_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Stop a continuous web job for an app, or a deployment slot. + + Stop a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} # type: ignore + + def list_deployments_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DeploymentCollection"]: + """List deployments for an app, or a deployment slot. + + List deployments for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_deployments_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DeploymentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} # type: ignore + + async def get_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> "models.Deployment": + """Get a deployment by its ID for an app, or a deployment slot. + + Get a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets a deployment + for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def create_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + deployment: "models.Deployment", + **kwargs + ) -> "models.Deployment": + """Create a deployment for an app, or a deployment slot. + + Create a deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: ID of an existing deployment. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API creates a + deployment for the production slot. + :type slot: str + :param deployment: Deployment details. + :type deployment: ~azure.mgmt.web.v2018_02_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def delete_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> None: + """Delete a deployment by its ID for an app, or a deployment slot. + + Delete a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def list_deployment_log_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> "models.Deployment": + """List deployment log for specific deployment for an app, or a deployment slot. + + List deployment log for specific deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_deployment_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} # type: ignore + + async def discover_backup_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreRequest": + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. + + Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to + get information about the databases stored in a backup. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will perform + discovery for the production slot. + :type slot: str + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.discover_backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + discover_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup'} # type: ignore + + def list_domain_ownership_identifiers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """Lists ownership identifiers for domain associated with web app. + + Lists ownership identifiers for domain associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_domain_ownership_identifiers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} # type: ignore + + async def get_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + **kwargs + ) -> "models.Identifier": + """Get domain ownership identifier for web app. + + Get domain ownership identifier for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def create_or_update_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def delete_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a domain ownership identifier for a web app. + + Deletes a domain ownership identifier for a web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def update_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def get_ms_deploy_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def _create_ms_deploy_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def begin_create_ms_deploy_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def get_ms_deploy_log_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_functions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.FunctionEnvelopeCollection"]: + """List the functions for a web site, or a deployment slot. + + List the functions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_functions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('FunctionEnvelopeCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} # type: ignore + + async def get_functions_admin_token_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> str: + """Fetch a short lived token that can be exchanged for a master key. + + Fetch a short lived token that can be exchanged for a master key. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} # type: ignore + + async def get_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> Optional["models.FunctionEnvelope"]: + """Get function information by its ID for web site, or a deployment slot. + + Get function information by its ID for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_function_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def _create_instance_function_slot_initial( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> "models.FunctionEnvelope": + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_function_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def begin_create_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> AsyncLROPoller["models.FunctionEnvelope"]: + """Create function for web site, or a deployment slot. + + Create function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :param function_envelope: Function details. + :type function_envelope: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.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_instance_function_slot_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + slot=slot, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def delete_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a function for web site, or a deployment slot. + + Delete a function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_instance_function_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def create_or_update_function_secret_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + slot: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a function secret. + + Add or update a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def delete_function_secret_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a function secret. + + Delete a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_function_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def list_function_keys_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Get function keys for a function in a web site, or a deployment slot. + + Get function keys for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_function_keys_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys'} # type: ignore + + async def list_function_secrets_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> "models.FunctionSecrets": + """Get function secrets for a function in a web site, or a deployment slot. + + Get function secrets for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_function_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} # type: ignore + + async def list_host_keys_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.HostKeys": + """Get host secrets for a function app. + + Get host secrets for a function app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_host_keys_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_host_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys'} # type: ignore + + async def list_sync_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """This is to allow calling via powershell and ARM template. + + This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_sync_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + list_sync_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus'} # type: ignore + + async def sync_functions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.sync_functions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync'} # type: ignore + + async def create_or_update_host_secret_slot( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + slot: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a host level secret. + + Add or update a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore + + async def delete_host_secret_slot( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a host level secret. + + Delete a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_host_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore + + def list_host_name_bindings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.HostNameBindingCollection"]: + """Get hostname bindings for an app or a deployment slot. + + Get hostname bindings for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_host_name_bindings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('HostNameBindingCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} # type: ignore + + async def get_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: str, + **kwargs + ) -> "models.HostNameBinding": + """Get the named hostname binding for an app (or deployment slot, if specified). + + Get the named hostname binding for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. + :type slot: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def create_or_update_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + host_name: str, + slot: str, + host_name_binding: "models.HostNameBinding", + **kwargs + ) -> "models.HostNameBinding": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. + :type slot: str + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def delete_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param host_name: Hostname in the hostname binding. + :type host_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def get_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def create_or_update_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> None: + """Removes a Hybrid Connection from this site. + + Removes a Hybrid Connection from this site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def update_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Gets the send key name and value for a Hybrid Connection. + + Gets the send key name and value for a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + async def list_hybrid_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves all Service Bus Hybrid Connections used by this Web App. + + Retrieves all Service Bus Hybrid Connections used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} # type: ignore + + async def list_relay_service_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Gets hybrid connections configured for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get hybrid + connections for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} # type: ignore + + async def get_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets a hybrid connection configuration by its name. + + Gets a hybrid connection configuration by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a hybrid + connection for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def create_or_update_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. + :type slot: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def delete_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a relay service connection by its name. + + Deletes a relay service connection by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + hybrid connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def update_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. + :type slot: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + def list_instance_identifiers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.WebAppInstanceCollection"]: + """Gets all scale-out instances of an app. + + Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_identifiers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('WebAppInstanceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} # type: ignore + + async def get_instance_ms_deploy_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def _create_instance_ms_deploy_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + 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 == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def begin_create_instance_ms_deploy_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_instance_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def get_instance_ms_deploy_log_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_processes_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_processes_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} # type: ignore + + async def get_instance_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def delete_instance_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_instance_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def get_instance_process_dump_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore + + def list_instance_process_modules_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_modules_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore + + async def get_instance_process_module_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_module_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_instance_process_threads_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_threads_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore + + async def get_instance_process_thread_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore + + async def is_cloneable_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteCloneability": + """Shows whether an app can be cloned to another resource group or subscription. + + Shows whether an app can be cloned to another resource group or subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. By default, this API returns information on the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.is_cloneable_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteCloneability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} # type: ignore + + async def list_sync_function_triggers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.FunctionSecrets": + """This is to allow calling via powershell and ARM template. + + This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} # type: ignore + + def list_metric_definitions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Gets all metric definitions of an app (or deployment slot, if specified). + + Gets all metric definitions of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metric + definitions of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metric_definitions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metric_definitions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions'} # type: ignore + + def list_metrics_slot( + self, + resource_group_name: str, + name: str, + slot: str, + details: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ResourceMetricCollection"]: + """Gets performance metrics of an app (or deployment slot, if specified). + + Gets performance metrics of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metrics + of the production slot. + :type slot: str + :param details: Specify "true" to include metric details in the response. It is "false" by + default. + :type details: bool + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_metrics_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_metrics_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics'} # type: ignore + + async def get_migrate_my_sql_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.MigrateMySqlStatus": + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. + + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} # type: ignore + + async def get_swift_virtual_network_connection_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Gets a Swift Virtual Network connection. + + Gets a Swift Virtual Network connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def create_or_update_swift_virtual_network_connection_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def delete_swift_virtual_network_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a Swift Virtual Network connection from an app (or deployment slot). + + Deletes a Swift Virtual Network connection from an app (or deployment slot). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_swift_virtual_network_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_swift_virtual_network_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def update_swift_virtual_network_connection_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def list_network_features_slot( + self, + resource_group_name: str, + name: str, + view: str, + slot: str, + **kwargs + ) -> Optional["models.NetworkFeatures"]: + """Gets all network features used by the app (or deployment slot, if specified). + + Gets all network features used by the app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param view: The type of view. This can either be "summary" or "detailed". + :type view: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get network + features for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_network_features_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'view': self._serialize.url("view", view, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('NetworkFeatures', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} # type: ignore + + async def get_network_trace_operation_slot( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}'} # type: ignore + + async def start_web_site_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> str: + """Start capturing network packets for the site (To be deprecated). + + Start capturing network packets for the site (To be deprecated). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} # type: ignore + + async def _start_web_site_network_trace_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_web_site_network_trace_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore + + async def begin_start_web_site_network_trace_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_web_site_network_trace_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore + + async def stop_web_site_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} # type: ignore + + async def get_network_traces_slot( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_traces_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}'} # type: ignore + + async def get_network_trace_operation_slot_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}'} # type: ignore + + async def get_network_traces_slot_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Gets a named operation for a network trace capturing (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}'} # type: ignore + + async def generate_new_site_publishing_password_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Generates a new publishing password for an app (or deployment slot, if specified). + + Generates a new publishing password for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API generate a new + publishing password for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} # type: ignore + + def list_perf_mon_counters_slot( + self, + resource_group_name: str, + name: str, + slot: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.PerfMonCounterCollection"]: + """Gets perfmon counters for web app. + + Gets perfmon counters for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_perf_mon_counters_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} # type: ignore + + async def get_site_php_error_log_flag_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SitePhpErrorLogFlag": + """Gets web app's event logs. + + Gets web app's event logs. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} # type: ignore + + async def list_premier_add_ons_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets the premier add-ons of an app. + + Gets the premier add-ons of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + premier add-ons for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} # type: ignore + + async def get_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets a named add-on of an app. + + Gets a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named add-on for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def add_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + premier_add_on: "models.PremierAddOn", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. + :type slot: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def delete_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a premier add-on from an app. + + Delete a premier add-on from an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + named add-on for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def update_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + premier_add_on: "models.PremierAddOnPatchResource", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. + :type slot: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def get_private_access_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PrivateAccess": + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. + + Gets data around private site access enablement and authorized Virtual Networks that can access + the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_private_access_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_access_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore + + async def put_private_access_vnet_slot( + self, + resource_group_name: str, + name: str, + slot: str, + access: "models.PrivateAccess", + **kwargs + ) -> "models.PrivateAccess": + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. + + Sets data around private site access enablement and authorized Virtual Networks that can access + the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param access: The information for the private access. + :type access: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(access, 'PrivateAccess') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_private_access_vnet_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore + + def list_processes_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_processes_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} # type: ignore + + async def get_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore + + async def delete_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore + + async def get_process_dump_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_dump_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} # type: ignore + + def list_process_modules_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_modules_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} # type: ignore + + async def get_process_module_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_module_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_process_threads_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + List the threads in a process by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_threads_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} # type: ignore + + async def get_process_thread_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + thread_id: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessThreadInfo"]: + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param thread_id: TID. + :type thread_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_process_thread_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'threadId': self._serialize.url("thread_id", thread_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('ProcessThreadInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads/{threadId}'} # type: ignore + + def list_public_certificates_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.PublicCertificateCollection"]: + """Get public certificates for an app or a deployment slot. + + Get public certificates for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_public_certificates_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('PublicCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} # type: ignore + + async def get_public_certificate_slot( + self, + resource_group_name: str, + name: str, + slot: str, + public_certificate_name: str, + **kwargs + ) -> "models.PublicCertificate": + """Get the named public certificate for an app (or deployment slot, if specified). + + Get the named public certificate for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. + :type slot: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def create_or_update_public_certificate_slot( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + slot: str, + public_certificate: "models.PublicCertificate", + **kwargs + ) -> "models.PublicCertificate": + """Creates a hostname binding for an app. + + Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. + :type slot: str + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(public_certificate, 'PublicCertificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def delete_public_certificate_slot( + self, + resource_group_name: str, + name: str, + slot: str, + public_certificate_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param public_certificate_name: Public certificate name. + :type public_certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def list_publishing_profile_xml_with_secrets_slot( + self, + resource_group_name: str, + name: str, + slot: str, + publishing_profile_options: "models.CsmPublishingProfileOptions", + **kwargs + ) -> IO: + """Gets the publishing profile for an app (or deployment slot, if specified). + + Gets the publishing profile for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing profile for the production slot. + :type slot: str + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2018_02_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} # type: ignore + + async def reset_slot_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. + + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API resets + configuration settings for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} # type: ignore + + async def restart_slot( + self, + resource_group_name: str, + name: str, + slot: str, + soft_restart: Optional[bool] = None, + synchronous: Optional[bool] = None, + **kwargs + ) -> None: + """Restarts an app (or deployment slot, if specified). + + Restarts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restart the + production slot. + :type slot: str + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. + :type soft_restart: bool + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). + :type synchronous: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.restart_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + if synchronous is not None: + query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} # type: ignore + + async def _restore_from_backup_blob_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_backup_blob_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + 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, {}) + + _restore_from_backup_blob_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore + + async def begin_restore_from_backup_blob_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores an app from a backup blob in Azure Storage. + + Restores an app from a backup blob in Azure Storage. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_backup_blob_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore + + async def _restore_from_deleted_app_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_deleted_app_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + 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]: + 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, {}) + + _restore_from_deleted_app_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore + + async def begin_restore_from_deleted_app_slot( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a deleted web app to this web app. + + Restores a deleted web app to this web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param restore_request: Deleted web app restore information. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_deleted_app_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore + + async def _restore_snapshot_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_snapshot_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + 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]: + 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, {}) + + _restore_snapshot_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore + + async def begin_restore_snapshot_slot( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a web app from a snapshot. + + Restores a web app from a snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_snapshot_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore + + def list_site_extensions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteExtensionInfoCollection"]: + """Get list of siteextensions for a web site, or a deployment slot. + + Get list of siteextensions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_extensions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteExtensionInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} # type: ignore + + async def get_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + """Get site extension information by its ID for a web site, or a deployment slot. + + Get site extension information by its ID for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_site_extension_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _install_site_extension_slot_initial( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 429]: + 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('SiteExtensionInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _install_site_extension_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def begin_install_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> AsyncLROPoller["models.SiteExtensionInfo"]: + """Install site extension on a web site, or a deployment slot. + + Install site extension on a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_slot_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def delete_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> None: + """Remove a site extension from a web site, or a deployment slot. + + Remove a site extension from a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_site_extension_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + 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_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + def list_slot_differences_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncIterable["models.SlotDifferenceCollection"]: + """Get the difference in configuration settings between two web app slots. + + Get the difference in configuration settings between two web app slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slot_differences_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} # type: ignore + + async def _swap_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._swap_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + _swap_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + async def begin_swap_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Swaps two deployment slots of an app. + + Swaps two deployment slots of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._swap_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + def list_snapshots_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user. + + Returns all Snapshots to the user. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :param slot: Website Slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} # type: ignore + + def list_snapshots_from_dr_secondary_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user from DRSecondary endpoint. + + Returns all Snapshots to the user from DRSecondary endpoint. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :param slot: Website Slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_from_dr_secondary_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr'} # type: ignore + + async def get_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteSourceControl": + """Gets the source control configuration of an app. + + Gets the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + source control configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def _create_or_update_source_control_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_source_control_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def begin_create_or_update_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> AsyncLROPoller["models.SiteSourceControl"]: + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. + :type slot: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.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_source_control_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def delete_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes the source control configuration of an app. + + Deletes the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + source control configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def update_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. + :type slot: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def start_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Starts an app (or deployment slot, if specified). + + Starts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will start the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.start_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} # type: ignore + + async def _start_network_trace_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_network_trace_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore + + async def begin_start_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_network_trace_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore + + async def stop_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stops an app (or deployment slot, if specified). + + Stops an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will stop the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} # type: ignore + + async def stop_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace'} # type: ignore + + async def sync_repository_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Sync web app repository. + + Sync web app repository. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.sync_repository_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} # type: ignore + + async def sync_function_triggers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.sync_function_triggers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} # type: ignore + + def list_triggered_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.TriggeredWebJobCollection"]: + """List triggered web jobs for an app, or a deployment slot. + + List triggered web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('TriggeredWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} # type: ignore + + async def get_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> Optional["models.TriggeredWebJob"]: + """Gets a triggered web job by its ID for an app, or a deployment slot. + + Gets a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore + + async def delete_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a triggered web job by its ID for an app, or a deployment slot. + + Delete a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore + + def list_triggered_web_job_history_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.TriggeredJobHistoryCollection"]: + """List a triggered web job's history for an app, or a deployment slot. + + List a triggered web job's history for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_job_history_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('TriggeredJobHistoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} # type: ignore + + async def get_triggered_web_job_history_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + id: str, + slot: str, + **kwargs + ) -> Optional["models.TriggeredJobHistory"]: + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param id: History ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredJobHistory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore + + async def run_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Run a triggered web job for an app, or a deployment slot. + + Run a triggered web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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, {}) + + run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} # type: ignore + + def list_usages_slot( + self, + resource_group_name: str, + name: str, + slot: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets the quota usage information of an app (or deployment slot, if specified). + + Gets the quota usage information of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get quota + information of the production slot. + :type slot: str + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} # type: ignore + + async def list_vnet_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Gets the virtual networks the app (or deployment slot) is connected to. + + Gets the virtual networks the app (or deployment slot) is connected to. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get virtual + network connections for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_vnet_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + **kwargs + ) -> "models.VnetInfo": + """Gets a virtual network the app (or deployment slot) is connected to by name. + + Gets a virtual network the app (or deployment slot) is connected to by name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named virtual network for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def create_or_update_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def delete_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Deletes a connection from an app (or deployment slot to a named virtual network. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def update_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + **kwargs + ) -> Optional["models.VnetGateway"]: + """Gets an app's Virtual Network gateway. + + Gets an app's Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def create_or_update_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. + :type slot: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. + :type slot: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + def list_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.WebJobCollection"]: + """List webjobs for an app, or a deployment slot. + + List webjobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('WebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} # type: ignore + + async def get_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> "models.WebJob": + """Get webjob information for an app, or a deployment slot. + + Get webjob information for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of the web job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} # type: ignore + + def list_slot_differences_from_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncIterable["models.SlotDifferenceCollection"]: + """Get the difference in configuration settings between two web app slots. + + Get the difference in configuration settings between two web app slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slot_differences_from_production.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} # type: ignore + + async def _swap_slot_with_production_initial( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + 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, {}) + + _swap_slot_with_production_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + async def begin_swap_slot_with_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Swaps two deployment slots of an app. + + Swaps two deployment slots of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._swap_slot_with_production_initial( + resource_group_name=resource_group_name, + name=name, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + def list_snapshots( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user. + + Returns all Snapshots to the user. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} # type: ignore + + def list_snapshots_from_dr_secondary( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user from DRSecondary endpoint. + + Returns all Snapshots to the user from DRSecondary endpoint. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_from_dr_secondary.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr'} # type: ignore + + async def get_source_control( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteSourceControl": + """Gets the source control configuration of an app. + + Gets the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def _create_or_update_source_control_initial( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_source_control_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def begin_create_or_update_source_control( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> AsyncLROPoller["models.SiteSourceControl"]: + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.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_source_control_initial( + resource_group_name=resource_group_name, + name=name, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def delete_source_control( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes the source control configuration of an app. + + Deletes the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def update_source_control( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + """Updates the source control configuration of an app. + + Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def start( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Starts an app (or deployment slot, if specified). + + Starts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.start.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} # type: ignore + + async def _start_network_trace_initial( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self._start_network_trace_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_network_trace_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore + + async def begin_start_network_trace( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_network_trace_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore + + async def stop( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stops an app (or deployment slot, if specified). + + Stops an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} # type: ignore + + async def stop_network_trace( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.stop_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace'} # type: ignore + + async def sync_repository( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Sync web app repository. + + Sync web app repository. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.sync_repository.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + 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, {}) + + sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} # type: ignore + + async def sync_function_triggers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.sync_function_triggers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [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, {}) + + sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} # type: ignore + + def list_triggered_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.TriggeredWebJobCollection"]: + """List triggered web jobs for an app, or a deployment slot. + + List triggered web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('TriggeredWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} # type: ignore + + async def get_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> Optional["models.TriggeredWebJob"]: + """Gets a triggered web job by its ID for an app, or a deployment slot. + + Gets a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore + + async def delete_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Delete a triggered web job by its ID for an app, or a deployment slot. + + Delete a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore + + def list_triggered_web_job_history( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> AsyncIterable["models.TriggeredJobHistoryCollection"]: + """List a triggered web job's history for an app, or a deployment slot. + + List a triggered web job's history for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_job_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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: + 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('TriggeredJobHistoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} # type: ignore + + async def get_triggered_web_job_history( + self, + resource_group_name: str, + name: str, + web_job_name: str, + id: str, + **kwargs + ) -> Optional["models.TriggeredJobHistory"]: + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param id: History ID. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_triggered_web_job_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('TriggeredJobHistory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore + + async def run_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Run a triggered web job for an app, or a deployment slot. + + Run a triggered web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.run_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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, {}) + + run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets the quota usage information of an app (or deployment slot, if specified). + + Gets the quota usage information of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} # type: ignore + + async def list_vnet_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Gets the virtual networks the app (or deployment slot) is connected to. + + Gets the virtual networks the app (or deployment slot) is connected to. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_vnet_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> "models.VnetInfo": + """Gets a virtual network the app (or deployment slot) is connected to by name. + + Gets a virtual network the app (or deployment slot) is connected to by name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def create_or_update_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def delete_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> None: + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Deletes a connection from an app (or deployment slot to a named virtual network. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.delete_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + 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_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def update_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + **kwargs + ) -> Optional["models.VnetGateway"]: + """Gets an app's Virtual Network gateway. + + Gets an app's Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + 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('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def create_or_update_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + def list_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebJobCollection"]: + """List webjobs for an app, or a deployment slot. + + List webjobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} # type: ignore + + async def get_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> "models.WebJob": + """Get webjob information for an app, or a deployment slot. + + Get webjob information for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of the web job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py new file mode 100644 index 000000000000..873bf5825680 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py @@ -0,0 +1,1079 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebSiteManagementClientOperationsMixin: + + async def get_publishing_user( + self, + **kwargs + ) -> "models.User": + """Gets publishing user. + + Gets publishing user. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_publishing_user.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'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore + + async def update_publishing_user( + self, + user_details: "models.User", + **kwargs + ) -> "models.User": + """Updates publishing user. + + Updates publishing user. + + :param user_details: Details of publishing user. + :type user_details: ~azure.mgmt.web.v2018_02_01.models.User + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_publishing_user.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_details, 'User') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore + + def list_source_controls( + self, + **kwargs + ) -> AsyncIterable["models.SourceControlCollection"]: + """Gets the source controls available for Azure websites. + + Gets the source controls available for Azure websites. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_source_controls.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: + 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('SourceControlCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} # type: ignore + + async def get_source_control( + self, + source_control_type: str, + **kwargs + ) -> "models.SourceControl": + """Gets source control token. + + Gets source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore + + async def update_source_control( + self, + source_control_type: str, + request_message: "models.SourceControl", + **kwargs + ) -> "models.SourceControl": + """Updates source control token. + + Updates source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2018_02_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request_message, 'SourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore + + def list_billing_meters( + self, + billing_location: Optional[str] = None, + os_type: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.BillingMeterCollection"]: + """Gets a list of meters for a given location. + + Gets a list of meters for a given location. + + :param billing_location: Azure Location of billable resource. + :type billing_location: str + :param os_type: App Service OS type meters used for. + :type os_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_billing_meters.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] + if billing_location is not None: + query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') + if os_type is not None: + query_parameters['osType'] = self._serialize.query("os_type", os_type, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BillingMeterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_billing_meters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} # type: ignore + + async def check_name_availability( + self, + name: str, + type: Union[str, "models.CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ) -> "models.ResourceNameAvailability": + """Check if a resource name is available. + + Check if a resource name is available. + + :param name: Resource name to verify. + :type name: str + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes + :param is_fqdn: Is fully qualified domain name. + :type is_fqdn: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceNameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} # type: ignore + + async def get_subscription_deployment_locations( + self, + **kwargs + ) -> "models.DeploymentLocations": + """Gets list of available geo regions plus ministamps. + + Gets list of available geo regions plus ministamps. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.get_subscription_deployment_locations.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentLocations', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} # type: ignore + + def list_geo_regions( + self, + sku: Optional[Union[str, "models.SkuName"]] = None, + linux_workers_enabled: Optional[bool] = None, + xenon_workers_enabled: Optional[bool] = None, + linux_dynamic_workers_enabled: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.GeoRegionCollection"]: + """Get a list of available geographical regions. + + Get a list of available geographical regions. + + :param sku: Name of SKU used to filter the regions. + :type sku: str or ~azure.mgmt.web.v2018_02_01.models.SkuName + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. + :type linux_workers_enabled: bool + :param xenon_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Xenon workers. + :type xenon_workers_enabled: bool + :param linux_dynamic_workers_enabled: Specify :code:`true` if you want to filter + to only regions that support Linux Consumption Workers. + :type linux_dynamic_workers_enabled: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_geo_regions.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] + if sku is not None: + query_parameters['sku'] = self._serialize.query("sku", sku, 'str') + if linux_workers_enabled is not None: + query_parameters['linuxWorkersEnabled'] = self._serialize.query("linux_workers_enabled", linux_workers_enabled, 'bool') + if xenon_workers_enabled is not None: + query_parameters['xenonWorkersEnabled'] = self._serialize.query("xenon_workers_enabled", xenon_workers_enabled, 'bool') + if linux_dynamic_workers_enabled is not None: + query_parameters['linuxDynamicWorkersEnabled'] = self._serialize.query("linux_dynamic_workers_enabled", linux_dynamic_workers_enabled, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GeoRegionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} # type: ignore + + def list_site_identifiers_assigned_to_host_name( + self, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """List all apps that are assigned to a hostname. + + List all apps that are assigned to a hostname. + + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_identifiers_assigned_to_host_name.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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} # type: ignore + + def list_premier_add_on_offers( + self, + **kwargs + ) -> AsyncIterable["models.PremierAddOnOfferCollection"]: + """List all premier add-on offers. + + List all premier add-on offers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_premier_add_on_offers.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: + 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('PremierAddOnOfferCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} # type: ignore + + async def list_skus( + self, + **kwargs + ) -> "models.SkuInfos": + """List all SKUs. + + List all SKUs. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + + # Construct URL + url = self.list_skus.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SkuInfos', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} # type: ignore + + async def verify_hosting_environment_vnet( + self, + parameters: "models.VnetParameters", + **kwargs + ) -> "models.VnetValidationFailureDetails": + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + + Verifies if this VNET is compatible with an App Service Environment by analyzing the Network + Security Group rules. + + :param parameters: VNET information. + :type parameters: ~azure.mgmt.web.v2018_02_01.models.VnetParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.verify_hosting_environment_vnet.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VnetParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetValidationFailureDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} # type: ignore + + async def move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Move resources between resource groups. + + Move resources between resource groups. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.move.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + 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 [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, {}) + + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} # type: ignore + + async def validate( + self, + resource_group_name: str, + validate_request: "models.ValidateRequest", + **kwargs + ) -> "models.ValidateResponse": + """Validate if a resource can be created. + + Validate if a resource can be created. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param validate_request: Request with the resources to validate. + :type validate_request: ~azure.mgmt.web.v2018_02_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_request, 'ValidateRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ValidateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} # type: ignore + + async def validate_container_settings( + self, + resource_group_name: str, + validate_container_settings_request: "models.ValidateContainerSettingsRequest", + **kwargs + ) -> object: + """Validate if the container settings are correct. + + Validate if the container settings are correct. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param validate_container_settings_request: + :type validate_container_settings_request: ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_container_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_container_settings_request, 'ValidateContainerSettingsRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate_container_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validateContainerSettings'} # type: ignore + + async def validate_move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Validate whether a resource can be moved. + + Validate whether a resource can be moved. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_move.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + 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 [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, {}) + + validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/__init__.py index f46b704fcf8f..94dfbc78260e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: @@ -16,18 +13,23 @@ from ._models_py3 import AnalysisData from ._models_py3 import AnalysisDefinition from ._models_py3 import ApiDefinitionInfo - from ._models_py3 import ApplicationLogsConfig - from ._models_py3 import ApplicationStack from ._models_py3 import AppServiceCertificate + from ._models_py3 import AppServiceCertificateCollection from ._models_py3 import AppServiceCertificateOrder + from ._models_py3 import AppServiceCertificateOrderCollection from ._models_py3 import AppServiceCertificateOrderPatchResource from ._models_py3 import AppServiceCertificatePatchResource from ._models_py3 import AppServiceCertificateResource from ._models_py3 import AppServiceEnvironment + from ._models_py3 import AppServiceEnvironmentCollection from ._models_py3 import AppServiceEnvironmentPatchResource from ._models_py3 import AppServiceEnvironmentResource from ._models_py3 import AppServicePlan + from ._models_py3 import AppServicePlanCollection from ._models_py3 import AppServicePlanPatchResource + from ._models_py3 import ApplicationLogsConfig + from ._models_py3 import ApplicationStack + from ._models_py3 import ApplicationStackCollection from ._models_py3 import AutoHealActions from ._models_py3 import AutoHealCustomAction from ._models_py3 import AutoHealRules @@ -38,56 +40,71 @@ from ._models_py3 import AzureStoragePropertyDictionaryResource from ._models_py3 import AzureTableStorageApplicationLogsConfig from ._models_py3 import BackupItem + from ._models_py3 import BackupItemCollection from ._models_py3 import BackupRequest from ._models_py3 import BackupSchedule from ._models_py3 import BillingMeter + from ._models_py3 import BillingMeterCollection from ._models_py3 import Capability from ._models_py3 import Certificate + from ._models_py3 import CertificateCollection from ._models_py3 import CertificateDetails from ._models_py3 import CertificateEmail from ._models_py3 import CertificateOrderAction from ._models_py3 import CertificatePatchResource from ._models_py3 import CloningInfo - from ._models_py3 import ConnectionStringDictionary + from ._models_py3 import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties from ._models_py3 import ConnStringInfo from ._models_py3 import ConnStringValueTypePair + from ._models_py3 import ConnectionStringDictionary from ._models_py3 import Contact from ._models_py3 import ContinuousWebJob + from ._models_py3 import ContinuousWebJobCollection from ._models_py3 import CorsSettings from ._models_py3 import CsmMoveResourceEnvelope + from ._models_py3 import CsmOperationCollection from ._models_py3 import CsmOperationDescription from ._models_py3 import CsmOperationDescriptionProperties from ._models_py3 import CsmOperationDisplay from ._models_py3 import CsmPublishingProfileOptions from ._models_py3 import CsmSlotEntity from ._models_py3 import CsmUsageQuota + from ._models_py3 import CsmUsageQuotaCollection from ._models_py3 import CustomHostnameAnalysisResult - from ._models_py3 import DatabaseBackupSetting from ._models_py3 import DataSource from ._models_py3 import DataTableResponseColumn from ._models_py3 import DataTableResponseObject - from ._models_py3 import DefaultErrorResponse, DefaultErrorResponseException + from ._models_py3 import DatabaseBackupSetting + from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem from ._models_py3 import DeletedAppRestoreRequest from ._models_py3 import DeletedSite + from ._models_py3 import DeletedWebAppCollection from ._models_py3 import Deployment + from ._models_py3 import DeploymentCollection from ._models_py3 import DeploymentLocations from ._models_py3 import DetectorAbnormalTimePeriod from ._models_py3 import DetectorDefinition from ._models_py3 import DetectorInfo from ._models_py3 import DetectorResponse + from ._models_py3 import DetectorResponseCollection from ._models_py3 import DiagnosticAnalysis + from ._models_py3 import DiagnosticAnalysisCollection from ._models_py3 import DiagnosticCategory + from ._models_py3 import DiagnosticCategoryCollection from ._models_py3 import DiagnosticData + from ._models_py3 import DiagnosticDetectorCollection from ._models_py3 import DiagnosticDetectorResponse from ._models_py3 import DiagnosticMetricSample from ._models_py3 import DiagnosticMetricSet from ._models_py3 import Dimension from ._models_py3 import Domain from ._models_py3 import DomainAvailablilityCheckResult + from ._models_py3 import DomainCollection from ._models_py3 import DomainControlCenterSsoRequest from ._models_py3 import DomainOwnershipIdentifier + from ._models_py3 import DomainOwnershipIdentifierCollection from ._models_py3 import DomainPatchResource from ._models_py3 import DomainPurchaseConsent from ._models_py3 import DomainRecommendationSearchParameters @@ -99,64 +116,78 @@ from ._models_py3 import FileSystemApplicationLogsConfig from ._models_py3 import FileSystemHttpLogsConfig from ._models_py3 import FunctionEnvelope + from ._models_py3 import FunctionEnvelopeCollection from ._models_py3 import FunctionSecrets from ._models_py3 import GeoDistribution from ._models_py3 import GeoRegion + from ._models_py3 import GeoRegionCollection from ._models_py3 import GlobalCsmSkuDescription from ._models_py3 import HandlerMapping - from ._models_py3 import HostingEnvironmentDeploymentInfo - from ._models_py3 import HostingEnvironmentDiagnostics - from ._models_py3 import HostingEnvironmentProfile from ._models_py3 import HostKeys from ._models_py3 import HostName from ._models_py3 import HostNameBinding + from ._models_py3 import HostNameBindingCollection from ._models_py3 import HostNameSslState + from ._models_py3 import HostingEnvironmentDeploymentInfo + from ._models_py3 import HostingEnvironmentDiagnostics + from ._models_py3 import HostingEnvironmentProfile from ._models_py3 import HttpLogsConfig from ._models_py3 import HybridConnection + from ._models_py3 import HybridConnectionCollection from ._models_py3 import HybridConnectionKey from ._models_py3 import HybridConnectionLimits from ._models_py3 import Identifier + from ._models_py3 import IdentifierCollection from ._models_py3 import InboundEnvironmentEndpoint + from ._models_py3 import InboundEnvironmentEndpointCollection from ._models_py3 import IpSecurityRestriction from ._models_py3 import KeyInfo from ._models_py3 import LocalizableString from ._models_py3 import LogSpecification + from ._models_py3 import MSDeploy + from ._models_py3 import MSDeployLog + from ._models_py3 import MSDeployLogEntry + from ._models_py3 import MSDeployStatus from ._models_py3 import ManagedServiceIdentity - from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue from ._models_py3 import MetricAvailabilily from ._models_py3 import MetricAvailability from ._models_py3 import MetricDefinition from ._models_py3 import MetricSpecification from ._models_py3 import MigrateMySqlRequest from ._models_py3 import MigrateMySqlStatus - from ._models_py3 import MSDeploy - from ._models_py3 import MSDeployLog - from ._models_py3 import MSDeployLogEntry - from ._models_py3 import MSDeployStatus from ._models_py3 import NameIdentifier + from ._models_py3 import NameIdentifierCollection from ._models_py3 import NameValuePair from ._models_py3 import NetworkAccessControlEntry from ._models_py3 import NetworkFeatures from ._models_py3 import NetworkTrace from ._models_py3 import Operation from ._models_py3 import OutboundEnvironmentEndpoint + from ._models_py3 import OutboundEnvironmentEndpointCollection + from ._models_py3 import PerfMonCounterCollection from ._models_py3 import PerfMonResponse from ._models_py3 import PerfMonSample from ._models_py3 import PerfMonSet from ._models_py3 import PremierAddOn from ._models_py3 import PremierAddOnOffer + from ._models_py3 import PremierAddOnOfferCollection from ._models_py3 import PremierAddOnPatchResource from ._models_py3 import PrivateAccess from ._models_py3 import PrivateAccessSubnet from ._models_py3 import PrivateAccessVirtualNetwork from ._models_py3 import ProcessInfo + from ._models_py3 import ProcessInfoCollection from ._models_py3 import ProcessModuleInfo + from ._models_py3 import ProcessModuleInfoCollection from ._models_py3 import ProcessThreadInfo + from ._models_py3 import ProcessThreadInfoCollection from ._models_py3 import ProxyOnlyResource from ._models_py3 import PublicCertificate + from ._models_py3 import PublicCertificateCollection from ._models_py3 import PushSettings from ._models_py3 import RampUpRule from ._models_py3 import Recommendation + from ._models_py3 import RecommendationCollection from ._models_py3 import RecommendationRule from ._models_py3 import ReissueCertificateOrderRequest from ._models_py3 import RelayServiceConnectionEntity @@ -164,10 +195,14 @@ from ._models_py3 import RenewCertificateOrderRequest from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource + from ._models_py3 import ResourceCollection from ._models_py3 import ResourceHealthMetadata + from ._models_py3 import ResourceHealthMetadataCollection from ._models_py3 import ResourceMetric from ._models_py3 import ResourceMetricAvailability + from ._models_py3 import ResourceMetricCollection from ._models_py3 import ResourceMetricDefinition + from ._models_py3 import ResourceMetricDefinitionCollection from ._models_py3 import ResourceMetricName from ._models_py3 import ResourceMetricProperty from ._models_py3 import ResourceMetricValue @@ -182,8 +217,11 @@ from ._models_py3 import SiteCloneabilityCriterion from ._models_py3 import SiteConfig from ._models_py3 import SiteConfigResource + from ._models_py3 import SiteConfigResourceCollection from ._models_py3 import SiteConfigurationSnapshotInfo + from ._models_py3 import SiteConfigurationSnapshotInfoCollection from ._models_py3 import SiteExtensionInfo + from ._models_py3 import SiteExtensionInfoCollection from ._models_py3 import SiteInstance from ._models_py3 import SiteLimits from ._models_py3 import SiteLogsConfig @@ -196,31 +234,41 @@ from ._models_py3 import SkuCapacity from ._models_py3 import SkuDescription from ._models_py3 import SkuInfo + from ._models_py3 import SkuInfoCollection from ._models_py3 import SkuInfos from ._models_py3 import SlotConfigNamesResource from ._models_py3 import SlotDifference + from ._models_py3 import SlotDifferenceCollection from ._models_py3 import SlotSwapStatus from ._models_py3 import SlowRequestsBasedTrigger from ._models_py3 import Snapshot + from ._models_py3 import SnapshotCollection from ._models_py3 import SnapshotRecoverySource from ._models_py3 import SnapshotRestoreRequest from ._models_py3 import Solution from ._models_py3 import SourceControl + from ._models_py3 import SourceControlCollection from ._models_py3 import StackMajorVersion from ._models_py3 import StackMinorVersion from ._models_py3 import StampCapacity + from ._models_py3 import StampCapacityCollection from ._models_py3 import StatusCodesBasedTrigger from ._models_py3 import StorageMigrationOptions from ._models_py3 import StorageMigrationResponse from ._models_py3 import StringDictionary from ._models_py3 import SwiftVirtualNetwork from ._models_py3 import TldLegalAgreement + from ._models_py3 import TldLegalAgreementCollection from ._models_py3 import TopLevelDomain from ._models_py3 import TopLevelDomainAgreementOption + from ._models_py3 import TopLevelDomainCollection from ._models_py3 import TriggeredJobHistory + from ._models_py3 import TriggeredJobHistoryCollection from ._models_py3 import TriggeredJobRun from ._models_py3 import TriggeredWebJob + from ._models_py3 import TriggeredWebJobCollection from ._models_py3 import Usage + from ._models_py3 import UsageCollection from ._models_py3 import User from ._models_py3 import ValidateContainerSettingsRequest from ._models_py3 import ValidateRequest @@ -237,360 +285,369 @@ from ._models_py3 import VnetValidationFailureDetails from ._models_py3 import VnetValidationTestFailure from ._models_py3 import WebAppCollection + from ._models_py3 import WebAppInstanceCollection from ._models_py3 import WebJob + from ._models_py3 import WebJobCollection from ._models_py3 import WorkerPool + from ._models_py3 import WorkerPoolCollection from ._models_py3 import WorkerPoolResource except (SyntaxError, ImportError): - from ._models import AbnormalTimePeriod - from ._models import Address - from ._models import AddressResponse - from ._models import AnalysisData - from ._models import AnalysisDefinition - from ._models import ApiDefinitionInfo - from ._models import ApplicationLogsConfig - from ._models import ApplicationStack - from ._models import AppServiceCertificate - from ._models import AppServiceCertificateOrder - from ._models import AppServiceCertificateOrderPatchResource - from ._models import AppServiceCertificatePatchResource - from ._models import AppServiceCertificateResource - from ._models import AppServiceEnvironment - from ._models import AppServiceEnvironmentPatchResource - from ._models import AppServiceEnvironmentResource - from ._models import AppServicePlan - from ._models import AppServicePlanPatchResource - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import AzureBlobStorageApplicationLogsConfig - from ._models import AzureBlobStorageHttpLogsConfig - from ._models import AzureStorageInfoValue - from ._models import AzureStoragePropertyDictionaryResource - from ._models import AzureTableStorageApplicationLogsConfig - from ._models import BackupItem - from ._models import BackupRequest - from ._models import BackupSchedule - from ._models import BillingMeter - from ._models import Capability - from ._models import Certificate - from ._models import CertificateDetails - from ._models import CertificateEmail - from ._models import CertificateOrderAction - from ._models import CertificatePatchResource - from ._models import CloningInfo - from ._models import ConnectionStringDictionary - from ._models import ConnStringInfo - from ._models import ConnStringValueTypePair - from ._models import Contact - from ._models import ContinuousWebJob - from ._models import CorsSettings - from ._models import CsmMoveResourceEnvelope - from ._models import CsmOperationDescription - from ._models import CsmOperationDescriptionProperties - from ._models import CsmOperationDisplay - from ._models import CsmPublishingProfileOptions - from ._models import CsmSlotEntity - from ._models import CsmUsageQuota - from ._models import CustomHostnameAnalysisResult - from ._models import DatabaseBackupSetting - from ._models import DataSource - from ._models import DataTableResponseColumn - from ._models import DataTableResponseObject - from ._models import DefaultErrorResponse, DefaultErrorResponseException - from ._models import DefaultErrorResponseError - from ._models import DefaultErrorResponseErrorDetailsItem - from ._models import DeletedAppRestoreRequest - from ._models import DeletedSite - from ._models import Deployment - from ._models import DeploymentLocations - from ._models import DetectorAbnormalTimePeriod - from ._models import DetectorDefinition - from ._models import DetectorInfo - from ._models import DetectorResponse - from ._models import DiagnosticAnalysis - from ._models import DiagnosticCategory - from ._models import DiagnosticData - from ._models import DiagnosticDetectorResponse - from ._models import DiagnosticMetricSample - from ._models import DiagnosticMetricSet - from ._models import Dimension - from ._models import Domain - from ._models import DomainAvailablilityCheckResult - from ._models import DomainControlCenterSsoRequest - from ._models import DomainOwnershipIdentifier - from ._models import DomainPatchResource - from ._models import DomainPurchaseConsent - from ._models import DomainRecommendationSearchParameters - from ._models import EnabledConfig - from ._models import EndpointDependency - from ._models import EndpointDetail - from ._models import ErrorEntity - from ._models import Experiments - from ._models import FileSystemApplicationLogsConfig - from ._models import FileSystemHttpLogsConfig - from ._models import FunctionEnvelope - from ._models import FunctionSecrets - from ._models import GeoDistribution - from ._models import GeoRegion - from ._models import GlobalCsmSkuDescription - from ._models import HandlerMapping - from ._models import HostingEnvironmentDeploymentInfo - from ._models import HostingEnvironmentDiagnostics - from ._models import HostingEnvironmentProfile - from ._models import HostKeys - from ._models import HostName - from ._models import HostNameBinding - from ._models import HostNameSslState - from ._models import HttpLogsConfig - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import HybridConnectionLimits - from ._models import Identifier - from ._models import InboundEnvironmentEndpoint - from ._models import IpSecurityRestriction - from ._models import KeyInfo - from ._models import LocalizableString - from ._models import LogSpecification - from ._models import ManagedServiceIdentity - from ._models import ManagedServiceIdentityUserAssignedIdentitiesValue - from ._models import MetricAvailabilily - from ._models import MetricAvailability - from ._models import MetricDefinition - from ._models import MetricSpecification - from ._models import MigrateMySqlRequest - from ._models import MigrateMySqlStatus - from ._models import MSDeploy - from ._models import MSDeployLog - from ._models import MSDeployLogEntry - from ._models import MSDeployStatus - from ._models import NameIdentifier - from ._models import NameValuePair - from ._models import NetworkAccessControlEntry - from ._models import NetworkFeatures - from ._models import NetworkTrace - from ._models import Operation - from ._models import OutboundEnvironmentEndpoint - from ._models import PerfMonResponse - from ._models import PerfMonSample - from ._models import PerfMonSet - from ._models import PremierAddOn - from ._models import PremierAddOnOffer - from ._models import PremierAddOnPatchResource - from ._models import PrivateAccess - from ._models import PrivateAccessSubnet - from ._models import PrivateAccessVirtualNetwork - from ._models import ProcessInfo - from ._models import ProcessModuleInfo - from ._models import ProcessThreadInfo - from ._models import ProxyOnlyResource - from ._models import PublicCertificate - from ._models import PushSettings - from ._models import RampUpRule - from ._models import Recommendation - from ._models import RecommendationRule - from ._models import ReissueCertificateOrderRequest - from ._models import RelayServiceConnectionEntity - from ._models import Rendering - from ._models import RenewCertificateOrderRequest - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceHealthMetadata - from ._models import ResourceMetric - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import ResourceMetricName - from ._models import ResourceMetricProperty - from ._models import ResourceMetricValue - from ._models import ResourceNameAvailability - from ._models import ResourceNameAvailabilityRequest - from ._models import ResponseMetaData - from ._models import RestoreRequest - from ._models import ServiceSpecification - from ._models import Site - from ._models import SiteAuthSettings - from ._models import SiteCloneability - from ._models import SiteCloneabilityCriterion - from ._models import SiteConfig - from ._models import SiteConfigResource - from ._models import SiteConfigurationSnapshotInfo - from ._models import SiteExtensionInfo - from ._models import SiteInstance - from ._models import SiteLimits - from ._models import SiteLogsConfig - from ._models import SiteMachineKey - from ._models import SitePatchResource - from ._models import SitePhpErrorLogFlag - from ._models import SiteSeal - from ._models import SiteSealRequest - from ._models import SiteSourceControl - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SkuInfo - from ._models import SkuInfos - from ._models import SlotConfigNamesResource - from ._models import SlotDifference - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import Snapshot - from ._models import SnapshotRecoverySource - from ._models import SnapshotRestoreRequest - from ._models import Solution - from ._models import SourceControl - from ._models import StackMajorVersion - from ._models import StackMinorVersion - from ._models import StampCapacity - from ._models import StatusCodesBasedTrigger - from ._models import StorageMigrationOptions - from ._models import StorageMigrationResponse - from ._models import StringDictionary - from ._models import SwiftVirtualNetwork - from ._models import TldLegalAgreement - from ._models import TopLevelDomain - from ._models import TopLevelDomainAgreementOption - from ._models import TriggeredJobHistory - from ._models import TriggeredJobRun - from ._models import TriggeredWebJob - from ._models import Usage - from ._models import User - from ._models import ValidateContainerSettingsRequest - from ._models import ValidateRequest - from ._models import ValidateResponse - from ._models import ValidateResponseError - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VirtualIPMapping - from ._models import VirtualNetworkProfile - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetParameters - from ._models import VnetRoute - from ._models import VnetValidationFailureDetails - from ._models import VnetValidationTestFailure - from ._models import WebAppCollection - from ._models import WebJob - from ._models import WorkerPool - from ._models import WorkerPoolResource -from ._paged_models import AnalysisDefinitionPaged -from ._paged_models import ApplicationStackPaged -from ._paged_models import AppServiceCertificateOrderPaged -from ._paged_models import AppServiceCertificateResourcePaged -from ._paged_models import AppServiceEnvironmentResourcePaged -from ._paged_models import AppServicePlanPaged -from ._paged_models import BackupItemPaged -from ._paged_models import BillingMeterPaged -from ._paged_models import CertificatePaged -from ._paged_models import ContinuousWebJobPaged -from ._paged_models import CsmOperationDescriptionPaged -from ._paged_models import CsmUsageQuotaPaged -from ._paged_models import DeletedSitePaged -from ._paged_models import DeploymentPaged -from ._paged_models import DetectorDefinitionPaged -from ._paged_models import DetectorResponsePaged -from ._paged_models import DiagnosticCategoryPaged -from ._paged_models import DomainOwnershipIdentifierPaged -from ._paged_models import DomainPaged -from ._paged_models import FunctionEnvelopePaged -from ._paged_models import GeoRegionPaged -from ._paged_models import HostNameBindingPaged -from ._paged_models import HybridConnectionPaged -from ._paged_models import IdentifierPaged -from ._paged_models import InboundEnvironmentEndpointPaged -from ._paged_models import NameIdentifierPaged -from ._paged_models import OutboundEnvironmentEndpointPaged -from ._paged_models import PerfMonResponsePaged -from ._paged_models import PremierAddOnOfferPaged -from ._paged_models import ProcessInfoPaged -from ._paged_models import ProcessModuleInfoPaged -from ._paged_models import ProcessThreadInfoPaged -from ._paged_models import PublicCertificatePaged -from ._paged_models import RecommendationPaged -from ._paged_models import ResourceHealthMetadataPaged -from ._paged_models import ResourceMetricDefinitionPaged -from ._paged_models import ResourceMetricPaged -from ._paged_models import SiteConfigResourcePaged -from ._paged_models import SiteConfigurationSnapshotInfoPaged -from ._paged_models import SiteExtensionInfoPaged -from ._paged_models import SiteInstancePaged -from ._paged_models import SitePaged -from ._paged_models import SkuInfoPaged -from ._paged_models import SlotDifferencePaged -from ._paged_models import SnapshotPaged -from ._paged_models import SourceControlPaged -from ._paged_models import StampCapacityPaged -from ._paged_models import StrPaged -from ._paged_models import TldLegalAgreementPaged -from ._paged_models import TopLevelDomainPaged -from ._paged_models import TriggeredJobHistoryPaged -from ._paged_models import TriggeredWebJobPaged -from ._paged_models import UsagePaged -from ._paged_models import WebJobPaged -from ._paged_models import WorkerPoolResourcePaged + from ._models import AbnormalTimePeriod # type: ignore + from ._models import Address # type: ignore + from ._models import AddressResponse # type: ignore + from ._models import AnalysisData # type: ignore + from ._models import AnalysisDefinition # type: ignore + from ._models import ApiDefinitionInfo # type: ignore + from ._models import AppServiceCertificate # type: ignore + from ._models import AppServiceCertificateCollection # type: ignore + from ._models import AppServiceCertificateOrder # type: ignore + from ._models import AppServiceCertificateOrderCollection # type: ignore + from ._models import AppServiceCertificateOrderPatchResource # type: ignore + from ._models import AppServiceCertificatePatchResource # type: ignore + from ._models import AppServiceCertificateResource # type: ignore + from ._models import AppServiceEnvironment # type: ignore + from ._models import AppServiceEnvironmentCollection # type: ignore + from ._models import AppServiceEnvironmentPatchResource # type: ignore + from ._models import AppServiceEnvironmentResource # type: ignore + from ._models import AppServicePlan # type: ignore + from ._models import AppServicePlanCollection # type: ignore + from ._models import AppServicePlanPatchResource # type: ignore + from ._models import ApplicationLogsConfig # type: ignore + from ._models import ApplicationStack # type: ignore + from ._models import ApplicationStackCollection # type: ignore + from ._models import AutoHealActions # type: ignore + from ._models import AutoHealCustomAction # type: ignore + from ._models import AutoHealRules # type: ignore + from ._models import AutoHealTriggers # type: ignore + from ._models import AzureBlobStorageApplicationLogsConfig # type: ignore + from ._models import AzureBlobStorageHttpLogsConfig # type: ignore + from ._models import AzureStorageInfoValue # type: ignore + from ._models import AzureStoragePropertyDictionaryResource # type: ignore + from ._models import AzureTableStorageApplicationLogsConfig # type: ignore + from ._models import BackupItem # type: ignore + from ._models import BackupItemCollection # type: ignore + from ._models import BackupRequest # type: ignore + from ._models import BackupSchedule # type: ignore + from ._models import BillingMeter # type: ignore + from ._models import BillingMeterCollection # type: ignore + from ._models import Capability # type: ignore + from ._models import Certificate # type: ignore + from ._models import CertificateCollection # type: ignore + from ._models import CertificateDetails # type: ignore + from ._models import CertificateEmail # type: ignore + from ._models import CertificateOrderAction # type: ignore + from ._models import CertificatePatchResource # type: ignore + from ._models import CloningInfo # type: ignore + from ._models import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import ConnStringInfo # type: ignore + from ._models import ConnStringValueTypePair # type: ignore + from ._models import ConnectionStringDictionary # type: ignore + from ._models import Contact # type: ignore + from ._models import ContinuousWebJob # type: ignore + from ._models import ContinuousWebJobCollection # type: ignore + from ._models import CorsSettings # type: ignore + from ._models import CsmMoveResourceEnvelope # type: ignore + from ._models import CsmOperationCollection # type: ignore + from ._models import CsmOperationDescription # type: ignore + from ._models import CsmOperationDescriptionProperties # type: ignore + from ._models import CsmOperationDisplay # type: ignore + from ._models import CsmPublishingProfileOptions # type: ignore + from ._models import CsmSlotEntity # type: ignore + from ._models import CsmUsageQuota # type: ignore + from ._models import CsmUsageQuotaCollection # type: ignore + from ._models import CustomHostnameAnalysisResult # type: ignore + from ._models import DataSource # type: ignore + from ._models import DataTableResponseColumn # type: ignore + from ._models import DataTableResponseObject # type: ignore + from ._models import DatabaseBackupSetting # type: ignore + from ._models import DefaultErrorResponse # type: ignore + from ._models import DefaultErrorResponseError # type: ignore + from ._models import DefaultErrorResponseErrorDetailsItem # type: ignore + from ._models import DeletedAppRestoreRequest # type: ignore + from ._models import DeletedSite # type: ignore + from ._models import DeletedWebAppCollection # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentCollection # type: ignore + from ._models import DeploymentLocations # type: ignore + from ._models import DetectorAbnormalTimePeriod # type: ignore + from ._models import DetectorDefinition # type: ignore + from ._models import DetectorInfo # type: ignore + from ._models import DetectorResponse # type: ignore + from ._models import DetectorResponseCollection # type: ignore + from ._models import DiagnosticAnalysis # type: ignore + from ._models import DiagnosticAnalysisCollection # type: ignore + from ._models import DiagnosticCategory # type: ignore + from ._models import DiagnosticCategoryCollection # type: ignore + from ._models import DiagnosticData # type: ignore + from ._models import DiagnosticDetectorCollection # type: ignore + from ._models import DiagnosticDetectorResponse # type: ignore + from ._models import DiagnosticMetricSample # type: ignore + from ._models import DiagnosticMetricSet # type: ignore + from ._models import Dimension # type: ignore + from ._models import Domain # type: ignore + from ._models import DomainAvailablilityCheckResult # type: ignore + from ._models import DomainCollection # type: ignore + from ._models import DomainControlCenterSsoRequest # type: ignore + from ._models import DomainOwnershipIdentifier # type: ignore + from ._models import DomainOwnershipIdentifierCollection # type: ignore + from ._models import DomainPatchResource # type: ignore + from ._models import DomainPurchaseConsent # type: ignore + from ._models import DomainRecommendationSearchParameters # type: ignore + from ._models import EnabledConfig # type: ignore + from ._models import EndpointDependency # type: ignore + from ._models import EndpointDetail # type: ignore + from ._models import ErrorEntity # type: ignore + from ._models import Experiments # type: ignore + from ._models import FileSystemApplicationLogsConfig # type: ignore + from ._models import FileSystemHttpLogsConfig # type: ignore + from ._models import FunctionEnvelope # type: ignore + from ._models import FunctionEnvelopeCollection # type: ignore + from ._models import FunctionSecrets # type: ignore + from ._models import GeoDistribution # type: ignore + from ._models import GeoRegion # type: ignore + from ._models import GeoRegionCollection # type: ignore + from ._models import GlobalCsmSkuDescription # type: ignore + from ._models import HandlerMapping # type: ignore + from ._models import HostKeys # type: ignore + from ._models import HostName # type: ignore + from ._models import HostNameBinding # type: ignore + from ._models import HostNameBindingCollection # type: ignore + from ._models import HostNameSslState # type: ignore + from ._models import HostingEnvironmentDeploymentInfo # type: ignore + from ._models import HostingEnvironmentDiagnostics # type: ignore + from ._models import HostingEnvironmentProfile # type: ignore + from ._models import HttpLogsConfig # type: ignore + from ._models import HybridConnection # type: ignore + from ._models import HybridConnectionCollection # type: ignore + from ._models import HybridConnectionKey # type: ignore + from ._models import HybridConnectionLimits # type: ignore + from ._models import Identifier # type: ignore + from ._models import IdentifierCollection # type: ignore + from ._models import InboundEnvironmentEndpoint # type: ignore + from ._models import InboundEnvironmentEndpointCollection # type: ignore + from ._models import IpSecurityRestriction # type: ignore + from ._models import KeyInfo # type: ignore + from ._models import LocalizableString # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import MSDeploy # type: ignore + from ._models import MSDeployLog # type: ignore + from ._models import MSDeployLogEntry # type: ignore + from ._models import MSDeployStatus # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import MetricAvailabilily # type: ignore + from ._models import MetricAvailability # type: ignore + from ._models import MetricDefinition # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MigrateMySqlRequest # type: ignore + from ._models import MigrateMySqlStatus # type: ignore + from ._models import NameIdentifier # type: ignore + from ._models import NameIdentifierCollection # type: ignore + from ._models import NameValuePair # type: ignore + from ._models import NetworkAccessControlEntry # type: ignore + from ._models import NetworkFeatures # type: ignore + from ._models import NetworkTrace # type: ignore + from ._models import Operation # type: ignore + from ._models import OutboundEnvironmentEndpoint # type: ignore + from ._models import OutboundEnvironmentEndpointCollection # type: ignore + from ._models import PerfMonCounterCollection # type: ignore + from ._models import PerfMonResponse # type: ignore + from ._models import PerfMonSample # type: ignore + from ._models import PerfMonSet # type: ignore + from ._models import PremierAddOn # type: ignore + from ._models import PremierAddOnOffer # type: ignore + from ._models import PremierAddOnOfferCollection # type: ignore + from ._models import PremierAddOnPatchResource # type: ignore + from ._models import PrivateAccess # type: ignore + from ._models import PrivateAccessSubnet # type: ignore + from ._models import PrivateAccessVirtualNetwork # type: ignore + from ._models import ProcessInfo # type: ignore + from ._models import ProcessInfoCollection # type: ignore + from ._models import ProcessModuleInfo # type: ignore + from ._models import ProcessModuleInfoCollection # type: ignore + from ._models import ProcessThreadInfo # type: ignore + from ._models import ProcessThreadInfoCollection # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import PublicCertificate # type: ignore + from ._models import PublicCertificateCollection # type: ignore + from ._models import PushSettings # type: ignore + from ._models import RampUpRule # type: ignore + from ._models import Recommendation # type: ignore + from ._models import RecommendationCollection # type: ignore + from ._models import RecommendationRule # type: ignore + from ._models import ReissueCertificateOrderRequest # type: ignore + from ._models import RelayServiceConnectionEntity # type: ignore + from ._models import Rendering # type: ignore + from ._models import RenewCertificateOrderRequest # type: ignore + from ._models import RequestsBasedTrigger # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceCollection # type: ignore + from ._models import ResourceHealthMetadata # type: ignore + from ._models import ResourceHealthMetadataCollection # type: ignore + from ._models import ResourceMetric # type: ignore + from ._models import ResourceMetricAvailability # type: ignore + from ._models import ResourceMetricCollection # type: ignore + from ._models import ResourceMetricDefinition # type: ignore + from ._models import ResourceMetricDefinitionCollection # type: ignore + from ._models import ResourceMetricName # type: ignore + from ._models import ResourceMetricProperty # type: ignore + from ._models import ResourceMetricValue # type: ignore + from ._models import ResourceNameAvailability # type: ignore + from ._models import ResourceNameAvailabilityRequest # type: ignore + from ._models import ResponseMetaData # type: ignore + from ._models import RestoreRequest # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Site # type: ignore + from ._models import SiteAuthSettings # type: ignore + from ._models import SiteCloneability # type: ignore + from ._models import SiteCloneabilityCriterion # type: ignore + from ._models import SiteConfig # type: ignore + from ._models import SiteConfigResource # type: ignore + from ._models import SiteConfigResourceCollection # type: ignore + from ._models import SiteConfigurationSnapshotInfo # type: ignore + from ._models import SiteConfigurationSnapshotInfoCollection # type: ignore + from ._models import SiteExtensionInfo # type: ignore + from ._models import SiteExtensionInfoCollection # type: ignore + from ._models import SiteInstance # type: ignore + from ._models import SiteLimits # type: ignore + from ._models import SiteLogsConfig # type: ignore + from ._models import SiteMachineKey # type: ignore + from ._models import SitePatchResource # type: ignore + from ._models import SitePhpErrorLogFlag # type: ignore + from ._models import SiteSeal # type: ignore + from ._models import SiteSealRequest # type: ignore + from ._models import SiteSourceControl # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import SkuInfo # type: ignore + from ._models import SkuInfoCollection # type: ignore + from ._models import SkuInfos # type: ignore + from ._models import SlotConfigNamesResource # type: ignore + from ._models import SlotDifference # type: ignore + from ._models import SlotDifferenceCollection # type: ignore + from ._models import SlotSwapStatus # type: ignore + from ._models import SlowRequestsBasedTrigger # type: ignore + from ._models import Snapshot # type: ignore + from ._models import SnapshotCollection # type: ignore + from ._models import SnapshotRecoverySource # type: ignore + from ._models import SnapshotRestoreRequest # type: ignore + from ._models import Solution # type: ignore + from ._models import SourceControl # type: ignore + from ._models import SourceControlCollection # type: ignore + from ._models import StackMajorVersion # type: ignore + from ._models import StackMinorVersion # type: ignore + from ._models import StampCapacity # type: ignore + from ._models import StampCapacityCollection # type: ignore + from ._models import StatusCodesBasedTrigger # type: ignore + from ._models import StorageMigrationOptions # type: ignore + from ._models import StorageMigrationResponse # type: ignore + from ._models import StringDictionary # type: ignore + from ._models import SwiftVirtualNetwork # type: ignore + from ._models import TldLegalAgreement # type: ignore + from ._models import TldLegalAgreementCollection # type: ignore + from ._models import TopLevelDomain # type: ignore + from ._models import TopLevelDomainAgreementOption # type: ignore + from ._models import TopLevelDomainCollection # type: ignore + from ._models import TriggeredJobHistory # type: ignore + from ._models import TriggeredJobHistoryCollection # type: ignore + from ._models import TriggeredJobRun # type: ignore + from ._models import TriggeredWebJob # type: ignore + from ._models import TriggeredWebJobCollection # type: ignore + from ._models import Usage # type: ignore + from ._models import UsageCollection # type: ignore + from ._models import User # type: ignore + from ._models import ValidateContainerSettingsRequest # type: ignore + from ._models import ValidateRequest # type: ignore + from ._models import ValidateResponse # type: ignore + from ._models import ValidateResponseError # type: ignore + from ._models import VirtualApplication # type: ignore + from ._models import VirtualDirectory # type: ignore + from ._models import VirtualIPMapping # type: ignore + from ._models import VirtualNetworkProfile # type: ignore + from ._models import VnetGateway # type: ignore + from ._models import VnetInfo # type: ignore + from ._models import VnetParameters # type: ignore + from ._models import VnetRoute # type: ignore + from ._models import VnetValidationFailureDetails # type: ignore + from ._models import VnetValidationTestFailure # type: ignore + from ._models import WebAppCollection # type: ignore + from ._models import WebAppInstanceCollection # type: ignore + from ._models import WebJob # type: ignore + from ._models import WebJobCollection # type: ignore + from ._models import WorkerPool # type: ignore + from ._models import WorkerPoolCollection # type: ignore + from ._models import WorkerPoolResource # type: ignore + from ._web_site_management_client_enums import ( - KeyVaultSecretStatus, - CertificateProductType, - ProvisioningState, - CertificateOrderStatus, - CertificateOrderActionType, - RouteType, - ManagedServiceIdentityType, - IpFilterTag, + AccessControlEntryAction, + AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem, + AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem, + AppServicePlanRestrictions, AutoHealActionType, - ConnectionStringType, - AzureStorageType, - AzureStorageState, - ScmType, - ManagedPipelineMode, - SiteLoadBalancing, - SupportedTlsVersions, - FtpsState, - SslState, - HostType, - UsageState, - SiteAvailabilityState, - RedundancyMode, - StatusOptions, - DomainStatus, AzureResourceType, + AzureStorageState, + AzureStorageType, + BackupItemStatus, + BackupRestoreOperationType, + BuiltInAuthenticationProvider, + CertificateOrderActionType, + CertificateOrderStatus, + CertificateProductType, + Channels, + CheckNameResourceTypes, + CloneAbilityResult, + ComputeModeOptions, + ConnectionStringType, + ContinuousWebJobStatus, CustomHostNameDnsRecordType, - HostNameType, + DatabaseType, DnsType, + DnsVerificationTestResult, + DomainPatchResourcePropertiesDomainNotRenewableReasonsItem, + DomainPropertiesDomainNotRenewableReasonsItem, + DomainStatus, DomainType, + Enum4, + Enum5, + FrequencyUnit, + FtpsState, + HostNameType, + HostType, HostingEnvironmentStatus, + InAvailabilityReasonType, InternalLoadBalancingMode, - ComputeModeOptions, - WorkerSizeOptions, - AccessControlEntryAction, - OperationStatus, + IpFilterTag, IssueType, - SolutionType, - RenderingType, - ResourceScopeType, - NotificationLevel, - Channels, - AppServicePlanRestrictions, - InAvailabilityReasonType, - CheckNameResourceTypes, - ValidateResourceTypes, + KeyVaultSecretStatus, LogLevel, - BackupItemStatus, - DatabaseType, - FrequencyUnit, - ContinuousWebJobStatus, - WebJobType, - PublishingProfileFormat, - DnsVerificationTestResult, MSDeployLogEntryType, MSDeployProvisioningState, + ManagedPipelineMode, + ManagedServiceIdentityType, MySqlMigrationType, + NotificationLevel, + OperationStatus, + ProvisioningState, PublicCertificateLocation, - BackupRestoreOperationType, - UnauthenticatedClientAction, - BuiltInAuthenticationProvider, - CloneAbilityResult, + PublishingProfileFormat, + RedundancyMode, + RenderingType, + ResourceScopeType, + RouteType, + ScmType, + SiteAvailabilityState, SiteExtensionType, - TriggeredWebJobStatus, + SiteLoadBalancing, SkuName, + SolutionType, + SslState, + StatusOptions, + SupportedTlsVersions, + TriggeredWebJobStatus, + UnauthenticatedClientAction, + UsageState, + ValidateResourceTypes, + WebJobType, + WorkerSizeOptions, ) __all__ = [ @@ -600,18 +657,23 @@ 'AnalysisData', 'AnalysisDefinition', 'ApiDefinitionInfo', - 'ApplicationLogsConfig', - 'ApplicationStack', 'AppServiceCertificate', + 'AppServiceCertificateCollection', 'AppServiceCertificateOrder', + 'AppServiceCertificateOrderCollection', 'AppServiceCertificateOrderPatchResource', 'AppServiceCertificatePatchResource', 'AppServiceCertificateResource', 'AppServiceEnvironment', + 'AppServiceEnvironmentCollection', 'AppServiceEnvironmentPatchResource', 'AppServiceEnvironmentResource', 'AppServicePlan', + 'AppServicePlanCollection', 'AppServicePlanPatchResource', + 'ApplicationLogsConfig', + 'ApplicationStack', + 'ApplicationStackCollection', 'AutoHealActions', 'AutoHealCustomAction', 'AutoHealRules', @@ -622,56 +684,71 @@ 'AzureStoragePropertyDictionaryResource', 'AzureTableStorageApplicationLogsConfig', 'BackupItem', + 'BackupItemCollection', 'BackupRequest', 'BackupSchedule', 'BillingMeter', + 'BillingMeterCollection', 'Capability', 'Certificate', + 'CertificateCollection', 'CertificateDetails', 'CertificateEmail', 'CertificateOrderAction', 'CertificatePatchResource', 'CloningInfo', - 'ConnectionStringDictionary', + 'Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties', 'ConnStringInfo', 'ConnStringValueTypePair', + 'ConnectionStringDictionary', 'Contact', 'ContinuousWebJob', + 'ContinuousWebJobCollection', 'CorsSettings', 'CsmMoveResourceEnvelope', + 'CsmOperationCollection', 'CsmOperationDescription', 'CsmOperationDescriptionProperties', 'CsmOperationDisplay', 'CsmPublishingProfileOptions', 'CsmSlotEntity', 'CsmUsageQuota', + 'CsmUsageQuotaCollection', 'CustomHostnameAnalysisResult', - 'DatabaseBackupSetting', 'DataSource', 'DataTableResponseColumn', 'DataTableResponseObject', - 'DefaultErrorResponse', 'DefaultErrorResponseException', + 'DatabaseBackupSetting', + 'DefaultErrorResponse', 'DefaultErrorResponseError', 'DefaultErrorResponseErrorDetailsItem', 'DeletedAppRestoreRequest', 'DeletedSite', + 'DeletedWebAppCollection', 'Deployment', + 'DeploymentCollection', 'DeploymentLocations', 'DetectorAbnormalTimePeriod', 'DetectorDefinition', 'DetectorInfo', 'DetectorResponse', + 'DetectorResponseCollection', 'DiagnosticAnalysis', + 'DiagnosticAnalysisCollection', 'DiagnosticCategory', + 'DiagnosticCategoryCollection', 'DiagnosticData', + 'DiagnosticDetectorCollection', 'DiagnosticDetectorResponse', 'DiagnosticMetricSample', 'DiagnosticMetricSet', 'Dimension', 'Domain', 'DomainAvailablilityCheckResult', + 'DomainCollection', 'DomainControlCenterSsoRequest', 'DomainOwnershipIdentifier', + 'DomainOwnershipIdentifierCollection', 'DomainPatchResource', 'DomainPurchaseConsent', 'DomainRecommendationSearchParameters', @@ -683,64 +760,78 @@ 'FileSystemApplicationLogsConfig', 'FileSystemHttpLogsConfig', 'FunctionEnvelope', + 'FunctionEnvelopeCollection', 'FunctionSecrets', 'GeoDistribution', 'GeoRegion', + 'GeoRegionCollection', 'GlobalCsmSkuDescription', 'HandlerMapping', - 'HostingEnvironmentDeploymentInfo', - 'HostingEnvironmentDiagnostics', - 'HostingEnvironmentProfile', 'HostKeys', 'HostName', 'HostNameBinding', + 'HostNameBindingCollection', 'HostNameSslState', + 'HostingEnvironmentDeploymentInfo', + 'HostingEnvironmentDiagnostics', + 'HostingEnvironmentProfile', 'HttpLogsConfig', 'HybridConnection', + 'HybridConnectionCollection', 'HybridConnectionKey', 'HybridConnectionLimits', 'Identifier', + 'IdentifierCollection', 'InboundEnvironmentEndpoint', + 'InboundEnvironmentEndpointCollection', 'IpSecurityRestriction', 'KeyInfo', 'LocalizableString', 'LogSpecification', + 'MSDeploy', + 'MSDeployLog', + 'MSDeployLogEntry', + 'MSDeployStatus', 'ManagedServiceIdentity', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', 'MetricAvailabilily', 'MetricAvailability', 'MetricDefinition', 'MetricSpecification', 'MigrateMySqlRequest', 'MigrateMySqlStatus', - 'MSDeploy', - 'MSDeployLog', - 'MSDeployLogEntry', - 'MSDeployStatus', 'NameIdentifier', + 'NameIdentifierCollection', 'NameValuePair', 'NetworkAccessControlEntry', 'NetworkFeatures', 'NetworkTrace', 'Operation', 'OutboundEnvironmentEndpoint', + 'OutboundEnvironmentEndpointCollection', + 'PerfMonCounterCollection', 'PerfMonResponse', 'PerfMonSample', 'PerfMonSet', 'PremierAddOn', 'PremierAddOnOffer', + 'PremierAddOnOfferCollection', 'PremierAddOnPatchResource', 'PrivateAccess', 'PrivateAccessSubnet', 'PrivateAccessVirtualNetwork', 'ProcessInfo', + 'ProcessInfoCollection', 'ProcessModuleInfo', + 'ProcessModuleInfoCollection', 'ProcessThreadInfo', + 'ProcessThreadInfoCollection', 'ProxyOnlyResource', 'PublicCertificate', + 'PublicCertificateCollection', 'PushSettings', 'RampUpRule', 'Recommendation', + 'RecommendationCollection', 'RecommendationRule', 'ReissueCertificateOrderRequest', 'RelayServiceConnectionEntity', @@ -748,10 +839,14 @@ 'RenewCertificateOrderRequest', 'RequestsBasedTrigger', 'Resource', + 'ResourceCollection', 'ResourceHealthMetadata', + 'ResourceHealthMetadataCollection', 'ResourceMetric', 'ResourceMetricAvailability', + 'ResourceMetricCollection', 'ResourceMetricDefinition', + 'ResourceMetricDefinitionCollection', 'ResourceMetricName', 'ResourceMetricProperty', 'ResourceMetricValue', @@ -766,8 +861,11 @@ 'SiteCloneabilityCriterion', 'SiteConfig', 'SiteConfigResource', + 'SiteConfigResourceCollection', 'SiteConfigurationSnapshotInfo', + 'SiteConfigurationSnapshotInfoCollection', 'SiteExtensionInfo', + 'SiteExtensionInfoCollection', 'SiteInstance', 'SiteLimits', 'SiteLogsConfig', @@ -780,31 +878,41 @@ 'SkuCapacity', 'SkuDescription', 'SkuInfo', + 'SkuInfoCollection', 'SkuInfos', 'SlotConfigNamesResource', 'SlotDifference', + 'SlotDifferenceCollection', 'SlotSwapStatus', 'SlowRequestsBasedTrigger', 'Snapshot', + 'SnapshotCollection', 'SnapshotRecoverySource', 'SnapshotRestoreRequest', 'Solution', 'SourceControl', + 'SourceControlCollection', 'StackMajorVersion', 'StackMinorVersion', 'StampCapacity', + 'StampCapacityCollection', 'StatusCodesBasedTrigger', 'StorageMigrationOptions', 'StorageMigrationResponse', 'StringDictionary', 'SwiftVirtualNetwork', 'TldLegalAgreement', + 'TldLegalAgreementCollection', 'TopLevelDomain', 'TopLevelDomainAgreementOption', + 'TopLevelDomainCollection', 'TriggeredJobHistory', + 'TriggeredJobHistoryCollection', 'TriggeredJobRun', 'TriggeredWebJob', + 'TriggeredWebJobCollection', 'Usage', + 'UsageCollection', 'User', 'ValidateContainerSettingsRequest', 'ValidateRequest', @@ -821,126 +929,80 @@ 'VnetValidationFailureDetails', 'VnetValidationTestFailure', 'WebAppCollection', + 'WebAppInstanceCollection', 'WebJob', + 'WebJobCollection', 'WorkerPool', + 'WorkerPoolCollection', 'WorkerPoolResource', - 'AppServiceCertificateOrderPaged', - 'AppServiceCertificateResourcePaged', - 'CsmOperationDescriptionPaged', - 'DomainPaged', - 'NameIdentifierPaged', - 'DomainOwnershipIdentifierPaged', - 'TopLevelDomainPaged', - 'TldLegalAgreementPaged', - 'CertificatePaged', - 'DeletedSitePaged', - 'DetectorResponsePaged', - 'DiagnosticCategoryPaged', - 'AnalysisDefinitionPaged', - 'DetectorDefinitionPaged', - 'ApplicationStackPaged', - 'RecommendationPaged', - 'SourceControlPaged', - 'BillingMeterPaged', - 'GeoRegionPaged', - 'IdentifierPaged', - 'PremierAddOnOfferPaged', - 'SitePaged', - 'BackupItemPaged', - 'SiteConfigResourcePaged', - 'SiteConfigurationSnapshotInfoPaged', - 'ContinuousWebJobPaged', - 'DeploymentPaged', - 'FunctionEnvelopePaged', - 'HostNameBindingPaged', - 'SiteInstancePaged', - 'ProcessInfoPaged', - 'ProcessModuleInfoPaged', - 'ProcessThreadInfoPaged', - 'ResourceMetricDefinitionPaged', - 'ResourceMetricPaged', - 'PerfMonResponsePaged', - 'PublicCertificatePaged', - 'SiteExtensionInfoPaged', - 'SlotDifferencePaged', - 'SnapshotPaged', - 'TriggeredWebJobPaged', - 'TriggeredJobHistoryPaged', - 'CsmUsageQuotaPaged', - 'WebJobPaged', - 'AppServiceEnvironmentResourcePaged', - 'StampCapacityPaged', - 'InboundEnvironmentEndpointPaged', - 'WorkerPoolResourcePaged', - 'SkuInfoPaged', - 'UsagePaged', - 'OutboundEnvironmentEndpointPaged', - 'AppServicePlanPaged', - 'StrPaged', - 'HybridConnectionPaged', - 'ResourceHealthMetadataPaged', - 'KeyVaultSecretStatus', - 'CertificateProductType', - 'ProvisioningState', - 'CertificateOrderStatus', - 'CertificateOrderActionType', - 'RouteType', - 'ManagedServiceIdentityType', - 'IpFilterTag', + 'AccessControlEntryAction', + 'AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem', + 'AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem', + 'AppServicePlanRestrictions', 'AutoHealActionType', - 'ConnectionStringType', - 'AzureStorageType', - 'AzureStorageState', - 'ScmType', - 'ManagedPipelineMode', - 'SiteLoadBalancing', - 'SupportedTlsVersions', - 'FtpsState', - 'SslState', - 'HostType', - 'UsageState', - 'SiteAvailabilityState', - 'RedundancyMode', - 'StatusOptions', - 'DomainStatus', 'AzureResourceType', + 'AzureStorageState', + 'AzureStorageType', + 'BackupItemStatus', + 'BackupRestoreOperationType', + 'BuiltInAuthenticationProvider', + 'CertificateOrderActionType', + 'CertificateOrderStatus', + 'CertificateProductType', + 'Channels', + 'CheckNameResourceTypes', + 'CloneAbilityResult', + 'ComputeModeOptions', + 'ConnectionStringType', + 'ContinuousWebJobStatus', 'CustomHostNameDnsRecordType', - 'HostNameType', + 'DatabaseType', 'DnsType', + 'DnsVerificationTestResult', + 'DomainPatchResourcePropertiesDomainNotRenewableReasonsItem', + 'DomainPropertiesDomainNotRenewableReasonsItem', + 'DomainStatus', 'DomainType', + 'Enum4', + 'Enum5', + 'FrequencyUnit', + 'FtpsState', + 'HostNameType', + 'HostType', 'HostingEnvironmentStatus', + 'InAvailabilityReasonType', 'InternalLoadBalancingMode', - 'ComputeModeOptions', - 'WorkerSizeOptions', - 'AccessControlEntryAction', - 'OperationStatus', + 'IpFilterTag', 'IssueType', - 'SolutionType', - 'RenderingType', - 'ResourceScopeType', - 'NotificationLevel', - 'Channels', - 'AppServicePlanRestrictions', - 'InAvailabilityReasonType', - 'CheckNameResourceTypes', - 'ValidateResourceTypes', + 'KeyVaultSecretStatus', 'LogLevel', - 'BackupItemStatus', - 'DatabaseType', - 'FrequencyUnit', - 'ContinuousWebJobStatus', - 'WebJobType', - 'PublishingProfileFormat', - 'DnsVerificationTestResult', 'MSDeployLogEntryType', 'MSDeployProvisioningState', + 'ManagedPipelineMode', + 'ManagedServiceIdentityType', 'MySqlMigrationType', + 'NotificationLevel', + 'OperationStatus', + 'ProvisioningState', 'PublicCertificateLocation', - 'BackupRestoreOperationType', - 'UnauthenticatedClientAction', - 'BuiltInAuthenticationProvider', - 'CloneAbilityResult', + 'PublishingProfileFormat', + 'RedundancyMode', + 'RenderingType', + 'ResourceScopeType', + 'RouteType', + 'ScmType', + 'SiteAvailabilityState', 'SiteExtensionType', - 'TriggeredWebJobStatus', + 'SiteLoadBalancing', 'SkuName', + 'SolutionType', + 'SslState', + 'StatusOptions', + 'SupportedTlsVersions', + 'TriggeredWebJobStatus', + 'UnauthenticatedClientAction', + 'UsageState', + 'ValidateResourceTypes', + 'WebJobType', + 'WorkerSizeOptions', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models.py index 1e45858b69fd..b175543ead67 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models.py @@ -1,29 +1,25 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AbnormalTimePeriod(Model): +class AbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period identified in diagnosis. - :param start_time: Start time of the downtime - :type start_time: datetime - :param end_time: End time of the downtime - :type end_time: datetime - :param events: List of Possible Cause of downtime - :type events: - list[~azure.mgmt.web.v2018_02_01.models.DetectorAbnormalTimePeriod] - :param solutions: List of proposed solutions + :param start_time: Start time of the downtime. + :type start_time: ~datetime.datetime + :param end_time: End time of the downtime. + :type end_time: ~datetime.datetime + :param events: List of Possible Cause of downtime. + :type events: list[~azure.mgmt.web.v2018_02_01.models.DetectorAbnormalTimePeriod] + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2018_02_01.models.Solution] """ @@ -34,7 +30,10 @@ class AbnormalTimePeriod(Model): 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AbnormalTimePeriod, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -42,7 +41,7 @@ def __init__(self, **kwargs): self.solutions = kwargs.get('solutions', None) -class Address(Model): +class Address(msrest.serialization.Model): """Address information for domain registration. All required parameters must be populated in order to send to Azure. @@ -78,30 +77,31 @@ class Address(Model): 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Address, self).__init__(**kwargs) - self.address1 = kwargs.get('address1', None) + self.address1 = kwargs['address1'] self.address2 = kwargs.get('address2', None) - self.city = kwargs.get('city', None) - self.country = kwargs.get('country', None) - self.postal_code = kwargs.get('postal_code', None) - self.state = kwargs.get('state', None) + self.city = kwargs['city'] + self.country = kwargs['country'] + self.postal_code = kwargs['postal_code'] + self.state = kwargs['state'] -class AddressResponse(Model): +class AddressResponse(msrest.serialization.Model): """Describes main public IP address and any extra virtual IPs. :param service_ip_address: Main public virtual IP. :type service_ip_address: str - :param internal_ip_address: Virtual Network internal IP address of the App - Service Environment if it is in internal load-balancing mode. + :param internal_ip_address: Virtual Network internal IP address of the App Service Environment + if it is in internal load-balancing mode. :type internal_ip_address: str - :param outbound_ip_addresses: IP addresses appearing on outbound - connections. + :param outbound_ip_addresses: IP addresses appearing on outbound connections. :type outbound_ip_addresses: list[str] :param vip_mappings: Additional virtual IPs. - :type vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :type vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] """ _attribute_map = { @@ -111,7 +111,10 @@ class AddressResponse(Model): 'vip_mappings': {'key': 'vipMappings', 'type': '[VirtualIPMapping]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AddressResponse, self).__init__(**kwargs) self.service_ip_address = kwargs.get('service_ip_address', None) self.internal_ip_address = kwargs.get('internal_ip_address', None) @@ -119,22 +122,19 @@ def __init__(self, **kwargs): self.vip_mappings = kwargs.get('vip_mappings', None) -class AnalysisData(Model): +class AnalysisData(msrest.serialization.Model): """Class Representing Detector Evidence used for analysis. - :param source: Name of the Detector + :param source: Name of the Detector. :type source: str - :param detector_definition: Detector Definition - :type detector_definition: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition - :param metrics: Source Metrics - :type metrics: - list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] - :param data: Additional Source Data + :param detector_definition: Detector Definition. + :type detector_definition: ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition + :param metrics: Source Metrics. + :type metrics: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] + :param data: Additional Source Data. :type data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] - :param detector_meta_data: Detector Meta Data - :type detector_meta_data: - ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData + :param detector_meta_data: Detector Meta Data. + :type detector_meta_data: ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData """ _attribute_map = { @@ -145,7 +145,10 @@ class AnalysisData(Model): 'detector_meta_data': {'key': 'detectorMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnalysisData, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.detector_definition = kwargs.get('detector_definition', None) @@ -154,12 +157,10 @@ def __init__(self, **kwargs): self.detector_meta_data = kwargs.get('detector_meta_data', None) -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -184,7 +185,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -195,8 +199,7 @@ def __init__(self, **kwargs): class AnalysisDefinition(ProxyOnlyResource): """Definition of Analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -206,7 +209,7 @@ class AnalysisDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the Analysis + :ivar description: Description of the Analysis. :vartype description: str """ @@ -225,12 +228,15 @@ class AnalysisDefinition(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnalysisDefinition, self).__init__(**kwargs) self.description = None -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -241,19 +247,20 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = kwargs.get('url', None) -class ApplicationLogsConfig(Model): +class ApplicationLogsConfig(msrest.serialization.Model): """Application logs configuration. :param file_system: Application logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2018_02_01.models.FileSystemApplicationLogsConfig - :param azure_table_storage: Application logs to azure table storage - configuration. + :type file_system: ~azure.mgmt.web.v2018_02_01.models.FileSystemApplicationLogsConfig + :param azure_table_storage: Application logs to azure table storage configuration. :type azure_table_storage: ~azure.mgmt.web.v2018_02_01.models.AzureTableStorageApplicationLogsConfig :param azure_blob_storage: Application logs to blob storage configuration. @@ -267,14 +274,17 @@ class ApplicationLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageApplicationLogsConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationLogsConfig, self).__init__(**kwargs) self.file_system = kwargs.get('file_system', None) self.azure_table_storage = kwargs.get('azure_table_storage', None) self.azure_blob_storage = kwargs.get('azure_blob_storage', None) -class ApplicationStack(Model): +class ApplicationStack(msrest.serialization.Model): """Application stack. :param name: Application stack name. @@ -284,11 +294,9 @@ class ApplicationStack(Model): :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2018_02_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2018_02_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] """ _attribute_map = { @@ -299,7 +307,10 @@ class ApplicationStack(Model): 'frameworks': {'key': 'frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationStack, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -308,24 +319,53 @@ def __init__(self, **kwargs): self.frameworks = kwargs.get('frameworks', None) -class AppServiceCertificate(Model): +class ApplicationStackCollection(msrest.serialization.Model): + """Collection of Application Stacks. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationStack]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationStackCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class AppServiceCertificate(msrest.serialization.Model): """Key Vault container for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus """ _validation = { @@ -335,21 +375,55 @@ class AppServiceCertificate(Model): _attribute_map = { 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificate, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) self.provisioning_state = None -class Resource(Model): +class AppServiceCertificateCollection(msrest.serialization.Model): + """Collection of certificate order certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceCertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -363,7 +437,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -383,12 +457,15 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.type = None self.tags = kwargs.get('tags', None) @@ -396,8 +473,7 @@ def __init__(self, **kwargs): class AppServiceCertificateOrder(Resource): """SSL certificate purchase order. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -411,63 +487,54 @@ class AppServiceCertificateOrder(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2018_02_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -477,7 +544,6 @@ class AppServiceCertificateOrder(Resource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -503,10 +569,10 @@ class AppServiceCertificateOrder(Resource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -519,7 +585,10 @@ class AppServiceCertificateOrder(Resource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateOrder, self).__init__(**kwargs) self.certificates = kwargs.get('certificates', None) self.distinguished_name = kwargs.get('distinguished_name', None) @@ -542,14 +611,43 @@ def __init__(self, **kwargs): self.next_auto_renewal_time_stamp = None -class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): - """ARM resource for a certificate order that is purchased through Azure. +class AppServiceCertificateOrderCollection(msrest.serialization.Model): + """Collection of certificate orders. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateOrder]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceCertificateOrderCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): + """ARM resource for a certificate order that is purchased through Azure. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -559,60 +657,51 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2018_02_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -621,7 +710,6 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -645,10 +733,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -661,7 +749,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateOrderPatchResource, self).__init__(**kwargs) self.certificates = kwargs.get('certificates', None) self.distinguished_name = kwargs.get('distinguished_name', None) @@ -685,11 +776,9 @@ def __init__(self, **kwargs): class AppServiceCertificatePatchResource(ProxyOnlyResource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -703,14 +792,12 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus """ _validation = { @@ -727,10 +814,13 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificatePatchResource, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) @@ -738,11 +828,9 @@ def __init__(self, **kwargs): class AppServiceCertificateResource(Resource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -756,20 +844,18 @@ class AppServiceCertificateResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus """ _validation = { @@ -789,71 +875,66 @@ class AppServiceCertificateResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateResource, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) self.provisioning_state = None -class AppServiceEnvironment(Model): +class AppServiceEnvironment(msrest.serialization.Model): """Description of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param name: Required. Name of the App Service Environment. :type name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param location: Required. Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :type virtual_network: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2018_02_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Required. Description of worker pools with worker size IDs, VM sizes, and + number of workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2018_02_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -861,35 +942,29 @@ class AppServiceEnvironment(Model): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2018_02_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -897,34 +972,31 @@ class AppServiceEnvironment(Model): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -955,13 +1027,13 @@ class AppServiceEnvironment(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, 'vnet_name': {'key': 'vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'workerPools', 'type': '[WorkerPool]'}, @@ -994,20 +1066,23 @@ class AppServiceEnvironment(Model): 'ssl_cert_key_vault_secret_name': {'key': 'sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironment, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.location = kwargs.get('location', None) + self.name = kwargs['name'] + self.location = kwargs['location'] self.provisioning_state = None self.status = None self.vnet_name = kwargs.get('vnet_name', None) self.vnet_resource_group_name = kwargs.get('vnet_resource_group_name', None) self.vnet_subnet_name = kwargs.get('vnet_subnet_name', None) - self.virtual_network = kwargs.get('virtual_network', None) + self.virtual_network = kwargs['virtual_network'] self.internal_load_balancing_mode = kwargs.get('internal_load_balancing_mode', None) self.multi_size = kwargs.get('multi_size', None) self.multi_role_count = kwargs.get('multi_role_count', None) - self.worker_pools = kwargs.get('worker_pools', None) + self.worker_pools = kwargs['worker_pools'] self.ipssl_address_count = kwargs.get('ipssl_address_count', None) self.database_edition = None self.database_service_objective = None @@ -1037,14 +1112,43 @@ def __init__(self, **kwargs): self.ssl_cert_key_vault_secret_name = kwargs.get('ssl_cert_key_vault_secret_name', None) -class AppServiceEnvironmentPatchResource(ProxyOnlyResource): - """ARM resource for a app service environment. +class AppServiceEnvironmentCollection(msrest.serialization.Model): + """Collection of App Service Environments. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceEnvironmentCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class AppServiceEnvironmentPatchResource(ProxyOnlyResource): + """ARM resource for a app service environment. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -1053,54 +1157,46 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_environment_patch_resource_name: Required. Name of the - App Service Environment. - :type app_service_environment_patch_resource_name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location: Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2018_02_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2018_02_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1108,35 +1204,29 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2018_02_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1144,34 +1234,31 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1179,12 +1266,8 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_environment_patch_resource_name': {'required': True}, - 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1207,15 +1290,15 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_environment_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1248,9 +1331,12 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironmentPatchResource, self).__init__(**kwargs) - self.app_service_environment_patch_resource_name = kwargs.get('app_service_environment_patch_resource_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.location = kwargs.get('location', None) self.provisioning_state = None self.status = None @@ -1294,8 +1380,7 @@ def __init__(self, **kwargs): class AppServiceEnvironmentResource(Resource): """App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1309,56 +1394,48 @@ class AppServiceEnvironmentResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_environment_resource_name: Required. Name of the App - Service Environment. - :type app_service_environment_resource_name: str - :param app_service_environment_resource_location: Required. Location of - the App Service Environment, e.g. "West US". - :type app_service_environment_resource_location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location_properties_location: Location of the App Service Environment, e.g. "West US". + :type location_properties_location: str + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2018_02_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2018_02_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1366,35 +1443,29 @@ class AppServiceEnvironmentResource(Resource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2018_02_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1402,34 +1473,31 @@ class AppServiceEnvironmentResource(Resource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1438,12 +1506,8 @@ class AppServiceEnvironmentResource(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_environment_resource_name': {'required': True}, - 'app_service_environment_resource_location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1468,15 +1532,15 @@ class AppServiceEnvironmentResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_environment_resource_name': {'key': 'properties.name', 'type': 'str'}, - 'app_service_environment_resource_location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1509,10 +1573,13 @@ class AppServiceEnvironmentResource(Resource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironmentResource, self).__init__(**kwargs) - self.app_service_environment_resource_name = kwargs.get('app_service_environment_resource_name', None) - self.app_service_environment_resource_location = kwargs.get('app_service_environment_resource_location', None) + self.name_properties_name = kwargs.get('name_properties_name', None) + self.location_properties_location = kwargs.get('location_properties_location', None) self.provisioning_state = None self.status = None self.vnet_name = kwargs.get('vnet_name', None) @@ -1555,8 +1622,7 @@ def __init__(self, **kwargs): class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1570,66 +1636,59 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState """ _validation = { @@ -1653,8 +1712,9 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1671,12 +1731,15 @@ class AppServicePlan(Resource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlan, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None self.subscription = None @@ -1696,14 +1759,44 @@ def __init__(self, **kwargs): self.target_worker_count = kwargs.get('target_worker_count', None) self.target_worker_size_id = kwargs.get('target_worker_size_id', None) self.provisioning_state = None - self.sku = kwargs.get('sku', None) + + +class AppServicePlanCollection(msrest.serialization.Model): + """Collection of App Service plans. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServicePlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServicePlanCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None class AppServicePlanPatchResource(ProxyOnlyResource): """ARM resource for a app service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1713,62 +1806,55 @@ class AppServicePlanPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState """ _validation = { @@ -1790,7 +1876,7 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1807,10 +1893,13 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlanPatchResource, self).__init__(**kwargs) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None @@ -1833,37 +1922,38 @@ def __init__(self, **kwargs): self.provisioning_state = None -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2018_02_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2018_02_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2018_02_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2018_02_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) self.custom_action = kwargs.get('custom_action', None) self.min_process_execution_time = kwargs.get('min_process_execution_time', None) -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -1876,17 +1966,19 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = kwargs.get('exe', None) self.parameters = kwargs.get('parameters', None) -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2018_02_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2018_02_01.models.AutoHealActions @@ -1897,13 +1989,16 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = kwargs.get('triggers', None) self.actions = kwargs.get('actions', None) -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -1911,11 +2006,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2018_02_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2018_02_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2018_02_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2018_02_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -1925,7 +2018,10 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = kwargs.get('requests', None) self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) @@ -1933,14 +2029,13 @@ def __init__(self, **kwargs): self.slow_requests = kwargs.get('slow_requests', None) -class AzureBlobStorageApplicationLogsConfig(Model): +class AzureBlobStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs azure blob storage configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2018_02_01.models.LogLevel - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. @@ -1949,30 +2044,32 @@ class AzureBlobStorageApplicationLogsConfig(Model): """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureBlobStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = kwargs.get('level', None) self.sas_url = kwargs.get('sas_url', None) self.retention_in_days = kwargs.get('retention_in_days', None) -class AzureBlobStorageHttpLogsConfig(Model): +class AzureBlobStorageHttpLogsConfig(msrest.serialization.Model): """Http logs to azure blob storage configuration. - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -1982,37 +2079,34 @@ class AzureBlobStorageHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureBlobStorageHttpLogsConfig, self).__init__(**kwargs) self.sas_url = kwargs.get('sas_url', None) self.retention_in_days = kwargs.get('retention_in_days', None) self.enabled = kwargs.get('enabled', None) -class AzureStorageInfoValue(Model): - """Azure Files or Blob Storage access information value for dictionary - storage. +class AzureStorageInfoValue(msrest.serialization.Model): + """Azure Files or Blob Storage access information value for dictionary storage. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of storage. Possible values include: 'AzureFiles', - 'AzureBlob' + :param type: Type of storage. Possible values include: "AzureFiles", "AzureBlob". :type type: str or ~azure.mgmt.web.v2018_02_01.models.AzureStorageType :param account_name: Name of the storage account. :type account_name: str - :param share_name: Name of the file share (container name, for Blob - storage). + :param share_name: Name of the file share (container name, for Blob storage). :type share_name: str :param access_key: Access key for the storage account. :type access_key: str - :param mount_path: Path to mount the storage within the site's runtime - environment. + :param mount_path: Path to mount the storage within the site's runtime environment. :type mount_path: str - :ivar state: State of the storage account. Possible values include: 'Ok', - 'InvalidCredentials', 'InvalidShare' - :vartype state: str or - ~azure.mgmt.web.v2018_02_01.models.AzureStorageState + :ivar state: State of the storage account. Possible values include: "Ok", "InvalidCredentials", + "InvalidShare". + :vartype state: str or ~azure.mgmt.web.v2018_02_01.models.AzureStorageState """ _validation = { @@ -2020,15 +2114,18 @@ class AzureStorageInfoValue(Model): } _attribute_map = { - 'type': {'key': 'type', 'type': 'AzureStorageType'}, + 'type': {'key': 'type', 'type': 'str'}, 'account_name': {'key': 'accountName', 'type': 'str'}, 'share_name': {'key': 'shareName', 'type': 'str'}, 'access_key': {'key': 'accessKey', 'type': 'str'}, 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'AzureStorageState'}, + 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureStorageInfoValue, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.account_name = kwargs.get('account_name', None) @@ -2041,8 +2138,7 @@ def __init__(self, **kwargs): class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): """AzureStorageInfo dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2053,8 +2149,7 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] + :type properties: dict[str, ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] """ _validation = { @@ -2071,21 +2166,23 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{AzureStorageInfoValue}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureStoragePropertyDictionaryResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class AzureTableStorageApplicationLogsConfig(Model): +class AzureTableStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs to Azure table storage configuration. All required parameters must be populated in order to send to Azure. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2018_02_01.models.LogLevel - :param sas_url: Required. SAS URL to an Azure table with add/query/delete - permissions. + :param sas_url: Required. SAS URL to an Azure table with add/query/delete permissions. :type sas_url: str """ @@ -2094,21 +2191,23 @@ class AzureTableStorageApplicationLogsConfig(Model): } _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureTableStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = kwargs.get('level', None) - self.sas_url = kwargs.get('sas_url', None) + self.sas_url = kwargs['sas_url'] class BackupItem(ProxyOnlyResource): """Backup description. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2120,40 +2219,35 @@ class BackupItem(ProxyOnlyResource): :vartype type: str :ivar backup_id: Id of the backup. :vartype backup_id: int - :ivar storage_account_url: SAS URL for the storage account container which - contains this backup. + :ivar storage_account_url: SAS URL for the storage account container which contains this + backup. :vartype storage_account_url: str :ivar blob_name: Name of the blob which contains data for this backup. :vartype blob_name: str - :ivar backup_item_name: Name of this backup. - :vartype backup_item_name: str - :ivar status: Backup status. Possible values include: 'InProgress', - 'Failed', 'Succeeded', 'TimedOut', 'Created', 'Skipped', - 'PartiallySucceeded', 'DeleteInProgress', 'DeleteFailed', 'Deleted' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.BackupItemStatus + :ivar name_properties_name: Name of this backup. + :vartype name_properties_name: str + :ivar status: Backup status. Possible values include: "InProgress", "Failed", "Succeeded", + "TimedOut", "Created", "Skipped", "PartiallySucceeded", "DeleteInProgress", "DeleteFailed", + "Deleted". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.BackupItemStatus :ivar size_in_bytes: Size of the backup in bytes. :vartype size_in_bytes: long :ivar created: Timestamp of the backup creation. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar log: Details regarding this backup. Might contain an error message. :vartype log: str :ivar databases: List of databases included in the backup. - :vartype databases: - list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] - :ivar scheduled: True if this backup has been created due to a schedule - being triggered. + :vartype databases: list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] + :ivar scheduled: True if this backup has been created due to a schedule being triggered. :vartype scheduled: bool - :ivar last_restore_time_stamp: Timestamp of a last restore operation which - used this backup. - :vartype last_restore_time_stamp: datetime + :ivar last_restore_time_stamp: Timestamp of a last restore operation which used this backup. + :vartype last_restore_time_stamp: ~datetime.datetime :ivar finished_time_stamp: Timestamp when this backup finished. - :vartype finished_time_stamp: datetime - :ivar correlation_id: Unique correlation identifier. Please use this along - with the timestamp while communicating with Azure support. + :vartype finished_time_stamp: ~datetime.datetime + :ivar correlation_id: Unique correlation identifier. Please use this along with the timestamp + while communicating with Azure support. :vartype correlation_id: str - :ivar website_size_in_bytes: Size of the original web app which has been - backed up. + :ivar website_size_in_bytes: Size of the original web app which has been backed up. :vartype website_size_in_bytes: long """ @@ -2164,7 +2258,7 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'readonly': True}, 'storage_account_url': {'readonly': True}, 'blob_name': {'readonly': True}, - 'backup_item_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'status': {'readonly': True}, 'size_in_bytes': {'readonly': True}, 'created': {'readonly': True}, @@ -2185,8 +2279,8 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'key': 'properties.id', 'type': 'int'}, 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'blob_name': {'key': 'properties.blobName', 'type': 'str'}, - 'backup_item_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'BackupItemStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, 'created': {'key': 'properties.created', 'type': 'iso-8601'}, 'log': {'key': 'properties.log', 'type': 'str'}, @@ -2198,12 +2292,15 @@ class BackupItem(ProxyOnlyResource): 'website_size_in_bytes': {'key': 'properties.websiteSizeInBytes', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupItem, self).__init__(**kwargs) self.backup_id = None self.storage_account_url = None self.blob_name = None - self.backup_item_name = None + self.name_properties_name = None self.status = None self.size_in_bytes = None self.created = None @@ -2216,14 +2313,43 @@ def __init__(self, **kwargs): self.website_size_in_bytes = None -class BackupRequest(ProxyOnlyResource): - """Description of a backup which will be performed. +class BackupItemCollection(msrest.serialization.Model): + """Collection of backup items. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.BackupItem] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BackupItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BackupItemCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class BackupRequest(ProxyOnlyResource): + """Description of a backup which will be performed. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2234,24 +2360,21 @@ class BackupRequest(ProxyOnlyResource): :vartype type: str :param backup_name: Name of the backup. :type backup_name: str - :param enabled: True if the backup schedule is enabled (must be included - in that case), false if the backup schedule should be disabled. + :param enabled: True if the backup schedule is enabled (must be included in that case), false + if the backup schedule should be disabled. :type enabled: bool - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str - :param backup_schedule: Schedule for the backup if it is executed - periodically. + :param backup_schedule: Schedule for the backup if it is executed periodically. :type backup_schedule: ~azure.mgmt.web.v2018_02_01.models.BackupSchedule :param databases: Databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] + :type databases: list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, } _attribute_map = { @@ -2266,7 +2389,10 @@ class BackupRequest(ProxyOnlyResource): 'databases': {'key': 'properties.databases', 'type': '[DatabaseBackupSetting]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupRequest, self).__init__(**kwargs) self.backup_name = kwargs.get('backup_name', None) self.enabled = kwargs.get('enabled', None) @@ -2275,36 +2401,29 @@ def __init__(self, **kwargs): self.databases = kwargs.get('databases', None) -class BackupSchedule(Model): - """Description of a backup schedule. Describes how often should be the backup - performed and what should be the retention policy. +class BackupSchedule(msrest.serialization.Model): + """Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param frequency_interval: Required. How often the backup should be - executed (e.g. for weekly backup, this should be set to 7 and - FrequencyUnit should be set to Day). Default value: 7 . + :param frequency_interval: Required. How often the backup should be executed (e.g. for weekly + backup, this should be set to 7 and FrequencyUnit should be set to Day). :type frequency_interval: int - :param frequency_unit: Required. The unit of time for how often the backup - should be executed (e.g. for weekly backup, this should be set to Day and - FrequencyInterval should be set to 7). Possible values include: 'Day', - 'Hour'. Default value: "Day" . - :type frequency_unit: str or - ~azure.mgmt.web.v2018_02_01.models.FrequencyUnit - :param keep_at_least_one_backup: Required. True if the retention policy - should always keep at least one backup in the storage account, regardless - how old it is; false otherwise. Default value: True . + :param frequency_unit: Required. The unit of time for how often the backup should be executed + (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). + Possible values include: "Day", "Hour". Default value: "Day". + :type frequency_unit: str or ~azure.mgmt.web.v2018_02_01.models.FrequencyUnit + :param keep_at_least_one_backup: Required. True if the retention policy should always keep at + least one backup in the storage account, regardless how old it is; false otherwise. :type keep_at_least_one_backup: bool - :param retention_period_in_days: Required. After how many days backups - should be deleted. Default value: 30 . + :param retention_period_in_days: Required. After how many days backups should be deleted. :type retention_period_in_days: int :param start_time: When the schedule should start working. - :type start_time: datetime + :type start_time: ~datetime.datetime :ivar last_execution_time: Last time when this schedule was triggered. - :vartype last_execution_time: datetime + :vartype last_execution_time: ~datetime.datetime """ _validation = { @@ -2317,14 +2436,17 @@ class BackupSchedule(Model): _attribute_map = { 'frequency_interval': {'key': 'frequencyInterval', 'type': 'int'}, - 'frequency_unit': {'key': 'frequencyUnit', 'type': 'FrequencyUnit'}, + 'frequency_unit': {'key': 'frequencyUnit', 'type': 'str'}, 'keep_at_least_one_backup': {'key': 'keepAtLeastOneBackup', 'type': 'bool'}, 'retention_period_in_days': {'key': 'retentionPeriodInDays', 'type': 'int'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupSchedule, self).__init__(**kwargs) self.frequency_interval = kwargs.get('frequency_interval', 7) self.frequency_unit = kwargs.get('frequency_unit', "Day") @@ -2335,11 +2457,9 @@ def __init__(self, **kwargs): class BillingMeter(ProxyOnlyResource): - """App Service billing entity that contains information about meter which the - Azure billing system utilizes to charge users for services. + """App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2349,17 +2469,17 @@ class BillingMeter(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param meter_id: Meter GUID onboarded in Commerce + :param meter_id: Meter GUID onboarded in Commerce. :type meter_id: str - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param short_name: Short Name from App Service Azure pricing Page + :param short_name: Short Name from App Service Azure pricing Page. :type short_name: str - :param friendly_name: Friendly name of the meter + :param friendly_name: Friendly name of the meter. :type friendly_name: str - :param resource_type: App Service ResourceType meter used for + :param resource_type: App Service ResourceType meter used for. :type resource_type: str - :param os_type: App Service OS type meter used for + :param os_type: App Service OS type meter used for. :type os_type: str """ @@ -2382,7 +2502,10 @@ class BillingMeter(ProxyOnlyResource): 'os_type': {'key': 'properties.osType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BillingMeter, self).__init__(**kwargs) self.meter_id = kwargs.get('meter_id', None) self.billing_location = kwargs.get('billing_location', None) @@ -2392,7 +2515,39 @@ def __init__(self, **kwargs): self.os_type = kwargs.get('os_type', None) -class Capability(Model): +class BillingMeterCollection(msrest.serialization.Model): + """Collection of Billing Meters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.BillingMeter] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingMeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BillingMeterCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -2409,7 +2564,10 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -2419,8 +2577,7 @@ def __init__(self, **kwargs): class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2434,7 +2591,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -2451,37 +2608,35 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -2498,7 +2653,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2531,11 +2685,14 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Certificate, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -2558,11 +2715,42 @@ def __init__(self, **kwargs): self.server_farm_id = kwargs.get('server_farm_id', None) -class CertificateDetails(Model): +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CertificateDetails(msrest.serialization.Model): """SSL certificate details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar version: Certificate Version. :vartype version: int @@ -2573,9 +2761,9 @@ class CertificateDetails(Model): :ivar subject: Certificate Subject. :vartype subject: str :ivar not_before: Date Certificate is valid from. - :vartype not_before: datetime + :vartype not_before: ~datetime.datetime :ivar not_after: Date Certificate is valid to. - :vartype not_after: datetime + :vartype not_after: ~datetime.datetime :ivar signature_algorithm: Certificate Signature algorithm. :vartype signature_algorithm: str :ivar issuer: Certificate Issuer. @@ -2608,7 +2796,10 @@ class CertificateDetails(Model): 'raw_data': {'key': 'rawData', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateDetails, self).__init__(**kwargs) self.version = None self.serial_number = None @@ -2624,8 +2815,7 @@ def __init__(self, **kwargs): class CertificateEmail(ProxyOnlyResource): """SSL certificate email. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2638,7 +2828,7 @@ class CertificateEmail(ProxyOnlyResource): :param email_id: Email id. :type email_id: str :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime """ _validation = { @@ -2656,7 +2846,10 @@ class CertificateEmail(ProxyOnlyResource): 'time_stamp': {'key': 'properties.timeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateEmail, self).__init__(**kwargs) self.email_id = kwargs.get('email_id', None) self.time_stamp = kwargs.get('time_stamp', None) @@ -2665,8 +2858,7 @@ def __init__(self, **kwargs): class CertificateOrderAction(ProxyOnlyResource): """Certificate order action. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2676,16 +2868,14 @@ class CertificateOrderAction(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar action_type: Action type. Possible values include: - 'CertificateIssued', 'CertificateOrderCanceled', - 'CertificateOrderCreated', 'CertificateRevoked', - 'DomainValidationComplete', 'FraudDetected', 'OrgNameChange', - 'OrgValidationComplete', 'SanDrop', 'FraudCleared', 'CertificateExpired', - 'CertificateExpirationWarning', 'FraudDocumentationRequired', 'Unknown' - :vartype action_type: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateOrderActionType + :ivar action_type: Action type. Possible values include: "CertificateIssued", + "CertificateOrderCanceled", "CertificateOrderCreated", "CertificateRevoked", + "DomainValidationComplete", "FraudDetected", "OrgNameChange", "OrgValidationComplete", + "SanDrop", "FraudCleared", "CertificateExpired", "CertificateExpirationWarning", + "FraudDocumentationRequired", "Unknown". + :vartype action_type: str or ~azure.mgmt.web.v2018_02_01.models.CertificateOrderActionType :ivar created_at: Time at which the certificate action was performed. - :vartype created_at: datetime + :vartype created_at: ~datetime.datetime """ _validation = { @@ -2701,11 +2891,14 @@ class CertificateOrderAction(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'action_type': {'key': 'properties.actionType', 'type': 'CertificateOrderActionType'}, + 'action_type': {'key': 'properties.actionType', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOrderAction, self).__init__(**kwargs) self.action_type = None self.created_at = None @@ -2714,10 +2907,7 @@ def __init__(self, **kwargs): class CertificatePatchResource(ProxyOnlyResource): """ARM resource for a certificate. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2742,37 +2932,35 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -2788,7 +2976,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2819,11 +3006,14 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePatchResource, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -2846,51 +3036,48 @@ def __init__(self, **kwargs): self.server_farm_id = kwargs.get('server_farm_id', None) -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str - :param source_web_app_location: Location of source app ex: West US or - North Europe + :param source_web_app_location: Location of source app ex: West US or North Europe. :type source_web_app_location: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str """ @@ -2912,13 +3099,16 @@ class CloningInfo(Model): 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = kwargs.get('correlation_id', None) self.overwrite = kwargs.get('overwrite', None) self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) + self.source_web_app_id = kwargs['source_web_app_id'] self.source_web_app_location = kwargs.get('source_web_app_location', None) self.hosting_environment = kwargs.get('hosting_environment', None) self.app_settings_overrides = kwargs.get('app_settings_overrides', None) @@ -2927,19 +3117,40 @@ def __init__(self, **kwargs): self.traffic_manager_profile_name = kwargs.get('traffic_manager_profile_name', None) -class CloudError(Model): - """CloudError. +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned 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(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + class ConnectionStringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2950,8 +3161,7 @@ class ConnectionStringDictionary(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.ConnStringValueTypePair] + :type properties: dict[str, ~azure.mgmt.web.v2018_02_01.models.ConnStringValueTypePair] """ _validation = { @@ -2968,47 +3178,53 @@ class ConnectionStringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{ConnStringValueTypePair}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnectionStringDictionary, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2018_02_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.connection_string = kwargs.get('connection_string', None) self.type = kwargs.get('type', None) -class ConnStringValueTypePair(Model): +class ConnStringValueTypePair(msrest.serialization.Model): """Database connection string value to type pair. All required parameters must be populated in order to send to Azure. :param value: Required. Value of pair. :type value: str - :param type: Required. Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Required. Type of database. Possible values include: "MySql", "SQLServer", + "SQLAzure", "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", + "RedisCache", "PostgreSQL". :type type: str or ~azure.mgmt.web.v2018_02_01.models.ConnectionStringType """ @@ -3019,20 +3235,21 @@ class ConnStringValueTypePair(Model): _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringValueTypePair, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = kwargs.get('type', None) + self.value = kwargs['value'] + self.type = kwargs['type'] -class Contact(Model): - """Contact information for domain registration. If 'Domain Privacy' option is - not selected then the contact information is made publicly available - through the Whois - directories as per ICANN requirements. +class Contact(msrest.serialization.Model): + """Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information is made publicly available through the Whois +directories as per ICANN requirements. All required parameters must be populated in order to send to Azure. @@ -3075,24 +3292,26 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.address_mailing = kwargs.get('address_mailing', None) - self.email = kwargs.get('email', None) + self.email = kwargs['email'] self.fax = kwargs.get('fax', None) self.job_title = kwargs.get('job_title', None) - self.name_first = kwargs.get('name_first', None) - self.name_last = kwargs.get('name_last', None) + self.name_first = kwargs['name_first'] + self.name_last = kwargs['name_last'] self.name_middle = kwargs.get('name_middle', None) self.organization = kwargs.get('organization', None) - self.phone = kwargs.get('phone', None) + self.phone = kwargs['phone'] class ContinuousWebJob(ProxyOnlyResource): """Continuous Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3102,10 +3321,9 @@ class ContinuousWebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param status: Job status. Possible values include: 'Initializing', - 'Starting', 'Running', 'PendingRestart', 'Stopped' - :type status: str or - ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobStatus + :param status: Job status. Possible values include: "Initializing", "Starting", "Running", + "PendingRestart", "Stopped". + :type status: str or ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobStatus :param detailed_status: Detailed status. :type detailed_status: str :param log_url: Log URL. @@ -3116,12 +3334,11 @@ class ContinuousWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2018_02_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -3138,19 +3355,22 @@ class ContinuousWebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ContinuousWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'detailed_status': {'key': 'properties.detailed_status', 'type': 'str'}, 'log_url': {'key': 'properties.log_url', 'type': 'str'}, 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContinuousWebJob, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.detailed_status = kwargs.get('detailed_status', None) @@ -3164,15 +3384,47 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) -class CorsSettings(Model): +class ContinuousWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContinuousWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ContinuousWebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] - :param support_credentials: Gets or sets whether CORS requests with - credentials are allowed. See + :param support_credentials: Gets or sets whether CORS requests with credentials are allowed. + See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials for more details. :type support_credentials: bool @@ -3183,15 +3435,17 @@ class CorsSettings(Model): 'support_credentials': {'key': 'supportCredentials', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = kwargs.get('allowed_origins', None) self.support_credentials = kwargs.get('support_credentials', None) -class CsmMoveResourceEnvelope(Model): - """Object with a list of the resources that need to be moved and the resource - group they should be moved to. +class CsmMoveResourceEnvelope(msrest.serialization.Model): + """Object with a list of the resources that need to be moved and the resource group they should be moved to. :param target_resource_group: :type target_resource_group: str @@ -3208,24 +3462,58 @@ class CsmMoveResourceEnvelope(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmMoveResourceEnvelope, self).__init__(**kwargs) self.target_resource_group = kwargs.get('target_resource_group', None) self.resources = kwargs.get('resources', None) -class CsmOperationDescription(Model): +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2018_02_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -3235,7 +3523,10 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3243,24 +3534,27 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2018_02_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2018_02_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -3280,7 +3574,10 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3288,17 +3585,15 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class CsmPublishingProfileOptions(Model): +class CsmPublishingProfileOptions(msrest.serialization.Model): """Publishing options for requested profile. :param format: Name of the format. Valid values are: FileZilla3 WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2018_02_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the DisasterRecover - endpoint if true + Ftp. Possible values include: "FileZilla3", "WebDeploy", "Ftp". + :type format: str or ~azure.mgmt.web.v2018_02_01.models.PublishingProfileFormat + :param include_disaster_recovery_endpoints: Include the DisasterRecover endpoint if true. :type include_disaster_recovery_endpoints: bool """ @@ -3307,22 +3602,24 @@ class CsmPublishingProfileOptions(Model): 'include_disaster_recovery_endpoints': {'key': 'includeDisasterRecoveryEndpoints', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmPublishingProfileOptions, self).__init__(**kwargs) self.format = kwargs.get('format', None) self.include_disaster_recovery_endpoints = kwargs.get('include_disaster_recovery_endpoints', None) -class CsmSlotEntity(Model): +class CsmSlotEntity(msrest.serialization.Model): """Deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during swap - operation. + :param target_slot: Required. Destination deployment slot during swap operation. :type target_slot: str - :param preserve_vnet: Required. true to preserve Virtual - Network to the slot during swap; otherwise, false. + :param preserve_vnet: Required. :code:`true` to preserve Virtual Network to the + slot during swap; otherwise, :code:`false`. :type preserve_vnet: bool """ @@ -3336,19 +3633,22 @@ class CsmSlotEntity(Model): 'preserve_vnet': {'key': 'preserveVnet', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmSlotEntity, self).__init__(**kwargs) - self.target_slot = kwargs.get('target_slot', None) - self.preserve_vnet = kwargs.get('preserve_vnet', None) + self.target_slot = kwargs['target_slot'] + self.preserve_vnet = kwargs['preserve_vnet'] -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -3365,7 +3665,10 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = kwargs.get('unit', None) self.next_reset_time = kwargs.get('next_reset_time', None) @@ -3374,11 +3677,42 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class CustomHostnameAnalysisResult(ProxyOnlyResource): """Custom domain analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3388,25 +3722,25 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar is_hostname_already_verified: true if hostname is - already verified; otherwise, false. + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. - Possible values include: 'Passed', 'Failed', 'Skipped' + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.web.v2018_02_01.models.DnsVerificationTestResult - :ivar custom_domain_verification_failure_info: Raw failure information if - DNS verification fails. + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. :vartype custom_domain_verification_failure_info: ~azure.mgmt.web.v2018_02_01.models.ErrorEntity - :ivar has_conflict_on_scale_unit: true if there is a conflict - on a scale unit; otherwise, false. + :ivar has_conflict_on_scale_unit: :code:`true` if there is a conflict on a scale + unit; otherwise, :code:`false`. :vartype has_conflict_on_scale_unit: bool - :ivar has_conflict_across_subscription: true if there is a - conflict across subscriptions; otherwise, false. + :ivar has_conflict_across_subscription: :code:`true` if there is a conflict across + subscriptions; otherwise, :code:`false`. :vartype has_conflict_across_subscription: bool - :ivar conflicting_app_resource_id: Name of the conflicting app on scale - unit if it's within the same subscription. + :ivar conflicting_app_resource_id: Name of the conflicting app on scale unit if it's within the + same subscription. :vartype conflicting_app_resource_id: str :param c_name_records: CName records controller can see for this hostname. :type c_name_records: list[str] @@ -3414,11 +3748,9 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type txt_records: list[str] :param a_records: A records controller can see for this hostname. :type a_records: list[str] - :param alternate_cname_records: Alternate CName records controller can see - for this hostname. - :type alternate_cname_records: list[str] - :param alternate_txt_records: Alternate TXT records controller can see for - this hostname. + :param alternate_c_name_records: Alternate CName records controller can see for this hostname. + :type alternate_c_name_records: list[str] + :param alternate_txt_records: Alternate TXT records controller can see for this hostname. :type alternate_txt_records: list[str] """ @@ -3440,7 +3772,7 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'DnsVerificationTestResult'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'ErrorEntity'}, 'has_conflict_on_scale_unit': {'key': 'properties.hasConflictOnScaleUnit', 'type': 'bool'}, 'has_conflict_across_subscription': {'key': 'properties.hasConflictAcrossSubscription', 'type': 'bool'}, @@ -3448,11 +3780,14 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_cname_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomHostnameAnalysisResult, self).__init__(**kwargs) self.is_hostname_already_verified = None self.custom_domain_verification_test = None @@ -3463,28 +3798,27 @@ def __init__(self, **kwargs): self.c_name_records = kwargs.get('c_name_records', None) self.txt_records = kwargs.get('txt_records', None) self.a_records = kwargs.get('a_records', None) - self.alternate_cname_records = kwargs.get('alternate_cname_records', None) + self.alternate_c_name_records = kwargs.get('alternate_c_name_records', None) self.alternate_txt_records = kwargs.get('alternate_txt_records', None) -class DatabaseBackupSetting(Model): +class DatabaseBackupSetting(msrest.serialization.Model): """Database backup settings. All required parameters must be populated in order to send to Azure. - :param database_type: Required. Database type (e.g. SqlAzure / MySql). - Possible values include: 'SqlAzure', 'MySql', 'LocalMySql', 'PostgreSql' - :type database_type: str or - ~azure.mgmt.web.v2018_02_01.models.DatabaseType + :param database_type: Required. Database type (e.g. SqlAzure / MySql). Possible values include: + "SqlAzure", "MySql", "LocalMySql", "PostgreSql". + :type database_type: str or ~azure.mgmt.web.v2018_02_01.models.DatabaseType :param name: :type name: str - :param connection_string_name: Contains a connection string name that is - linked to the SiteConfig.ConnectionStrings. + :param connection_string_name: Contains a connection string name that is linked to the + SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. :type connection_string_name: str - :param connection_string: Contains a connection string to a database which - is being backed up or restored. If the restore should happen to a new - database, the database name inside is the new one. + :param connection_string: Contains a connection string to a database which is being backed up + or restored. If the restore should happen to a new database, the database name inside is the + new one. :type connection_string: str """ @@ -3499,22 +3833,24 @@ class DatabaseBackupSetting(Model): 'connection_string': {'key': 'connectionString', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DatabaseBackupSetting, self).__init__(**kwargs) - self.database_type = kwargs.get('database_type', None) + self.database_type = kwargs['database_type'] self.name = kwargs.get('name', None) self.connection_string_name = kwargs.get('connection_string_name', None) self.connection_string = kwargs.get('connection_string', None) -class DataSource(Model): +class DataSource(msrest.serialization.Model): """Class representing data source used by the detectors. - :param instructions: Instructions if any for the data source + :param instructions: Instructions if any for the data source. :type instructions: list[str] - :param data_source_uri: Datasource Uri Links - :type data_source_uri: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param data_source_uri: Datasource Uri Links. + :type data_source_uri: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] """ _attribute_map = { @@ -3522,20 +3858,23 @@ class DataSource(Model): 'data_source_uri': {'key': 'dataSourceUri', 'type': '[NameValuePair]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataSource, self).__init__(**kwargs) self.instructions = kwargs.get('instructions', None) self.data_source_uri = kwargs.get('data_source_uri', None) -class DataTableResponseColumn(Model): +class DataTableResponseColumn(msrest.serialization.Model): """Column definition. - :param column_name: Name of the column + :param column_name: Name of the column. :type column_name: str :param data_type: Data type which looks like 'String' or 'Int32'. :type data_type: str - :param column_type: Column Type + :param column_type: Column Type. :type column_type: str """ @@ -3545,22 +3884,24 @@ class DataTableResponseColumn(Model): 'column_type': {'key': 'columnType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataTableResponseColumn, self).__init__(**kwargs) self.column_name = kwargs.get('column_name', None) self.data_type = kwargs.get('data_type', None) self.column_type = kwargs.get('column_type', None) -class DataTableResponseObject(Model): +class DataTableResponseObject(msrest.serialization.Model): """Data Table which defines columns and raw row values. - :param table_name: Name of the table + :param table_name: Name of the table. :type table_name: str - :param columns: List of columns with data types - :type columns: - list[~azure.mgmt.web.v2018_02_01.models.DataTableResponseColumn] - :param rows: Raw row values + :param columns: List of columns with data types. + :type columns: list[~azure.mgmt.web.v2018_02_01.models.DataTableResponseColumn] + :param rows: Raw row values. :type rows: list[list[str]] """ @@ -3570,22 +3911,23 @@ class DataTableResponseObject(Model): 'rows': {'key': 'rows', 'type': '[[str]]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataTableResponseObject, self).__init__(**kwargs) self.table_name = kwargs.get('table_name', None) self.columns = kwargs.get('columns', None) self.rows = kwargs.get('rows', None) -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseError """ _validation = { @@ -3596,28 +3938,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -3626,8 +3958,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -3647,7 +3978,10 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -3656,11 +3990,10 @@ def __init__(self, **kwargs): self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -3682,7 +4015,10 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None @@ -3692,8 +4028,7 @@ def __init__(self, **kwargs): class DeletedAppRestoreRequest(ProxyOnlyResource): """Details about restoring a deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3704,17 +4039,16 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param deleted_site_id: ARM resource ID of the deleted app. Example: - /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}. :type deleted_site_id: str - :param recover_configuration: If true, deleted site configuration, in - addition to content, will be restored. + :param recover_configuration: If true, deleted site configuration, in addition to content, will + be restored. :type recover_configuration: bool - :param snapshot_time: Point in time to restore the deleted app from, - formatted as a DateTime string. + :param snapshot_time: Point in time to restore the deleted app from, formatted as a DateTime + string. If unspecified, default value is the time that the app was deleted. :type snapshot_time: str - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -3735,7 +4069,10 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedAppRestoreRequest, self).__init__(**kwargs) self.deleted_site_id = kwargs.get('deleted_site_id', None) self.recover_configuration = kwargs.get('recover_configuration', None) @@ -3746,8 +4083,7 @@ def __init__(self, **kwargs): class DeletedSite(ProxyOnlyResource): """A deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3757,21 +4093,21 @@ class DeletedSite(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deleted_site_id: Numeric id for the deleted site + :ivar deleted_site_id: Numeric id for the deleted site. :vartype deleted_site_id: int :ivar deleted_timestamp: Time in UTC when the app was deleted. :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site + :ivar subscription: Subscription containing the deleted site. :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site + :ivar resource_group: ResourceGroup that contained the deleted site. :vartype resource_group: str - :ivar deleted_site_name: Name of the deleted site + :ivar deleted_site_name: Name of the deleted site. :vartype deleted_site_name: str - :ivar slot: Slot of the deleted site + :ivar slot: Slot of the deleted site. :vartype slot: str - :ivar deleted_site_kind: Kind of site that was deleted - :vartype deleted_site_kind: str - :ivar geo_region_name: Geo Region of the deleted site + :ivar kind_properties_kind: Kind of site that was deleted. + :vartype kind_properties_kind: str + :ivar geo_region_name: Geo Region of the deleted site. :vartype geo_region_name: str """ @@ -3785,7 +4121,7 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'readonly': True}, 'deleted_site_name': {'readonly': True}, 'slot': {'readonly': True}, - 'deleted_site_kind': {'readonly': True}, + 'kind_properties_kind': {'readonly': True}, 'geo_region_name': {'readonly': True}, } @@ -3800,11 +4136,14 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, 'deleted_site_name': {'key': 'properties.deletedSiteName', 'type': 'str'}, 'slot': {'key': 'properties.slot', 'type': 'str'}, - 'deleted_site_kind': {'key': 'properties.kind', 'type': 'str'}, + 'kind_properties_kind': {'key': 'properties.kind', 'type': 'str'}, 'geo_region_name': {'key': 'properties.geoRegionName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSite, self).__init__(**kwargs) self.deleted_site_id = None self.deleted_timestamp = None @@ -3812,15 +4151,46 @@ def __init__(self, **kwargs): self.resource_group = None self.deleted_site_name = None self.slot = None - self.deleted_site_kind = None + self.kind_properties_kind = None self.geo_region_name = None +class DeletedWebAppCollection(msrest.serialization.Model): + """Collection of deleted apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DeletedSite] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedWebAppCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class Deployment(ProxyOnlyResource): """User credentials used for publishing activity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3841,11 +4211,11 @@ class Deployment(ProxyOnlyResource): :param author_email: Author email. :type author_email: str :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime - :param active: True if deployment is currently active, false if completed - and null if not started. + :type end_time: ~datetime.datetime + :param active: True if deployment is currently active, false if completed and null if not + started. :type active: bool :param details: Details on deployment. :type details: str @@ -3873,7 +4243,10 @@ class Deployment(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Deployment, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.message = kwargs.get('message', None) @@ -3886,18 +4259,49 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class DeploymentLocations(Model): +class DeploymentCollection(msrest.serialization.Model): + """Collection of app deployments. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Deployment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Deployment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DeploymentLocations(msrest.serialization.Model): """List of available locations (regions or App Service Environments) for - deployment of App Service resources. +deployment of App Service resources. :param locations: Available regions. :type locations: list[~azure.mgmt.web.v2018_02_01.models.GeoRegion] - :param hosting_environments: Available App Service Environments with full - descriptions of the environments. - :type hosting_environments: - list[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironment] - :param hosting_environment_deployment_infos: Available App Service - Environments with basic information. + :param hosting_environments: Available App Service Environments with full descriptions of the + environments. + :type hosting_environments: list[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironment] + :param hosting_environment_deployment_infos: Available App Service Environments with basic + information. :type hosting_environment_deployment_infos: list[~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDeploymentInfo] """ @@ -3908,34 +4312,36 @@ class DeploymentLocations(Model): 'hosting_environment_deployment_infos': {'key': 'hostingEnvironmentDeploymentInfos', 'type': '[HostingEnvironmentDeploymentInfo]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentLocations, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.hosting_environments = kwargs.get('hosting_environments', None) self.hosting_environment_deployment_infos = kwargs.get('hosting_environment_deployment_infos', None) -class DetectorAbnormalTimePeriod(Model): +class DetectorAbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period detected. - :param start_time: Start time of the correlated event - :type start_time: datetime - :param end_time: End time of the correlated event - :type end_time: datetime - :param message: Message describing the event + :param start_time: Start time of the correlated event. + :type start_time: ~datetime.datetime + :param end_time: End time of the correlated event. + :type end_time: ~datetime.datetime + :param message: Message describing the event. :type message: str - :param source: Represents the name of the Detector + :param source: Represents the name of the Detector. :type source: str - :param priority: Represents the rank of the Detector + :param priority: Represents the rank of the Detector. :type priority: float - :param meta_data: Downtime metadata - :type meta_data: - list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] - :param type: Represents the type of the Detector. Possible values include: - 'ServiceIncident', 'AppDeployment', 'AppCrash', 'RuntimeIssueDetected', - 'AseDeployment', 'UserIssue', 'PlatformIssue', 'Other' + :param meta_data: Downtime metadata. + :type meta_data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] + :param type: Represents the type of the Detector. Possible values include: "ServiceIncident", + "AppDeployment", "AppCrash", "RuntimeIssueDetected", "AseDeployment", "UserIssue", + "PlatformIssue", "Other". :type type: str or ~azure.mgmt.web.v2018_02_01.models.IssueType - :param solutions: List of proposed solutions + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2018_02_01.models.Solution] """ @@ -3946,11 +4352,14 @@ class DetectorAbnormalTimePeriod(Model): 'source': {'key': 'source', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'float'}, 'meta_data': {'key': 'metaData', 'type': '[[NameValuePair]]'}, - 'type': {'key': 'type', 'type': 'IssueType'}, + 'type': {'key': 'type', 'type': 'str'}, 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorAbnormalTimePeriod, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -3965,8 +4374,7 @@ def __init__(self, **kwargs): class DetectorDefinition(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3976,11 +4384,11 @@ class DetectorDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar display_name: Display name of the detector + :ivar display_name: Display name of the detector. :vartype display_name: str - :ivar description: Description of the detector + :ivar description: Description of the detector. :vartype description: str - :ivar rank: Detector Rank + :ivar rank: Detector Rank. :vartype rank: float :ivar is_enabled: Flag representing whether detector is enabled or not. :vartype is_enabled: bool @@ -4007,7 +4415,10 @@ class DetectorDefinition(ProxyOnlyResource): 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorDefinition, self).__init__(**kwargs) self.display_name = None self.description = None @@ -4015,19 +4426,18 @@ def __init__(self, **kwargs): self.is_enabled = None -class DetectorInfo(Model): +class DetectorInfo(msrest.serialization.Model): """Definition of Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Short description of the detector and its purpose + :ivar description: Short description of the detector and its purpose. :vartype description: str - :ivar category: Support Category + :ivar category: Support Category. :vartype category: str - :ivar sub_category: Support Sub Category + :ivar sub_category: Support Sub Category. :vartype sub_category: str - :ivar support_topic_id: Support Topic Id + :ivar support_topic_id: Support Topic Id. :vartype support_topic_id: str """ @@ -4045,7 +4455,10 @@ class DetectorInfo(Model): 'support_topic_id': {'key': 'supportTopicId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorInfo, self).__init__(**kwargs) self.description = None self.category = None @@ -4056,8 +4469,7 @@ def __init__(self, **kwargs): class DetectorResponse(ProxyOnlyResource): """Class representing Response from Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4067,9 +4479,9 @@ class DetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param metadata: metadata for the detector + :param metadata: metadata for the detector. :type metadata: ~azure.mgmt.web.v2018_02_01.models.DetectorInfo - :param dataset: Data Set + :param dataset: Data Set. :type dataset: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticData] """ @@ -4088,17 +4500,51 @@ class DetectorResponse(ProxyOnlyResource): 'dataset': {'key': 'properties.dataset', 'type': '[DiagnosticData]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorResponse, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.dataset = kwargs.get('dataset', None) +class DetectorResponseCollection(msrest.serialization.Model): + """Collection of detector responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DetectorResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DetectorResponseCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticAnalysis(ProxyOnlyResource): """Class representing a diagnostic analysis done on an application. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4108,19 +4554,16 @@ class DiagnosticAnalysis(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param abnormal_time_periods: List of time periods. - :type abnormal_time_periods: - list[~azure.mgmt.web.v2018_02_01.models.AbnormalTimePeriod] - :param payload: Data by each detector + :type abnormal_time_periods: list[~azure.mgmt.web.v2018_02_01.models.AbnormalTimePeriod] + :param payload: Data by each detector. :type payload: list[~azure.mgmt.web.v2018_02_01.models.AnalysisData] - :param non_correlated_detectors: Data by each detector for detectors that - did not corelate - :type non_correlated_detectors: - list[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] + :param non_correlated_detectors: Data by each detector for detectors that did not corelate. + :type non_correlated_detectors: list[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] """ _validation = { @@ -4141,7 +4584,10 @@ class DiagnosticAnalysis(ProxyOnlyResource): 'non_correlated_detectors': {'key': 'properties.nonCorrelatedDetectors', 'type': '[DetectorDefinition]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticAnalysis, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -4150,11 +4596,42 @@ def __init__(self, **kwargs): self.non_correlated_detectors = kwargs.get('non_correlated_detectors', None) +class DiagnosticAnalysisCollection(msrest.serialization.Model): + """Collection of Diagnostic Analyses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AnalysisDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticAnalysisCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticCategory(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4164,7 +4641,7 @@ class DiagnosticCategory(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the diagnostic category + :ivar description: Description of the diagnostic category. :vartype description: str """ @@ -4183,18 +4660,52 @@ class DiagnosticCategory(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticCategory, self).__init__(**kwargs) self.description = None -class DiagnosticData(Model): +class DiagnosticCategoryCollection(msrest.serialization.Model): + """Collection of Diagnostic Categories. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticCategory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticCategoryCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DiagnosticData(msrest.serialization.Model): """Set of data with rendering instructions. - :param table: Data in table form + :param table: Data in table form. :type table: ~azure.mgmt.web.v2018_02_01.models.DataTableResponseObject - :param rendering_properties: Properties that describe how the table should - be rendered + :param rendering_properties: Properties that describe how the table should be rendered. :type rendering_properties: ~azure.mgmt.web.v2018_02_01.models.Rendering """ @@ -4203,17 +4714,51 @@ class DiagnosticData(Model): 'rendering_properties': {'key': 'renderingProperties', 'type': 'Rendering'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticData, self).__init__(**kwargs) self.table = kwargs.get('table', None) self.rendering_properties = kwargs.get('rendering_properties', None) +class DiagnosticDetectorCollection(msrest.serialization.Model): + """Collection of Diagnostic Detectors. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticDetectorCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticDetectorResponse(ProxyOnlyResource): """Class representing Response from Diagnostic Detectors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4223,27 +4768,23 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param issue_detected: Flag representing Issue was detected. :type issue_detected: bool - :param detector_definition: Detector's definition - :type detector_definition: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition - :param metrics: Metrics provided by the detector - :type metrics: - list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] - :param abnormal_time_periods: List of Correlated events found by the - detector + :param detector_definition: Detector's definition. + :type detector_definition: ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition + :param metrics: Metrics provided by the detector. + :type metrics: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] + :param abnormal_time_periods: List of Correlated events found by the detector. :type abnormal_time_periods: list[~azure.mgmt.web.v2018_02_01.models.DetectorAbnormalTimePeriod] :param data: Additional Data that detector wants to send. :type data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] - :param response_meta_data: Meta Data - :type response_meta_data: - ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData + :param response_meta_data: Meta Data. + :type response_meta_data: ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData """ _validation = { @@ -4267,7 +4808,10 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): 'response_meta_data': {'key': 'properties.responseMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticDetectorResponse, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -4279,28 +4823,24 @@ def __init__(self, **kwargs): self.response_meta_data = kwargs.get('response_meta_data', None) -class DiagnosticMetricSample(Model): +class DiagnosticMetricSample(msrest.serialization.Model): """Class representing Diagnostic Metric. - :param timestamp: Time at which metric is measured - :type timestamp: datetime - :param role_instance: Role Instance. Null if this counter is not per - instance - This is returned and should be whichever instance name we desire to be - returned + :param timestamp: Time at which metric is measured. + :type timestamp: ~datetime.datetime + :param role_instance: Role Instance. Null if this counter is not per instance + This is returned and should be whichever instance name we desire to be returned i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) - where RDWORKERNAME is Machine name below and RoleInstance name in - parenthesis + where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis. :type role_instance: str - :param total: Total value of the metric. If multiple measurements are made - this will have sum of all. + :param total: Total value of the metric. If multiple measurements are made this will have sum + of all. :type total: float - :param maximum: Maximum of the metric sampled during the time period + :param maximum: Maximum of the metric sampled during the time period. :type maximum: float - :param minimum: Minimum of the metric sampled during the time period + :param minimum: Minimum of the metric sampled during the time period. :type minimum: float - :param is_aggregated: Whether the values are aggregates across all workers - or not + :param is_aggregated: Whether the values are aggregates across all workers or not. :type is_aggregated: bool """ @@ -4313,7 +4853,10 @@ class DiagnosticMetricSample(Model): 'is_aggregated': {'key': 'isAggregated', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticMetricSample, self).__init__(**kwargs) self.timestamp = kwargs.get('timestamp', None) self.role_instance = kwargs.get('role_instance', None) @@ -4323,25 +4866,22 @@ def __init__(self, **kwargs): self.is_aggregated = kwargs.get('is_aggregated', None) -class DiagnosticMetricSet(Model): +class DiagnosticMetricSet(msrest.serialization.Model): """Class representing Diagnostic Metric information. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param unit: Metric's unit + :param unit: Metric's unit. :type unit: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime - :param time_grain: Presented time grain. Supported grains at the moment - are PT1M, PT1H, P1D + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime + :param time_grain: Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D. :type time_grain: str - :param values: Collection of metric values for the selected period based - on the - {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} - :type values: - list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSample] + :param values: Collection of metric values for the selected period based on the + {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain}. + :type values: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSample] """ _attribute_map = { @@ -4353,7 +4893,10 @@ class DiagnosticMetricSet(Model): 'values': {'key': 'values', 'type': '[DiagnosticMetricSample]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticMetricSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.unit = kwargs.get('unit', None) @@ -4363,10 +4906,9 @@ def __init__(self, **kwargs): self.values = kwargs.get('values', None) -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -4385,7 +4927,10 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -4396,8 +4941,7 @@ def __init__(self, **kwargs): class Domain(Resource): """Information about a domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -4411,62 +4955,58 @@ class Domain(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2018_02_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2018_02_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2018_02_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2018_02_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2018_02_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2018_02_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.DomainPropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType :param auth_code: :type auth_code: str @@ -4477,10 +5017,6 @@ class Domain(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -4489,7 +5025,6 @@ class Domain(Resource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -4504,8 +5039,8 @@ class Domain(Resource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -4516,13 +5051,16 @@ class Domain(Resource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Domain, self).__init__(**kwargs) self.contact_admin = kwargs.get('contact_admin', None) self.contact_billing = kwargs.get('contact_billing', None) @@ -4546,46 +5084,79 @@ def __init__(self, **kwargs): self.auth_code = kwargs.get('auth_code', None) -class DomainAvailablilityCheckResult(Model): +class DomainAvailablilityCheckResult(msrest.serialization.Model): """Domain availability check result. :param name: Name of the domain. :type name: str - :param available: true if domain can be purchased using - CreateDomain API; otherwise, false. + :param available: :code:`true` if domain can be purchased using CreateDomain API; + otherwise, :code:`false`. :type available: bool - :param domain_type: Valid values are Regular domain: Azure will charge the - full price of domain registration, SoftDeleted: Purchasing this domain - will simply restore it and this operation will not cost anything. Possible - values include: 'Regular', 'SoftDeleted' + :param domain_type: Valid values are Regular domain: Azure will charge the full price of domain + registration, SoftDeleted: Purchasing this domain will simply restore it and this operation + will not cost anything. Possible values include: "Regular", "SoftDeleted". :type domain_type: str or ~azure.mgmt.web.v2018_02_01.models.DomainType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'available': {'key': 'available', 'type': 'bool'}, - 'domain_type': {'key': 'domainType', 'type': 'DomainType'}, + 'domain_type': {'key': 'domainType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainAvailablilityCheckResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available = kwargs.get('available', None) self.domain_type = kwargs.get('domain_type', None) -class DomainControlCenterSsoRequest(Model): +class DomainCollection(msrest.serialization.Model): + """Collection of domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Domain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DomainCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DomainControlCenterSsoRequest(msrest.serialization.Model): """Single sign-on request information for domain management. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar url: URL where the single sign-on request is to be made. :vartype url: str :ivar post_parameter_key: Post parameter key. :vartype post_parameter_key: str - :ivar post_parameter_value: Post parameter value. Client should use - 'application/x-www-form-urlencoded' encoding for this value. + :ivar post_parameter_value: Post parameter value. Client should use 'application/x-www-form- + urlencoded' encoding for this value. :vartype post_parameter_value: str """ @@ -4601,7 +5172,10 @@ class DomainControlCenterSsoRequest(Model): 'post_parameter_value': {'key': 'postParameterValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainControlCenterSsoRequest, self).__init__(**kwargs) self.url = None self.post_parameter_key = None @@ -4611,8 +5185,7 @@ def __init__(self, **kwargs): class DomainOwnershipIdentifier(ProxyOnlyResource): """Domain ownership Identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4640,81 +5213,109 @@ class DomainOwnershipIdentifier(ProxyOnlyResource): 'ownership_id': {'key': 'properties.ownershipId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainOwnershipIdentifier, self).__init__(**kwargs) self.ownership_id = kwargs.get('ownership_id', None) -class DomainPatchResource(ProxyOnlyResource): - """ARM resource for a domain. +class DomainOwnershipIdentifierCollection(msrest.serialization.Model): + """Collection of domain ownership identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DomainOwnershipIdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DomainPatchResource(ProxyOnlyResource): + """ARM resource for a domain. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str :ivar type: Resource type. :vartype type: str - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2018_02_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2018_02_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2018_02_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2018_02_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2018_02_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2018_02_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.DomainPatchResourcePropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType :param auth_code: :type auth_code: str @@ -4724,10 +5325,6 @@ class DomainPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -4736,7 +5333,6 @@ class DomainPatchResource(ProxyOnlyResource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -4749,8 +5345,8 @@ class DomainPatchResource(ProxyOnlyResource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -4761,13 +5357,16 @@ class DomainPatchResource(ProxyOnlyResource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainPatchResource, self).__init__(**kwargs) self.contact_admin = kwargs.get('contact_admin', None) self.contact_billing = kwargs.get('contact_billing', None) @@ -4791,18 +5390,16 @@ def __init__(self, **kwargs): self.auth_code = kwargs.get('auth_code', None) -class DomainPurchaseConsent(Model): - """Domain purchase consent object, representing acceptance of applicable legal - agreements. +class DomainPurchaseConsent(msrest.serialization.Model): + """Domain purchase consent object, representing acceptance of applicable legal agreements. - :param agreement_keys: List of applicable legal agreement keys. This list - can be retrieved using ListLegalAgreements API under - TopLevelDomain resource. + :param agreement_keys: List of applicable legal agreement keys. This list can be retrieved + using ListLegalAgreements API under :code:`TopLevelDomain` resource. :type agreement_keys: list[str] :param agreed_by: Client IP address. :type agreed_by: str :param agreed_at: Timestamp when the agreements were accepted. - :type agreed_at: datetime + :type agreed_at: ~datetime.datetime """ _attribute_map = { @@ -4811,18 +5408,20 @@ class DomainPurchaseConsent(Model): 'agreed_at': {'key': 'agreedAt', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainPurchaseConsent, self).__init__(**kwargs) self.agreement_keys = kwargs.get('agreement_keys', None) self.agreed_by = kwargs.get('agreed_by', None) self.agreed_at = kwargs.get('agreed_at', None) -class DomainRecommendationSearchParameters(Model): +class DomainRecommendationSearchParameters(msrest.serialization.Model): """Domain recommendation search parameters. - :param keywords: Keywords to be used for generating domain - recommendations. + :param keywords: Keywords to be used for generating domain recommendations. :type keywords: str :param max_domain_recommendations: Maximum number of recommendations. :type max_domain_recommendations: int @@ -4833,17 +5432,20 @@ class DomainRecommendationSearchParameters(Model): 'max_domain_recommendations': {'key': 'maxDomainRecommendations', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainRecommendationSearchParameters, self).__init__(**kwargs) self.keywords = kwargs.get('keywords', None) self.max_domain_recommendations = kwargs.get('max_domain_recommendations', None) -class EnabledConfig(Model): +class EnabledConfig(msrest.serialization.Model): """Enabled configuration. - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -4851,21 +5453,21 @@ class EnabledConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EnabledConfig, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) -class EndpointDependency(Model): - """A domain name that a service is reached at, including details of the - current connection status. +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at, including details of the current connection status. :param domain_name: The domain name of the dependency. :type domain_name: str - :param endpoint_details: The IP Addresses and Ports used when connecting - to DomainName. - :type endpoint_details: - list[~azure.mgmt.web.v2018_02_01.models.EndpointDetail] + :param endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :type endpoint_details: list[~azure.mgmt.web.v2018_02_01.models.EndpointDetail] """ _attribute_map = { @@ -4873,26 +5475,27 @@ class EndpointDependency(Model): 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EndpointDependency, self).__init__(**kwargs) self.domain_name = kwargs.get('domain_name', None) self.endpoint_details = kwargs.get('endpoint_details', None) -class EndpointDetail(Model): - """Current TCP connectivity information from the App Service Environment to a - single endpoint. +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the App Service Environment to a single endpoint. :param ip_address: An IP Address that Domain Name currently resolves to. :type ip_address: str :param port: The port an endpoint is connected to. :type port: int - :param latency: The time in milliseconds it takes for a TCP connection to - be created from the App Service Environment to this IpAddress at this - Port. + :param latency: The time in milliseconds it takes for a TCP connection to be created from the + App Service Environment to this IpAddress at this Port. :type latency: float - :param is_accessable: Whether it is possible to create a TCP connection - from the App Service Environment to this IpAddress at this Port. + :param is_accessable: Whether it is possible to create a TCP connection from the App Service + Environment to this IpAddress at this Port. :type is_accessable: bool """ @@ -4903,7 +5506,10 @@ class EndpointDetail(Model): 'is_accessable': {'key': 'isAccessable', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EndpointDetail, self).__init__(**kwargs) self.ip_address = kwargs.get('ip_address', None) self.port = kwargs.get('port', None) @@ -4911,7 +5517,7 @@ def __init__(self, **kwargs): self.is_accessable = kwargs.get('is_accessable', None) -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -4937,7 +5543,10 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = kwargs.get('extended_code', None) self.message_template = kwargs.get('message_template', None) @@ -4947,7 +5556,7 @@ def __init__(self, **kwargs): self.message = kwargs.get('message', None) -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -4958,33 +5567,38 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = kwargs.get('ramp_up_rules', None) -class FileSystemApplicationLogsConfig(Model): +class FileSystemApplicationLogsConfig(msrest.serialization.Model): """Application logs to file system configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error'. Default value: "Off" . + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2018_02_01.models.LogLevel """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FileSystemApplicationLogsConfig, self).__init__(**kwargs) - self.level = kwargs.get('level', "Off") + self.level = kwargs.get('level', None) -class FileSystemHttpLogsConfig(Model): +class FileSystemHttpLogsConfig(msrest.serialization.Model): """Http logs to file system configuration. - :param retention_in_mb: Maximum size in megabytes that http log files can - use. + :param retention_in_mb: Maximum size in megabytes that http log files can use. When reached old log files will be removed to make space for new ones. Value can range between 25 and 100. :type retention_in_mb: int @@ -4992,8 +5606,8 @@ class FileSystemHttpLogsConfig(Model): Remove files older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -5007,7 +5621,10 @@ class FileSystemHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FileSystemHttpLogsConfig, self).__init__(**kwargs) self.retention_in_mb = kwargs.get('retention_in_mb', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -5017,8 +5634,7 @@ def __init__(self, **kwargs): class FunctionEnvelope(ProxyOnlyResource): """Function information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5048,11 +5664,11 @@ class FunctionEnvelope(ProxyOnlyResource): :type files: dict[str, str] :param test_data: Test data used when testing via the Azure Portal. :type test_data: str - :param invoke_url_template: The invocation URL + :param invoke_url_template: The invocation URL. :type invoke_url_template: str - :param language: The function language + :param language: The function language. :type language: str - :param is_disabled: Value indicating whether the function is disabled + :param is_disabled: Value indicating whether the function is disabled. :type is_disabled: bool """ @@ -5082,7 +5698,10 @@ class FunctionEnvelope(ProxyOnlyResource): 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FunctionEnvelope, self).__init__(**kwargs) self.function_app_id = kwargs.get('function_app_id', None) self.script_root_path_href = kwargs.get('script_root_path_href', None) @@ -5099,11 +5718,42 @@ def __init__(self, **kwargs): self.is_disabled = kwargs.get('is_disabled', None) +class FunctionEnvelopeCollection(msrest.serialization.Model): + """Collection of Kudu function information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FunctionEnvelopeCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class FunctionSecrets(ProxyOnlyResource): """Function secrets. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5134,13 +5784,16 @@ class FunctionSecrets(ProxyOnlyResource): 'trigger_url': {'key': 'properties.trigger_url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FunctionSecrets, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.trigger_url = kwargs.get('trigger_url', None) -class GeoDistribution(Model): +class GeoDistribution(msrest.serialization.Model): """A global distribution definition. :param location: Location. @@ -5154,7 +5807,10 @@ class GeoDistribution(Model): 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GeoDistribution, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.number_of_workers = kwargs.get('number_of_workers', None) @@ -5163,8 +5819,7 @@ def __init__(self, **kwargs): class GeoRegion(ProxyOnlyResource): """Geographical region. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5197,13 +5852,48 @@ class GeoRegion(ProxyOnlyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GeoRegion, self).__init__(**kwargs) self.description = None self.display_name = None -class GlobalCsmSkuDescription(Model): +class GeoRegionCollection(msrest.serialization.Model): + """Collection of geographical regions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.GeoRegion] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GeoRegion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoRegionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class GlobalCsmSkuDescription(msrest.serialization.Model): """A Global SKU Description. :param name: Name of the resource SKU. @@ -5218,8 +5908,7 @@ class GlobalCsmSkuDescription(Model): :type capacity: ~azure.mgmt.web.v2018_02_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2018_02_01.models.Capability] """ @@ -5233,7 +5922,10 @@ class GlobalCsmSkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GlobalCsmSkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -5244,19 +5936,16 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -5266,14 +5955,17 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = kwargs.get('extension', None) self.script_processor = kwargs.get('script_processor', None) self.arguments = kwargs.get('arguments', None) -class HostingEnvironmentDeploymentInfo(Model): +class HostingEnvironmentDeploymentInfo(msrest.serialization.Model): """Information needed to create resources on an App Service Environment. :param name: Name of the App Service Environment. @@ -5287,13 +5979,16 @@ class HostingEnvironmentDeploymentInfo(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentDeploymentInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.location = kwargs.get('location', None) -class HostingEnvironmentDiagnostics(Model): +class HostingEnvironmentDiagnostics(msrest.serialization.Model): """Diagnostics for an App Service Environment. :param name: Name/identifier of the diagnostics. @@ -5307,17 +6002,19 @@ class HostingEnvironmentDiagnostics(Model): 'diagnosics_output': {'key': 'diagnosicsOutput', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentDiagnostics, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.diagnosics_output = kwargs.get('diagnosics_output', None) -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -5338,14 +6035,17 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None self.type = None -class HostKeys(Model): +class HostKeys(msrest.serialization.Model): """Functions host level keys. :param master_key: Secret key. @@ -5362,50 +6062,52 @@ class HostKeys(Model): 'system_keys': {'key': 'systemKeys', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostKeys, self).__init__(**kwargs) self.master_key = kwargs.get('master_key', None) self.function_keys = kwargs.get('function_keys', None) self.system_keys = kwargs.get('system_keys', None) -class HostName(Model): +class HostName(msrest.serialization.Model): """Details of a hostname derived from a domain. :param name: Name of the hostname. :type name: str - :param site_names: List of apps the hostname is assigned to. This list - will have more than one app only if the hostname is pointing to a Traffic - Manager. + :param site_names: List of apps the hostname is assigned to. This list will have more than one + app only if the hostname is pointing to a Traffic Manager. :type site_names: list[str] - :param azure_resource_name: Name of the Azure resource the hostname is - assigned to. If it is assigned to a Traffic Manager then it will be the - Traffic Manager name otherwise it will be the app name. + :param azure_resource_name: Name of the Azure resource the hostname is assigned to. If it is + assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the + app name. :type azure_resource_name: str - :param azure_resource_type: Type of the Azure resource the hostname is - assigned to. Possible values include: 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2018_02_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Type of the DNS record. Possible - values include: 'CName', 'A' + :param azure_resource_type: Type of the Azure resource the hostname is assigned to. Possible + values include: "Website", "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2018_02_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Type of the DNS record. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2018_02_01.models.CustomHostNameDnsRecordType - :param host_name_type: Type of the hostname. Possible values include: - 'Verified', 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2018_02_01.models.HostNameType + :param host_name_type: Type of the hostname. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2018_02_01.models.HostNameType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'site_names': {'key': 'siteNames', 'type': '[str]'}, 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'hostNameType', 'type': 'HostNameType'}, + 'azure_resource_type': {'key': 'azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'hostNameType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostName, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.site_names = kwargs.get('site_names', None) @@ -5418,8 +6120,7 @@ def __init__(self, **kwargs): class HostNameBinding(ProxyOnlyResource): """A hostname binding object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5435,25 +6136,21 @@ class HostNameBinding(ProxyOnlyResource): :type domain_id: str :param azure_resource_name: Azure resource name. :type azure_resource_name: str - :param azure_resource_type: Azure resource type. Possible values include: - 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2018_02_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Custom DNS record type. Possible - values include: 'CName', 'A' + :param azure_resource_type: Azure resource type. Possible values include: "Website", + "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2018_02_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Custom DNS record type. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2018_02_01.models.CustomHostNameDnsRecordType - :param host_name_type: Hostname type. Possible values include: 'Verified', - 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2018_02_01.models.HostNameType - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param host_name_type: Hostname type. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2018_02_01.models.HostNameType + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2018_02_01.models.SslState - :param thumbprint: SSL certificate thumbprint + :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :vartype virtual_ip: str """ @@ -5472,15 +6169,18 @@ class HostNameBinding(ProxyOnlyResource): 'site_name': {'key': 'properties.siteName', 'type': 'str'}, 'domain_id': {'key': 'properties.domainId', 'type': 'str'}, 'azure_resource_name': {'key': 'properties.azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'properties.hostNameType', 'type': 'HostNameType'}, - 'ssl_state': {'key': 'properties.sslState', 'type': 'SslState'}, + 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'properties.hostNameType', 'type': 'str'}, + 'ssl_state': {'key': 'properties.sslState', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'virtual_ip': {'key': 'properties.virtualIP', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameBinding, self).__init__(**kwargs) self.site_name = kwargs.get('site_name', None) self.domain_id = kwargs.get('domain_id', None) @@ -5493,36 +6193,70 @@ def __init__(self, **kwargs): self.virtual_ip = None -class HostNameSslState(Model): +class HostNameBindingCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.HostNameBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostNameBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostNameBindingCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2018_02_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2018_02_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.ssl_state = kwargs.get('ssl_state', None) @@ -5532,15 +6266,13 @@ def __init__(self, **kwargs): self.host_type = kwargs.get('host_type', None) -class HttpLogsConfig(Model): +class HttpLogsConfig(msrest.serialization.Model): """Http logs configuration. :param file_system: Http logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2018_02_01.models.FileSystemHttpLogsConfig + :type file_system: ~azure.mgmt.web.v2018_02_01.models.FileSystemHttpLogsConfig :param azure_blob_storage: Http logs to azure blob storage configuration. - :type azure_blob_storage: - ~azure.mgmt.web.v2018_02_01.models.AzureBlobStorageHttpLogsConfig + :type azure_blob_storage: ~azure.mgmt.web.v2018_02_01.models.AzureBlobStorageHttpLogsConfig """ _attribute_map = { @@ -5548,7 +6280,10 @@ class HttpLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageHttpLogsConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HttpLogsConfig, self).__init__(**kwargs) self.file_system = kwargs.get('file_system', None) self.azure_blob_storage = kwargs.get('azure_blob_storage', None) @@ -5557,8 +6292,7 @@ def __init__(self, **kwargs): class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5578,15 +6312,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -5611,7 +6345,10 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnection, self).__init__(**kwargs) self.service_bus_namespace = kwargs.get('service_bus_namespace', None) self.relay_name = kwargs.get('relay_name', None) @@ -5623,12 +6360,42 @@ def __init__(self, **kwargs): self.service_bus_suffix = kwargs.get('service_bus_suffix', None) +class HybridConnectionCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.HybridConnection] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HybridConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HybridConnectionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5661,18 +6428,19 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionKey, self).__init__(**kwargs) self.send_key_name = None self.send_key_value = None class HybridConnectionLimits(ProxyOnlyResource): - """Hybrid Connection limits contract. This is used to return the plan limits - of Hybrid Connections. + """Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5705,7 +6473,10 @@ class HybridConnectionLimits(ProxyOnlyResource): 'maximum': {'key': 'properties.maximum', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionLimits, self).__init__(**kwargs) self.current = None self.maximum = None @@ -5714,8 +6485,7 @@ def __init__(self, **kwargs): class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5725,8 +6495,8 @@ class Identifier(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str + :param id_properties_id: String representation of the identity. + :type id_properties_id: str """ _validation = { @@ -5740,26 +6510,57 @@ class Identifier(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) + self.id_properties_id = kwargs.get('id_properties_id', None) + + +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class InboundEnvironmentEndpoint(Model): - """The IP Addresses and Ports that require inbound network access to and - within the subnet of the App Service Environment. +class InboundEnvironmentEndpoint(msrest.serialization.Model): + """The IP Addresses and Ports that require inbound network access to and within the subnet of the App Service Environment. - :param description: Short text describing the purpose of the network - traffic. + :param description: Short text describing the purpose of the network traffic. :type description: str - :param endpoints: The IP addresses that network traffic will originate - from in cidr notation. + :param endpoints: The IP addresses that network traffic will originate from in cidr notation. :type endpoints: list[str] - :param ports: The ports that network traffic will arrive to the App - Service Environment at. + :param ports: The ports that network traffic will arrive to the App Service Environment at. :type ports: list[str] """ @@ -5769,14 +6570,49 @@ class InboundEnvironmentEndpoint(Model): 'ports': {'key': 'ports', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(InboundEnvironmentEndpoint, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.endpoints = kwargs.get('endpoints', None) self.ports = kwargs.get('ports', None) -class IpSecurityRestriction(Model): +class InboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Inbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.InboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. :param ip_address: IP address the security restriction is valid for. @@ -5784,20 +6620,18 @@ class IpSecurityRestriction(Model): CIDR notation such as ipv4/mask (leading bit match). For CIDR, SubnetMask property must not be specified. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str - :param vnet_subnet_resource_id: Virtual network resource id + :param vnet_subnet_resource_id: Virtual network resource id. :type vnet_subnet_resource_id: str - :param vnet_traffic_tag: (internal) Vnet traffic tag + :param vnet_traffic_tag: (internal) Vnet traffic tag. :type vnet_traffic_tag: int - :param subnet_traffic_tag: (internal) Subnet traffic tag + :param subnet_traffic_tag: (internal) Subnet traffic tag. :type subnet_traffic_tag: int :param action: Allow or Deny access for this IP range. :type action: str - :param tag: Defines what this IP filter will be used for. This is to - support IP filtering on proxies. Possible values include: 'Default', - 'XffProxy' + :param tag: Defines what this IP filter will be used for. This is to support IP filtering on + proxies. Possible values include: "Default", "XffProxy". :type tag: str or ~azure.mgmt.web.v2018_02_01.models.IpFilterTag :param priority: Priority of IP restriction rule. :type priority: int @@ -5814,13 +6648,16 @@ class IpSecurityRestriction(Model): 'vnet_traffic_tag': {'key': 'vnetTrafficTag', 'type': 'int'}, 'subnet_traffic_tag': {'key': 'subnetTrafficTag', 'type': 'int'}, 'action': {'key': 'action', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'IpFilterTag'}, + 'tag': {'key': 'tag', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = kwargs.get('ip_address', None) self.subnet_mask = kwargs.get('subnet_mask', None) @@ -5834,12 +6671,12 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class KeyInfo(Model): +class KeyInfo(msrest.serialization.Model): """Function key info. - :param name: Key name + :param name: Key name. :type name: str - :param value: Key value + :param value: Key value. :type value: str """ @@ -5848,13 +6685,16 @@ class KeyInfo(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -5868,13 +6708,16 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log Definition of a single resource metric. :param name: @@ -5891,33 +6734,33 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. :vartype principal_id: str - :param user_assigned_identities: The list of user assigned identities - associated with the resource. The user identity dictionary key references - will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + :param user_assigned_identities: The list of user assigned identities associated with the + resource. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. :type user_assigned_identities: dict[str, - ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + ~azure.mgmt.web.v2018_02_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -5929,10 +6772,13 @@ class ManagedServiceIdentity(Model): 'type': {'key': 'type', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.tenant_id = None @@ -5940,35 +6786,7 @@ def __init__(self, **kwargs): self.user_assigned_identities = kwargs.get('user_assigned_identities', None) -class ManagedServiceIdentityUserAssignedIdentitiesValue(Model): - """ManagedServiceIdentityUserAssignedIdentitiesValue. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar principal_id: Principal Id of user assigned identity - :vartype principal_id: str - :ivar client_id: Client Id of user assigned 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(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class MetricAvailabilily(Model): +class MetricAvailabilily(msrest.serialization.Model): """Metric availability and retention. :param time_grain: Time grain. @@ -5982,13 +6800,16 @@ class MetricAvailabilily(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricAvailabilily, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.retention = kwargs.get('retention', None) -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -6002,7 +6823,10 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.blob_duration = kwargs.get('blob_duration', None) @@ -6011,8 +6835,7 @@ def __init__(self, **kwargs): class MetricDefinition(ProxyOnlyResource): """Metadata for a metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6026,10 +6849,9 @@ class MetricDefinition(ProxyOnlyResource): :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2018_02_01.models.MetricAvailabilily] + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. + :vartype metric_availabilities: list[~azure.mgmt.web.v2018_02_01.models.MetricAvailabilily] :ivar display_name: Friendly name shown in the UI. :vartype display_name: str """ @@ -6055,7 +6877,10 @@ class MetricDefinition(ProxyOnlyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDefinition, self).__init__(**kwargs) self.unit = None self.primary_aggregation_type = None @@ -6063,7 +6888,7 @@ def __init__(self, **kwargs): self.display_name = None -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -6095,8 +6920,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2018_02_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2018_02_01.models.MetricAvailability] """ _attribute_map = { @@ -6117,7 +6941,10 @@ class MetricSpecification(Model): 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -6139,10 +6966,7 @@ def __init__(self, **kwargs): class MigrateMySqlRequest(ProxyOnlyResource): """MySQL migration request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6152,21 +6976,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param connection_string: Required. Connection string to the remote MySQL - database. + :param connection_string: Connection string to the remote MySQL database. :type connection_string: str - :param migration_type: Required. The type of migration operation to be - done. Possible values include: 'LocalToRemote', 'RemoteToLocal' - :type migration_type: str or - ~azure.mgmt.web.v2018_02_01.models.MySqlMigrationType + :param migration_type: The type of migration operation to be done. Possible values include: + "LocalToRemote", "RemoteToLocal". + :type migration_type: str or ~azure.mgmt.web.v2018_02_01.models.MySqlMigrationType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'connection_string': {'required': True}, - 'migration_type': {'required': True}, } _attribute_map = { @@ -6175,10 +6995,13 @@ class MigrateMySqlRequest(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'migration_type': {'key': 'properties.migrationType', 'type': 'MySqlMigrationType'}, + 'migration_type': {'key': 'properties.migrationType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MigrateMySqlRequest, self).__init__(**kwargs) self.connection_string = kwargs.get('connection_string', None) self.migration_type = kwargs.get('migration_type', None) @@ -6187,8 +7010,7 @@ def __init__(self, **kwargs): class MigrateMySqlStatus(ProxyOnlyResource): """MySQL migration status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6198,13 +7020,12 @@ class MigrateMySqlStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar migration_operation_status: Status of the migration task. Possible - values include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' - :vartype migration_operation_status: str or - ~azure.mgmt.web.v2018_02_01.models.OperationStatus + :ivar migration_operation_status: Status of the migration task. Possible values include: + "InProgress", "Failed", "Succeeded", "TimedOut", "Created". + :vartype migration_operation_status: str or ~azure.mgmt.web.v2018_02_01.models.OperationStatus :ivar operation_id: Operation ID for the migration task. :vartype operation_id: str - :ivar local_my_sql_enabled: True if the web app has in app MySql enabled + :ivar local_my_sql_enabled: True if the web app has in app MySql enabled. :vartype local_my_sql_enabled: bool """ @@ -6222,12 +7043,15 @@ class MigrateMySqlStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'OperationStatus'}, + 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'str'}, 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, 'local_my_sql_enabled': {'key': 'properties.localMySqlEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MigrateMySqlStatus, self).__init__(**kwargs) self.migration_operation_status = None self.operation_id = None @@ -6237,8 +7061,7 @@ def __init__(self, **kwargs): class MSDeploy(ProxyOnlyResource): """MSDeploy ARM PUT information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6248,29 +7071,24 @@ class MSDeploy(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param package_uri: Package URI + :param package_uri: Package URI. :type package_uri: str - :param connection_string: SQL Connection String + :param connection_string: SQL Connection String. :type connection_string: str - :param db_type: Database Type + :param db_type: Database Type. :type db_type: str - :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must - not be set if SetParameters is used. + :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must not be set if + SetParameters is used. :type set_parameters_xml_file_uri: str - :param set_parameters: MSDeploy Parameters. Must not be set if - SetParametersXmlFileUri is used. + :param set_parameters: MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. :type set_parameters: dict[str, str] - :param skip_app_data: Controls whether the MSDeploy operation skips the - App_Data directory. - If set to true, the existing App_Data directory on the - destination - will not be deleted, and any App_Data directory in the source will be - ignored. - Setting is false by default. + :param skip_app_data: Controls whether the MSDeploy operation skips the App_Data directory. + If set to :code:`true`, the existing App_Data directory on the destination + will not be deleted, and any App_Data directory in the source will be ignored. + Setting is :code:`false` by default. :type skip_app_data: bool - :param app_offline: Sets the AppOffline rule while the MSDeploy operation - executes. - Setting is false by default. + :param app_offline: Sets the AppOffline rule while the MSDeploy operation executes. + Setting is :code:`false` by default. :type app_offline: bool """ @@ -6294,7 +7112,10 @@ class MSDeploy(ProxyOnlyResource): 'app_offline': {'key': 'properties.appOffline', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeploy, self).__init__(**kwargs) self.package_uri = kwargs.get('package_uri', None) self.connection_string = kwargs.get('connection_string', None) @@ -6308,8 +7129,7 @@ def __init__(self, **kwargs): class MSDeployLog(ProxyOnlyResource): """MSDeploy log. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6319,9 +7139,8 @@ class MSDeployLog(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar entries: List of log entry messages - :vartype entries: - list[~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntry] + :ivar entries: List of log entry messages. + :vartype entries: list[~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntry] """ _validation = { @@ -6339,24 +7158,24 @@ class MSDeployLog(ProxyOnlyResource): 'entries': {'key': 'properties.entries', 'type': '[MSDeployLogEntry]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployLog, self).__init__(**kwargs) self.entries = None -class MSDeployLogEntry(Model): +class MSDeployLogEntry(msrest.serialization.Model): """MSDeploy log entry. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar time: Timestamp of log entry - :vartype time: datetime - :ivar type: Log entry type. Possible values include: 'Message', 'Warning', - 'Error' - :vartype type: str or - ~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntryType - :ivar message: Log entry message + :ivar time: Timestamp of log entry. + :vartype time: ~datetime.datetime + :ivar type: Log entry type. Possible values include: "Message", "Warning", "Error". + :vartype type: str or ~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntryType + :ivar message: Log entry message. :vartype message: str """ @@ -6368,11 +7187,14 @@ class MSDeployLogEntry(Model): _attribute_map = { 'time': {'key': 'time', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'MSDeployLogEntryType'}, + 'type': {'key': 'type', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployLogEntry, self).__init__(**kwargs) self.time = None self.type = None @@ -6382,8 +7204,7 @@ def __init__(self, **kwargs): class MSDeployStatus(ProxyOnlyResource): """MSDeploy ARM response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6393,17 +7214,17 @@ class MSDeployStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deployer: Username of deployer + :ivar deployer: Username of deployer. :vartype deployer: str - :ivar provisioning_state: Provisioning state. Possible values include: - 'accepted', 'running', 'succeeded', 'failed', 'canceled' + :ivar provisioning_state: Provisioning state. Possible values include: "accepted", "running", + "succeeded", "failed", "canceled". :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.MSDeployProvisioningState - :ivar start_time: Start time of deploy operation - :vartype start_time: datetime - :ivar end_time: End time of deploy operation - :vartype end_time: datetime - :ivar complete: Whether the deployment operation has completed + :ivar start_time: Start time of deploy operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of deploy operation. + :vartype end_time: ~datetime.datetime + :ivar complete: Whether the deployment operation has completed. :vartype complete: bool """ @@ -6424,13 +7245,16 @@ class MSDeployStatus(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'deployer': {'key': 'properties.deployer', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'MSDeployProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'complete': {'key': 'properties.complete', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployStatus, self).__init__(**kwargs) self.deployer = None self.provisioning_state = None @@ -6439,7 +7263,7 @@ def __init__(self, **kwargs): self.complete = None -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -6450,12 +7274,47 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class NameValuePair(Model): +class NameIdentifierCollection(msrest.serialization.Model): + """Collection of domain name identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.NameIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NameIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameIdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -6469,18 +7328,20 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2018_02_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2018_02_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -6490,13 +7351,16 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = kwargs.get('action', None) self.description = kwargs.get('description', None) @@ -6505,11 +7369,9 @@ def __init__(self, **kwargs): class NetworkFeatures(ProxyOnlyResource): - """Full view of network features for an app (presently VNET integration and - Hybrid Connections). + """Full view of network features for an app (presently VNET integration and Hybrid Connections). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6522,14 +7384,12 @@ class NetworkFeatures(ProxyOnlyResource): :ivar virtual_network_name: The Virtual Network name. :vartype virtual_network_name: str :ivar virtual_network_connection: The Virtual Network summary view. - :vartype virtual_network_connection: - ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :vartype virtual_network_connection: ~azure.mgmt.web.v2018_02_01.models.VnetInfo :ivar hybrid_connections: The Hybrid Connections summary view. :vartype hybrid_connections: list[~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity] :ivar hybrid_connections_v2: The Hybrid Connection V2 (Service Bus) view. - :vartype hybrid_connections_v2: - list[~azure.mgmt.web.v2018_02_01.models.HybridConnection] + :vartype hybrid_connections_v2: list[~azure.mgmt.web.v2018_02_01.models.HybridConnection] """ _validation = { @@ -6553,7 +7413,10 @@ class NetworkFeatures(ProxyOnlyResource): 'hybrid_connections_v2': {'key': 'properties.hybridConnectionsV2', 'type': '[HybridConnection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkFeatures, self).__init__(**kwargs) self.virtual_network_name = None self.virtual_network_connection = None @@ -6561,16 +7424,16 @@ def __init__(self, **kwargs): self.hybrid_connections_v2 = None -class NetworkTrace(Model): +class NetworkTrace(msrest.serialization.Model): """Network trace. :param path: Local file path for the captured network trace file. :type path: str - :param status: Current status of the network trace operation, same as - Operation.Status (InProgress/Succeeded/Failed). + :param status: Current status of the network trace operation, same as Operation.Status + (InProgress/Succeeded/Failed). :type status: str - :param message: Detailed message of a network trace operation, e.g. error - message in case of failure. + :param message: Detailed message of a network trace operation, e.g. error message in case of + failure. :type message: str """ @@ -6580,31 +7443,34 @@ class NetworkTrace(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkTrace, self).__init__(**kwargs) self.path = kwargs.get('path', None) self.status = kwargs.get('status', None) self.message = kwargs.get('message', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2018_02_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2018_02_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -6612,7 +7478,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -6620,7 +7486,10 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -6632,18 +7501,14 @@ def __init__(self, **kwargs): self.geo_master_operation_id = kwargs.get('geo_master_operation_id', None) -class OutboundEnvironmentEndpoint(Model): - """Endpoints accessed for a common purpose that the App Service Environment - requires outbound network access to. +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the App Service Environment requires outbound network access to. - :param category: The type of service accessed by the App Service - Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active - Directory. + :param category: The type of service accessed by the App Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. :type category: str - :param endpoints: The endpoints that the App Service Environment reaches - the service at. - :type endpoints: - list[~azure.mgmt.web.v2018_02_01.models.EndpointDependency] + :param endpoints: The endpoints that the App Service Environment reaches the service at. + :type endpoints: list[~azure.mgmt.web.v2018_02_01.models.EndpointDependency] """ _attribute_map = { @@ -6651,13 +7516,80 @@ class OutboundEnvironmentEndpoint(Model): 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) self.category = kwargs.get('category', None) self.endpoints = kwargs.get('endpoints', None) -class PerfMonResponse(Model): +class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PerfMonCounterCollection(msrest.serialization.Model): + """Collection of performance monitor counters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.PerfMonResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PerfMonResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PerfMonCounterCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PerfMonResponse(msrest.serialization.Model): """Performance monitor API response. :param code: The response code. @@ -6674,18 +7606,21 @@ class PerfMonResponse(Model): 'data': {'key': 'data', 'type': 'PerfMonSet'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) self.data = kwargs.get('data', None) -class PerfMonSample(Model): +class PerfMonSample(msrest.serialization.Model): """Performance monitor sample in a set. :param time: Point in time for which counter was measured. - :type time: datetime + :type time: ~datetime.datetime :param instance_name: Name of the server on which the measurement is made. :type instance_name: str :param value: Value of counter at a certain time. @@ -6698,22 +7633,25 @@ class PerfMonSample(Model): 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonSample, self).__init__(**kwargs) self.time = kwargs.get('time', None) self.instance_name = kwargs.get('instance_name', None) self.value = kwargs.get('value', None) -class PerfMonSet(Model): +class PerfMonSet(msrest.serialization.Model): """Metric information. :param name: Unique key name of the counter. :type name: str :param start_time: Start time of the period. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time of the period. - :type end_time: datetime + :type end_time: ~datetime.datetime :param time_grain: Presented time grain. :type time_grain: str :param values: Collection of workers that are active during this time. @@ -6728,7 +7666,10 @@ class PerfMonSet(Model): 'values': {'key': 'values', 'type': '[PerfMonSample]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.start_time = kwargs.get('start_time', None) @@ -6740,8 +7681,7 @@ def __init__(self, **kwargs): class PremierAddOn(Resource): """Premier add-on. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -6755,7 +7695,7 @@ class PremierAddOn(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Premier add on SKU. :type sku: str @@ -6790,7 +7730,10 @@ class PremierAddOn(Resource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOn, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) @@ -6802,8 +7745,7 @@ def __init__(self, **kwargs): class PremierAddOnOffer(ProxyOnlyResource): """Premier add-on offer. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6819,14 +7761,13 @@ class PremierAddOnOffer(ProxyOnlyResource): :type product: str :param vendor: Premier add on offer Vendor. :type vendor: str - :param promo_code_required: true if promotion code is - required; otherwise, false. + :param promo_code_required: :code:`true` if promotion code is required; otherwise, + :code:`false`. :type promo_code_required: bool :param quota: Premier add on offer Quota. :type quota: int - :param web_hosting_plan_restrictions: App Service plans this offer is - restricted to. Possible values include: 'None', 'Free', 'Shared', 'Basic', - 'Standard', 'Premium' + :param web_hosting_plan_restrictions: App Service plans this offer is restricted to. Possible + values include: "None", "Free", "Shared", "Basic", "Standard", "Premium". :type web_hosting_plan_restrictions: str or ~azure.mgmt.web.v2018_02_01.models.AppServicePlanRestrictions :param privacy_policy_url: Privacy policy URL. @@ -6855,14 +7796,17 @@ class PremierAddOnOffer(ProxyOnlyResource): 'vendor': {'key': 'properties.vendor', 'type': 'str'}, 'promo_code_required': {'key': 'properties.promoCodeRequired', 'type': 'bool'}, 'quota': {'key': 'properties.quota', 'type': 'int'}, - 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'AppServicePlanRestrictions'}, + 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'str'}, 'privacy_policy_url': {'key': 'properties.privacyPolicyUrl', 'type': 'str'}, 'legal_terms_url': {'key': 'properties.legalTermsUrl', 'type': 'str'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOnOffer, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) @@ -6876,16 +7820,47 @@ def __init__(self, **kwargs): self.marketplace_offer = kwargs.get('marketplace_offer', None) -class PremierAddOnPatchResource(ProxyOnlyResource): - """ARM resource for a PremierAddOn. +class PremierAddOnOfferCollection(msrest.serialization.Model): + """Collection of premier add-on offers. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOffer] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremierAddOnOffer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremierAddOnOfferCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PremierAddOnPatchResource(ProxyOnlyResource): + """ARM resource for a PremierAddOn. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str :param kind: Kind of resource. :type kind: str :ivar type: Resource type. @@ -6920,7 +7895,10 @@ class PremierAddOnPatchResource(ProxyOnlyResource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOnPatchResource, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) @@ -6932,8 +7910,7 @@ def __init__(self, **kwargs): class PrivateAccess(ProxyOnlyResource): """Description of the parameters of Private Access for a Web Site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6945,10 +7922,9 @@ class PrivateAccess(ProxyOnlyResource): :vartype type: str :param enabled: Whether private access is enabled or not. :type enabled: bool - :param virtual_networks: The Virtual Networks (and subnets) allowed to - access the site privately. - :type virtual_networks: - list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessVirtualNetwork] + :param virtual_networks: The Virtual Networks (and subnets) allowed to access the site + privately. + :type virtual_networks: list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessVirtualNetwork] """ _validation = { @@ -6966,15 +7942,17 @@ class PrivateAccess(ProxyOnlyResource): 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[PrivateAccessVirtualNetwork]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateAccess, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.virtual_networks = kwargs.get('virtual_networks', None) -class PrivateAccessSubnet(Model): - """Description of a Virtual Network subnet that is useable for private site - access. +class PrivateAccessSubnet(msrest.serialization.Model): + """Description of a Virtual Network subnet that is useable for private site access. :param name: The name of the subnet. :type name: str @@ -6987,26 +7965,28 @@ class PrivateAccessSubnet(Model): 'key': {'key': 'key', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateAccessSubnet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.key = kwargs.get('key', None) -class PrivateAccessVirtualNetwork(Model): +class PrivateAccessVirtualNetwork(msrest.serialization.Model): """Description of a Virtual Network that is useable for private site access. :param name: The name of the Virtual Network. :type name: str :param key: The key (ID) of the Virtual Network. :type key: int - :param resource_id: The ARM uri of the Virtual Network + :param resource_id: The ARM uri of the Virtual Network. :type resource_id: str - :param subnets: A List of subnets that access is allowed to on this - Virtual Network. An empty array (but not null) is interpreted to mean that - all subnets are allowed within this Virtual Network. - :type subnets: - list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessSubnet] + :param subnets: A List of subnets that access is allowed to on this Virtual Network. An empty + array (but not null) is interpreted to mean that all subnets are allowed within this Virtual + Network. + :type subnets: list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessSubnet] """ _attribute_map = { @@ -7016,7 +7996,10 @@ class PrivateAccessVirtualNetwork(Model): 'subnets': {'key': 'subnets', 'type': '[PrivateAccessSubnet]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateAccessVirtualNetwork, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.key = kwargs.get('key', None) @@ -7027,8 +8010,7 @@ def __init__(self, **kwargs): class ProcessInfo(ProxyOnlyResource): """Process Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7046,9 +8028,9 @@ class ProcessInfo(ProxyOnlyResource): :type href: str :param minidump: Minidump URI. :type minidump: str - :param is_profile_running: Is profile running? + :param is_profile_running: Is profile running?. :type is_profile_running: bool - :param is_iis_profile_running: Is the IIS Profile running? + :param is_iis_profile_running: Is the IIS Profile running?. :type is_iis_profile_running: bool :param iis_profile_timeout_in_seconds: IIS Profile timeout (seconds). :type iis_profile_timeout_in_seconds: float @@ -7075,7 +8057,7 @@ class ProcessInfo(ProxyOnlyResource): :param thread_count: Thread count. :type thread_count: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_cpu_time: Total CPU time. :type total_cpu_time: str :param user_cpu_time: User CPU time. @@ -7101,12 +8083,12 @@ class ProcessInfo(ProxyOnlyResource): :param peak_paged_memory: Peak paged memory. :type peak_paged_memory: long :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime :param environment_variables: List of environment variables. :type environment_variables: dict[str, str] - :param is_scm_site: Is this the SCM site? + :param is_scm_site: Is this the SCM site?. :type is_scm_site: bool - :param is_webjob: Is this a Web Job? + :param is_webjob: Is this a Web Job?. :type is_webjob: bool :param description: Description of process. :type description: str @@ -7162,7 +8144,10 @@ class ProcessInfo(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessInfo, self).__init__(**kwargs) self.identifier = None self.deployment_name = kwargs.get('deployment_name', None) @@ -7202,11 +8187,42 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class ProcessInfoCollection(msrest.serialization.Model): + """Collection of Kudu process information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ProcessInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ProcessModuleInfo(ProxyOnlyResource): """Process Module Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7216,8 +8232,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param base_address: Base address. Used as module identifier in ARM - resource URI. + :param base_address: Base address. Used as module identifier in ARM resource URI. :type base_address: str :param file_name: File name. :type file_name: str @@ -7235,7 +8250,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type product: str :param product_version: Product version. :type product_version: str - :param is_debug: Is debug? + :param is_debug: Is debug?. :type is_debug: bool :param language: Module language (locale). :type language: str @@ -7265,7 +8280,10 @@ class ProcessModuleInfo(ProxyOnlyResource): 'language': {'key': 'properties.language', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessModuleInfo, self).__init__(**kwargs) self.base_address = kwargs.get('base_address', None) self.file_name = kwargs.get('file_name', None) @@ -7280,11 +8298,42 @@ def __init__(self, **kwargs): self.language = kwargs.get('language', None) +class ProcessModuleInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessModuleInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessModuleInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ProcessThreadInfo(ProxyOnlyResource): """Process Thread Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7309,7 +8358,7 @@ class ProcessThreadInfo(ProxyOnlyResource): :param base_priority: Base priority. :type base_priority: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total processor time. :type total_processor_time: str :param user_processor_time: User processor time. @@ -7349,7 +8398,10 @@ class ProcessThreadInfo(ProxyOnlyResource): 'wait_reason': {'key': 'properties.wait_reason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessThreadInfo, self).__init__(**kwargs) self.identifier = None self.href = kwargs.get('href', None) @@ -7366,11 +8418,42 @@ def __init__(self, **kwargs): self.wait_reason = kwargs.get('wait_reason', None) +class ProcessThreadInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessThreadInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessThreadInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class PublicCertificate(ProxyOnlyResource): """Public certificate object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7380,13 +8463,13 @@ class PublicCertificate(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param blob: Public Certificate byte array + :param blob: Public Certificate byte array. :type blob: bytearray - :param public_certificate_location: Public Certificate Location. Possible - values include: 'CurrentUserMy', 'LocalMachineMy', 'Unknown' + :param public_certificate_location: Public Certificate Location. Possible values include: + "CurrentUserMy", "LocalMachineMy", "Unknown". :type public_certificate_location: str or ~azure.mgmt.web.v2018_02_01.models.PublicCertificateLocation - :ivar thumbprint: Certificate Thumbprint + :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str """ @@ -7403,25 +8486,57 @@ class PublicCertificate(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, - 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'PublicCertificateLocation'}, + 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PublicCertificate, self).__init__(**kwargs) self.blob = kwargs.get('blob', None) self.public_certificate_location = kwargs.get('public_certificate_location', None) self.thumbprint = None -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PublicCertificateCollection(msrest.serialization.Model): + """Collection of public certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.PublicCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublicCertificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublicCertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -7430,22 +8545,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -7453,7 +8565,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -7467,7 +8578,10 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PushSettings, self).__init__(**kwargs) self.is_push_enabled = kwargs.get('is_push_enabled', None) self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) @@ -7475,40 +8589,38 @@ def __init__(self, **kwargs): self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -7523,7 +8635,10 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = kwargs.get('action_host_name', None) self.reroute_percentage = kwargs.get('reroute_percentage', None) @@ -7538,8 +8653,7 @@ def __init__(self, **kwargs): class Recommendation(ProxyOnlyResource): """Represents a recommendation result generated by the recommendation engine. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7550,68 +8664,58 @@ class Recommendation(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param creation_time: Timestamp when this instance was created. - :type creation_time: datetime - :param recommendation_id: A GUID value that each recommendation object is - associated with. + :type creation_time: ~datetime.datetime + :param recommendation_id: A GUID value that each recommendation object is associated with. :type recommendation_id: str - :param resource_id: Full ARM resource ID string that this recommendation - object is associated with. + :param resource_id: Full ARM resource ID string that this recommendation object is associated + with. :type resource_id: str - :param resource_scope: Name of a resource type this recommendation - applies, e.g. Subscription, ServerFarm, Site. Possible values include: - 'ServerFarm', 'Subscription', 'WebSite' - :type resource_scope: str or - ~azure.mgmt.web.v2018_02_01.models.ResourceScopeType + :param resource_scope: Name of a resource type this recommendation applies, e.g. Subscription, + ServerFarm, Site. Possible values include: "ServerFarm", "Subscription", "WebSite". + :type resource_scope: str or ~azure.mgmt.web.v2018_02_01.models.ResourceScopeType :param rule_name: Unique name of the rule. :type rule_name: str :param display_name: UI friendly name of the rule (may not be unique). :type display_name: str :param message: Recommendation text. :type message: str - :param level: Level indicating how critical this recommendation can - impact. Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level indicating how critical this recommendation can impact. Possible values + include: "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2018_02_01.models.NotificationLevel - :param channels: List of channels that this recommendation can apply. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of channels that this recommendation can apply. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2018_02_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - belongs to. + :ivar category_tags: The list of category tags that this recommendation belongs to. :vartype category_tags: list[str] :param action_name: Name of action recommended by this object. :type action_name: str - :param enabled: True if this recommendation is still valid (i.e. - "actionable"). False if it is invalid. + :param enabled: True if this recommendation is still valid (i.e. "actionable"). False if it is + invalid. :type enabled: int - :param states: The list of states of this recommendation. If it's null - then it should be considered "Active". + :param states: The list of states of this recommendation. If it's null then it should be + considered "Active". :type states: list[str] - :param start_time: The beginning time in UTC of a range that the - recommendation refers to. - :type start_time: datetime - :param end_time: The end time in UTC of a range that the recommendation - refers to. - :type end_time: datetime - :param next_notification_time: When to notify this recommendation next in - UTC. Null means that this will never be notified anymore. - :type next_notification_time: datetime - :param notification_expiration_time: Date and time in UTC when this - notification expires. - :type notification_expiration_time: datetime - :param notified_time: Last timestamp in UTC this instance was actually - notified. Null means that this recommendation hasn't been notified yet. - :type notified_time: datetime + :param start_time: The beginning time in UTC of a range that the recommendation refers to. + :type start_time: ~datetime.datetime + :param end_time: The end time in UTC of a range that the recommendation refers to. + :type end_time: ~datetime.datetime + :param next_notification_time: When to notify this recommendation next in UTC. Null means that + this will never be notified anymore. + :type next_notification_time: ~datetime.datetime + :param notification_expiration_time: Date and time in UTC when this notification expires. + :type notification_expiration_time: ~datetime.datetime + :param notified_time: Last timestamp in UTC this instance was actually notified. Null means + that this recommendation hasn't been notified yet. + :type notified_time: ~datetime.datetime :param score: A metric value measured by the rule. :type score: float - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool :param extension_name: Extension name of the portal if exists. :type extension_name: str :param blade_name: Deep link to a blade on the portal. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. + :param forward_link: Forward link to an external document associated with the rule. :type forward_link: str """ @@ -7634,8 +8738,8 @@ class Recommendation(ProxyOnlyResource): 'rule_name': {'key': 'properties.ruleName', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'int'}, @@ -7652,7 +8756,10 @@ class Recommendation(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Recommendation, self).__init__(**kwargs) self.creation_time = kwargs.get('creation_time', None) self.recommendation_id = kwargs.get('recommendation_id', None) @@ -7679,12 +8786,42 @@ def __init__(self, **kwargs): self.forward_link = kwargs.get('forward_link', None) +class RecommendationCollection(msrest.serialization.Model): + """Collection of recommendations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Recommendation] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Recommendation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RecommendationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class RecommendationRule(ProxyOnlyResource): - """Represents a recommendation rule that the recommendation engine can - perform. + """Represents a recommendation rule that the recommendation engine can perform. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7700,36 +8837,30 @@ class RecommendationRule(ProxyOnlyResource): :type display_name: str :param message: Localized name of the rule (Good for UI). :type message: str - :param recommendation_id: Recommendation ID of an associated - recommendation object tied to the rule, if exists. + :param recommendation_id: Recommendation ID of an associated recommendation object tied to the + rule, if exists. If such an object doesn't exist, it is set to null. :type recommendation_id: str :param description: Localized detailed description of the rule. :type description: str - :param action_name: Name of action that is recommended by this rule in - string. + :param action_name: Name of action that is recommended by this rule in string. :type action_name: str - :param level: Level of impact indicating how critical this rule is. - Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level of impact indicating how critical this rule is. Possible values include: + "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2018_02_01.models.NotificationLevel - :param channels: List of available channels that this rule applies. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of available channels that this rule applies. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2018_02_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - rule belongs to. + :ivar category_tags: The list of category tags that this recommendation rule belongs to. :vartype category_tags: list[str] - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool - :param extension_name: Extension name of the portal if exists. Applicable - to dynamic rule only. + :param extension_name: Extension name of the portal if exists. Applicable to dynamic rule only. :type extension_name: str - :param blade_name: Deep link to a blade on the portal. Applicable to - dynamic rule only. + :param blade_name: Deep link to a blade on the portal. Applicable to dynamic rule only. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. Applicable to dynamic rule only. + :param forward_link: Forward link to an external document associated with the rule. Applicable + to dynamic rule only. :type forward_link: str """ @@ -7751,8 +8882,8 @@ class RecommendationRule(ProxyOnlyResource): 'recommendation_id': {'key': 'properties.recommendationId', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, 'extension_name': {'key': 'properties.extensionName', 'type': 'str'}, @@ -7760,7 +8891,10 @@ class RecommendationRule(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RecommendationRule, self).__init__(**kwargs) self.recommendation_name = kwargs.get('recommendation_name', None) self.display_name = kwargs.get('display_name', None) @@ -7780,8 +8914,7 @@ def __init__(self, **kwargs): class ReissueCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate reissue request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7793,13 +8926,13 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): :vartype type: str :param key_size: Certificate Key Size. :type key_size: int - :param delay_existing_revoke_in_hours: Delay in hours to revoke existing - certificate after the new certificate is issued. + :param delay_existing_revoke_in_hours: Delay in hours to revoke existing certificate after the + new certificate is issued. :type delay_existing_revoke_in_hours: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -7820,7 +8953,10 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ReissueCertificateOrderRequest, self).__init__(**kwargs) self.key_size = kwargs.get('key_size', None) self.delay_existing_revoke_in_hours = kwargs.get('delay_existing_revoke_in_hours', None) @@ -7831,8 +8967,7 @@ def __init__(self, **kwargs): class RelayServiceConnectionEntity(ProxyOnlyResource): """Hybrid Connection for an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7878,7 +9013,10 @@ class RelayServiceConnectionEntity(ProxyOnlyResource): 'biztalk_uri': {'key': 'properties.biztalkUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RelayServiceConnectionEntity, self).__init__(**kwargs) self.entity_name = kwargs.get('entity_name', None) self.entity_connection_string = kwargs.get('entity_connection_string', None) @@ -7889,26 +9027,28 @@ def __init__(self, **kwargs): self.biztalk_uri = kwargs.get('biztalk_uri', None) -class Rendering(Model): +class Rendering(msrest.serialization.Model): """Instructions for rendering the data. - :param type: Rendering Type. Possible values include: 'NoGraph', 'Table', - 'TimeSeries', 'TimeSeriesPerInstance' + :param type: Rendering Type. Possible values include: "NoGraph", "Table", "TimeSeries", + "TimeSeriesPerInstance". :type type: str or ~azure.mgmt.web.v2018_02_01.models.RenderingType - :param title: Title of data + :param title: Title of data. :type title: str - :param description: Description of the data that will help it be - interpreted + :param description: Description of the data that will help it be interpreted. :type description: str """ _attribute_map = { - 'type': {'key': 'type', 'type': 'RenderingType'}, + 'type': {'key': 'type', 'type': 'str'}, 'title': {'key': 'title', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Rendering, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.title = kwargs.get('title', None) @@ -7918,8 +9058,7 @@ def __init__(self, **kwargs): class RenewCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate renew request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7933,8 +9072,8 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): :type key_size: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -7954,14 +9093,17 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RenewCertificateOrderRequest, self).__init__(**kwargs) self.key_size = kwargs.get('key_size', None) self.csr = kwargs.get('csr', None) self.is_private_key_external = kwargs.get('is_private_key_external', None) -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -7975,17 +9117,51 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = kwargs.get('count', None) self.time_interval = kwargs.get('time_interval', None) +class ResourceCollection(msrest.serialization.Model): + """Collection of resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[str] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ResourceHealthMetadata(ProxyOnlyResource): """Used for getting ResourceHealthCheck settings. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7995,10 +9171,9 @@ class ResourceHealthMetadata(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param category: The category that the resource matches in the RHC Policy - File + :param category: The category that the resource matches in the RHC Policy File. :type category: str - :param signal_availability: Is there a health signal for the resource + :param signal_availability: Is there a health signal for the resource. :type signal_availability: bool """ @@ -8017,38 +9192,70 @@ class ResourceHealthMetadata(ProxyOnlyResource): 'signal_availability': {'key': 'properties.signalAvailability', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceHealthMetadata, self).__init__(**kwargs) self.category = kwargs.get('category', None) self.signal_availability = kwargs.get('signal_availability', None) -class ResourceMetric(Model): +class ResourceHealthMetadataCollection(msrest.serialization.Model): + """Collection of resource health metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceHealthMetadata]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceHealthMetadataCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2018_02_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] """ _validation = { @@ -8075,7 +9282,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -8088,11 +9298,10 @@ def __init__(self, **kwargs): self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -8110,17 +9319,51 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None +class ResourceMetricCollection(msrest.serialization.Model): + """Collection of metric responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetric]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8134,8 +9377,8 @@ class ResourceMetricDefinition(ProxyOnlyResource): :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. @@ -8167,7 +9410,10 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(**kwargs) self.unit = None self.primary_aggregation_type = None @@ -8176,11 +9422,42 @@ def __init__(self, **kwargs): self.properties = None -class ResourceMetricName(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -8198,13 +9475,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -8218,17 +9498,19 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.value = kwargs.get('value', None) -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -8243,8 +9525,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] """ _validation = { @@ -8267,7 +9548,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -8278,24 +9562,21 @@ def __init__(self, **kwargs): self.properties = None -class ResourceNameAvailability(Model): +class ResourceNameAvailability(msrest.serialization.Model): """Information regarding availability of a resource name. - :param name_available: true indicates name is valid and - available. false indicates the name is invalid, unavailable, - or both. + :param name_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. :type name_available: bool - :param reason: Invalid indicates the name provided does not - match Azure App Service naming requirements. AlreadyExists - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.web.v2018_02_01.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why - the given name is invalid, and provide the resource naming requirements so - that the user can select a valid name. If reason == AlreadyExists, explain - that resource name is already in use, and direct them to select a - different name. + :param reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.web.v2018_02_01.models.InAvailabilityReasonType + :param message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. :type message: str """ @@ -8305,26 +9586,28 @@ class ResourceNameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceNameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class ResourceNameAvailabilityRequest(Model): +class ResourceNameAvailabilityRequest(msrest.serialization.Model): """Resource name availability request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes + :param type: Required. Resource type used for verification. Possible values include: "Site", + "Slot", "HostingEnvironment", "PublishingUser", "Microsoft.Web/sites", + "Microsoft.Web/sites/slots", "Microsoft.Web/hostingEnvironments", + "Microsoft.Web/publishingUsers". + :type type: str or ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool """ @@ -8340,17 +9623,20 @@ class ResourceNameAvailabilityRequest(Model): 'is_fqdn': {'key': 'isFqdn', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) + self.name = kwargs['name'] + self.type = kwargs['type'] self.is_fqdn = kwargs.get('is_fqdn', None) -class ResponseMetaData(Model): +class ResponseMetaData(msrest.serialization.Model): """ResponseMetaData. - :param data_source: Source of the Data + :param data_source: Source of the Data. :type data_source: ~azure.mgmt.web.v2018_02_01.models.DataSource """ @@ -8358,7 +9644,10 @@ class ResponseMetaData(Model): 'data_source': {'key': 'dataSource', 'type': 'DataSource'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResponseMetaData, self).__init__(**kwargs) self.data_source = kwargs.get('data_source', None) @@ -8366,10 +9655,7 @@ def __init__(self, **kwargs): class RestoreRequest(ProxyOnlyResource): """Description of a restore request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8379,42 +9665,37 @@ class RestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str :param blob_name: Name of a blob which contains the backup. :type blob_name: str - :param overwrite: Required. true if the restore operation can - overwrite target app; otherwise, false. true is - needed if trying to restore over an existing app. + :param overwrite: :code:`true` if the restore operation can overwrite target app; + otherwise, :code:`false`. :code:`true` is needed if trying to restore + over an existing app. :type overwrite: bool :param site_name: Name of an app. :type site_name: str - :param databases: Collection of databases which should be restored. This - list has to match the list of databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] - :param ignore_conflicting_host_names: Changes a logic when restoring an - app with custom domains. true to remove custom domains - automatically. If false, custom domains are added to - the app's object when it is being restored, but that might fail due to - conflicts during the operation. Default value: False . + :param databases: Collection of databases which should be restored. This list has to match the + list of databases included in the backup. + :type databases: list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] + :param ignore_conflicting_host_names: Changes a logic when restoring an app with custom + domains. :code:`true` to remove custom domains automatically. If + :code:`false`, custom domains are added to + the app's object when it is being restored, but that might fail due to conflicts during the + operation. :type ignore_conflicting_host_names: bool - :param ignore_databases: Ignore the databases and only restore the site - content. Default value: False . + :param ignore_databases: Ignore the databases and only restore the site content. :type ignore_databases: bool - :param app_service_plan: Specify app service plan that will own restored - site. + :param app_service_plan: Specify app service plan that will own restored site. :type app_service_plan: str - :param operation_type: Operation type. Possible values include: 'Default', - 'Clone', 'Relocation', 'Snapshot', 'CloudFS'. Default value: "Default" . - :type operation_type: str or - ~azure.mgmt.web.v2018_02_01.models.BackupRestoreOperationType - :param adjust_connection_strings: true if - SiteConfig.ConnectionStrings should be set in new app; otherwise, - false. + :param operation_type: Operation type. Possible values include: "Default", "Clone", + "Relocation", "Snapshot", "CloudFS". Default value: "Default". + :type operation_type: str or ~azure.mgmt.web.v2018_02_01.models.BackupRestoreOperationType + :param adjust_connection_strings: :code:`true` if SiteConfig.ConnectionStrings + should be set in new app; otherwise, :code:`false`. :type adjust_connection_strings: bool - :param hosting_environment: App Service Environment name, if needed (only - when restoring an app to an App Service Environment). + :param hosting_environment: App Service Environment name, if needed (only when restoring an app + to an App Service Environment). :type hosting_environment: str """ @@ -8422,8 +9703,6 @@ class RestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -8439,12 +9718,15 @@ class RestoreRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, 'ignore_databases': {'key': 'properties.ignoreDatabases', 'type': 'bool'}, 'app_service_plan': {'key': 'properties.appServicePlan', 'type': 'str'}, - 'operation_type': {'key': 'properties.operationType', 'type': 'BackupRestoreOperationType'}, + 'operation_type': {'key': 'properties.operationType', 'type': 'str'}, 'adjust_connection_strings': {'key': 'properties.adjustConnectionStrings', 'type': 'bool'}, 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RestoreRequest, self).__init__(**kwargs) self.storage_account_url = kwargs.get('storage_account_url', None) self.blob_name = kwargs.get('blob_name', None) @@ -8459,15 +9741,13 @@ def __init__(self, **kwargs): self.hosting_environment = kwargs.get('hosting_environment', None) -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """Resource metrics service provided by Microsoft.Insights resource provider. :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2018_02_01.models.MetricSpecification] + :type metric_specifications: list[~azure.mgmt.web.v2018_02_01.models.MetricSpecification] :param log_specifications: - :type log_specifications: - list[~azure.mgmt.web.v2018_02_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.web.v2018_02_01.models.LogSpecification] """ _attribute_map = { @@ -8475,7 +9755,10 @@ class ServiceSpecification(Model): 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = kwargs.get('metric_specifications', None) self.log_specifications = kwargs.get('log_specifications', None) @@ -8484,8 +9767,7 @@ def __init__(self, **kwargs): class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -8499,130 +9781,110 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2018_02_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2018_02_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2018_02_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2018_02_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param geo_distributions: GeoDistributions for this site - :type geo_distributions: - list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] - :param identity: - :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity + :param geo_distributions: GeoDistributions for this site. + :type geo_distributions: list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] """ _validation = { @@ -8657,13 +9919,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -8691,14 +9954,17 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, 'geo_distributions': {'key': 'properties.geoDistributions', 'type': '[GeoDistribution]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Site, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -8736,15 +10002,12 @@ def __init__(self, **kwargs): self.redundancy_mode = kwargs.get('redundancy_mode', None) self.in_progress_operation_id = None self.geo_distributions = kwargs.get('geo_distributions', None) - self.identity = kwargs.get('identity', None) class SiteAuthSettings(ProxyOnlyResource): - """Configuration settings for the Azure App Service Authentication / - Authorization feature. + """Configuration settings for the Azure App Service Authentication / Authorization feature. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8754,152 +10017,128 @@ class SiteAuthSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param enabled: true if the Authentication / Authorization - feature is enabled for the current app; otherwise, false. + :param enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. :type enabled: bool - :param runtime_version: The RuntimeVersion of the Authentication / - Authorization feature in use for the current app. - The setting in this value can control the behavior of certain features in - the Authentication / Authorization module. + :param runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. :type runtime_version: str - :param unauthenticated_client_action: The action to take when an - unauthenticated client attempts to access the app. Possible values - include: 'RedirectToLoginPage', 'AllowAnonymous' + :param unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous". :type unauthenticated_client_action: str or ~azure.mgmt.web.v2018_02_01.models.UnauthenticatedClientAction - :param token_store_enabled: true to durably store - platform-specific security tokens that are obtained during login flows; - otherwise, false. - The default is false. + :param token_store_enabled: :code:`true` to durably store platform-specific + security tokens that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. :type token_store_enabled: bool - :param allowed_external_redirect_urls: External URLs that can be - redirected to as part of logging in or logging out of the app. Note that - the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store - application backends. + :param allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. :type allowed_external_redirect_urls: list[str] - :param default_provider: The default authentication provider to use when - multiple providers are configured. - This setting is only needed if multiple providers are configured and the - unauthenticated client - action is set to "RedirectToLoginPage". Possible values include: - 'AzureActiveDirectory', 'Facebook', 'Google', 'MicrosoftAccount', - 'Twitter' - :type default_provider: str or - ~azure.mgmt.web.v2018_02_01.models.BuiltInAuthenticationProvider - :param token_refresh_extension_hours: The number of hours after session - token expiration that a session token can be used to + :param default_provider: The default authentication provider to use when multiple providers are + configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". Possible values include: "AzureActiveDirectory", + "Facebook", "Google", "MicrosoftAccount", "Twitter". + :type default_provider: str or ~azure.mgmt.web.v2018_02_01.models.BuiltInAuthenticationProvider + :param token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to call the token refresh API. The default is 72 hours. :type token_refresh_extension_hours: float - :param client_id: The Client ID of this relying party application, known - as the client_id. - This setting is required for enabling OpenID Connection authentication - with Azure Active Directory or + :param client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or other 3rd party OpenID Connect providers. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_id: str - :param client_secret: The Client Secret of this relying party application - (in Azure Active Directory, this is also referred to as the Key). - This setting is optional. If no client secret is configured, the OpenID - Connect implicit auth flow is used to authenticate end users. - Otherwise, the OpenID Connect Authorization Code Flow is used to - authenticate end users. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + :param client_secret: The Client Secret of this relying party application (in Azure Active + Directory, this is also referred to as the Key). + This setting is optional. If no client secret is configured, the OpenID Connect implicit auth + flow is used to authenticate end users. + Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_secret: str - :param client_secret_certificate_thumbprint: An alternative to the client - secret, that is the thumbprint of a certificate used for signing purposes. - This property acts as + :param client_secret_certificate_thumbprint: An alternative to the client secret, that is the + thumbprint of a certificate used for signing purposes. This property acts as a replacement for the Client Secret. It is also optional. :type client_secret_certificate_thumbprint: str - :param issuer: The OpenID Connect Issuer URI that represents the entity - which issues access tokens for this application. - When using Azure Active Directory, this value is the URI of the directory - tenant, e.g. https://sts.windows.net/{tenant-guid}/. + :param issuer: The OpenID Connect Issuer URI that represents the entity which issues access + tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://sts.windows.net/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. - More information on OpenID Connect Discovery: - http://openid.net/specs/openid-connect-discovery-1_0.html + More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect- + discovery-1_0.html. :type issuer: str - :param validate_issuer: Gets a value indicating whether the issuer should - be a valid HTTPS url and be validated as such. + :param validate_issuer: Gets a value indicating whether the issuer should be a valid HTTPS url + and be validated as such. :type validate_issuer: bool - :param allowed_audiences: Allowed audience values to consider when - validating JWTs issued by - Azure Active Directory. Note that the ClientID value is - always considered an + :param allowed_audiences: Allowed audience values to consider when validating JWTs issued by + Azure Active Directory. Note that the :code:`ClientID` value is always considered + an allowed audience, regardless of this setting. :type allowed_audiences: list[str] - :param additional_login_params: Login parameters to send to the OpenID - Connect authorization endpoint when + :param additional_login_params: Login parameters to send to the OpenID Connect authorization + endpoint when a user logs in. Each parameter must be in the form "key=value". :type additional_login_params: list[str] - :param google_client_id: The OpenID Connect Client ID for the Google web - application. + :param google_client_id: The OpenID Connect Client ID for the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_id: str - :param google_client_secret: The client secret associated with the Google - web application. + :param google_client_secret: The client secret associated with the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_secret: str - :param google_oauth_scopes: The OAuth 2.0 scopes that will be requested as - part of Google Sign-In authentication. - This setting is optional. If not specified, "openid", "profile", and - "email" are used as default scopes. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ - :type google_oauth_scopes: list[str] + :param google_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Google + Sign-In authentication. + This setting is optional. If not specified, "openid", "profile", and "email" are used as + default scopes. + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. + :type google_o_auth_scopes: list[str] :param facebook_app_id: The App ID of the Facebook app used for login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_id: str - :param facebook_app_secret: The App Secret of the Facebook app used for - Facebook Login. + :param facebook_app_secret: The App Secret of the Facebook app used for Facebook Login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_secret: str - :param facebook_oauth_scopes: The OAuth 2.0 scopes that will be requested - as part of Facebook Login authentication. + :param facebook_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Facebook + Login authentication. This setting is optional. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login - :type facebook_oauth_scopes: list[str] - :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter - application used for sign-in. + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. + :type facebook_o_auth_scopes: list[str] + :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter application used for + sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_key: str - :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the - Twitter application used for sign-in. + :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the Twitter application used + for sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_secret: str - :param microsoft_account_client_id: The OAuth 2.0 client ID that was - created for the app used for authentication. + :param microsoft_account_client_id: The OAuth 2.0 client ID that was created for the app used + for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_id: str - :param microsoft_account_client_secret: The OAuth 2.0 client secret that - was created for the app used for authentication. + :param microsoft_account_client_secret: The OAuth 2.0 client secret that was created for the + app used for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_secret: str - :param microsoft_account_oauth_scopes: The OAuth 2.0 scopes that will be - requested as part of Microsoft Account authentication. - This setting is optional. If not specified, "wl.basic" is used as the - default scope. - Microsoft Account Scopes and permissions documentation: - https://msdn.microsoft.com/en-us/library/dn631845.aspx - :type microsoft_account_oauth_scopes: list[str] + :param microsoft_account_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of + Microsoft Account authentication. + This setting is optional. If not specified, "wl.basic" is used as the default scope. + Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en- + us/library/dn631845.aspx. + :type microsoft_account_o_auth_scopes: list[str] """ _validation = { @@ -8915,10 +10154,10 @@ class SiteAuthSettings(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, - 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'UnauthenticatedClientAction'}, + 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'str'}, 'token_store_enabled': {'key': 'properties.tokenStoreEnabled', 'type': 'bool'}, 'allowed_external_redirect_urls': {'key': 'properties.allowedExternalRedirectUrls', 'type': '[str]'}, - 'default_provider': {'key': 'properties.defaultProvider', 'type': 'BuiltInAuthenticationProvider'}, + 'default_provider': {'key': 'properties.defaultProvider', 'type': 'str'}, 'token_refresh_extension_hours': {'key': 'properties.tokenRefreshExtensionHours', 'type': 'float'}, 'client_id': {'key': 'properties.clientId', 'type': 'str'}, 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, @@ -8929,18 +10168,21 @@ class SiteAuthSettings(ProxyOnlyResource): 'additional_login_params': {'key': 'properties.additionalLoginParams', 'type': '[str]'}, 'google_client_id': {'key': 'properties.googleClientId', 'type': 'str'}, 'google_client_secret': {'key': 'properties.googleClientSecret', 'type': 'str'}, - 'google_oauth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, + 'google_o_auth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, 'facebook_app_id': {'key': 'properties.facebookAppId', 'type': 'str'}, 'facebook_app_secret': {'key': 'properties.facebookAppSecret', 'type': 'str'}, - 'facebook_oauth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, + 'facebook_o_auth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, 'twitter_consumer_key': {'key': 'properties.twitterConsumerKey', 'type': 'str'}, 'twitter_consumer_secret': {'key': 'properties.twitterConsumerSecret', 'type': 'str'}, 'microsoft_account_client_id': {'key': 'properties.microsoftAccountClientId', 'type': 'str'}, 'microsoft_account_client_secret': {'key': 'properties.microsoftAccountClientSecret', 'type': 'str'}, - 'microsoft_account_oauth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, + 'microsoft_account_o_auth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteAuthSettings, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -8958,46 +10200,45 @@ def __init__(self, **kwargs): self.additional_login_params = kwargs.get('additional_login_params', None) self.google_client_id = kwargs.get('google_client_id', None) self.google_client_secret = kwargs.get('google_client_secret', None) - self.google_oauth_scopes = kwargs.get('google_oauth_scopes', None) + self.google_o_auth_scopes = kwargs.get('google_o_auth_scopes', None) self.facebook_app_id = kwargs.get('facebook_app_id', None) self.facebook_app_secret = kwargs.get('facebook_app_secret', None) - self.facebook_oauth_scopes = kwargs.get('facebook_oauth_scopes', None) + self.facebook_o_auth_scopes = kwargs.get('facebook_o_auth_scopes', None) self.twitter_consumer_key = kwargs.get('twitter_consumer_key', None) self.twitter_consumer_secret = kwargs.get('twitter_consumer_secret', None) self.microsoft_account_client_id = kwargs.get('microsoft_account_client_id', None) self.microsoft_account_client_secret = kwargs.get('microsoft_account_client_secret', None) - self.microsoft_account_oauth_scopes = kwargs.get('microsoft_account_oauth_scopes', None) + self.microsoft_account_o_auth_scopes = kwargs.get('microsoft_account_o_auth_scopes', None) -class SiteCloneability(Model): +class SiteCloneability(msrest.serialization.Model): """Represents whether or not an app is cloneable. - :param result: Name of app. Possible values include: 'Cloneable', - 'PartiallyCloneable', 'NotCloneable' + :param result: Name of app. Possible values include: "Cloneable", "PartiallyCloneable", + "NotCloneable". :type result: str or ~azure.mgmt.web.v2018_02_01.models.CloneAbilityResult - :param blocking_features: List of features enabled on app that prevent - cloning. - :type blocking_features: - list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] - :param unsupported_features: List of features enabled on app that are - non-blocking but cannot be cloned. The app can still be cloned + :param blocking_features: List of features enabled on app that prevent cloning. + :type blocking_features: list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] + :param unsupported_features: List of features enabled on app that are non-blocking but cannot + be cloned. The app can still be cloned but the features in this list will not be set up on cloned app. - :type unsupported_features: - list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] - :param blocking_characteristics: List of blocking application - characteristics. + :type unsupported_features: list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] + :param blocking_characteristics: List of blocking application characteristics. :type blocking_characteristics: list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] """ _attribute_map = { - 'result': {'key': 'result', 'type': 'CloneAbilityResult'}, + 'result': {'key': 'result', 'type': 'str'}, 'blocking_features': {'key': 'blockingFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'unsupported_features': {'key': 'unsupportedFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'blocking_characteristics': {'key': 'blockingCharacteristics', 'type': '[SiteCloneabilityCriterion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteCloneability, self).__init__(**kwargs) self.result = kwargs.get('result', None) self.blocking_features = kwargs.get('blocking_features', None) @@ -9005,7 +10246,7 @@ def __init__(self, **kwargs): self.blocking_characteristics = kwargs.get('blocking_characteristics', None) -class SiteCloneabilityCriterion(Model): +class SiteCloneabilityCriterion(msrest.serialization.Model): """An app cloneability criterion. :param name: Name of criterion. @@ -9019,24 +10260,25 @@ class SiteCloneabilityCriterion(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteCloneabilityCriterion, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9044,27 +10286,27 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str @@ -9074,27 +10316,25 @@ class SiteConfig(Model): :type azure_storage_accounts: dict[str, ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2018_02_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2018_02_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9104,24 +10344,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2018_02_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2018_02_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2018_02_01.models.AutoHealRules @@ -9133,40 +10369,35 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2018_02_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2018_02_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2018_02_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2018_02_01.models.FtpsState :param reserved_instance_count: Number of reserved instances. - This setting only applies to the Consumption Plan + This setting only applies to the Consumption Plan. :type reserved_instance_count: int """ @@ -9206,9 +10437,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -9231,7 +10462,10 @@ class SiteConfig(Model): 'reserved_instance_count': {'key': 'reservedInstanceCount', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -9291,8 +10525,7 @@ def __init__(self, **kwargs): class SiteConfigResource(ProxyOnlyResource): """Web app configuration ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9306,8 +10539,7 @@ class SiteConfigResource(ProxyOnlyResource): :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9315,27 +10547,27 @@ class SiteConfigResource(ProxyOnlyResource): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str @@ -9345,27 +10577,25 @@ class SiteConfigResource(ProxyOnlyResource): :type azure_storage_accounts: dict[str, ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2018_02_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2018_02_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9375,24 +10605,20 @@ class SiteConfigResource(ProxyOnlyResource): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2018_02_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2018_02_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2018_02_01.models.AutoHealRules @@ -9404,40 +10630,35 @@ class SiteConfigResource(ProxyOnlyResource): :type cors: ~azure.mgmt.web.v2018_02_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2018_02_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2018_02_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2018_02_01.models.FtpsState :param reserved_instance_count: Number of reserved instances. - This setting only applies to the Consumption Plan + This setting only applies to the Consumption Plan. :type reserved_instance_count: int """ @@ -9484,9 +10705,9 @@ class SiteConfigResource(ProxyOnlyResource): 'java_container': {'key': 'properties.javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'properties.javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'properties.appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'properties.virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'str'}, 'experiments': {'key': 'properties.experiments', 'type': 'Experiments'}, 'limits': {'key': 'properties.limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'properties.autoHealEnabled', 'type': 'bool'}, @@ -9509,7 +10730,10 @@ class SiteConfigResource(ProxyOnlyResource): 'reserved_instance_count': {'key': 'properties.reservedInstanceCount', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfigResource, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -9566,23 +10790,54 @@ def __init__(self, **kwargs): self.reserved_instance_count = kwargs.get('reserved_instance_count', None) -class SiteConfigurationSnapshotInfo(ProxyOnlyResource): - """A snapshot of a web app configuration. +class SiteConfigResourceCollection(msrest.serialization.Model): + """Collection of site configurations. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar time: The time the snapshot was taken. - :vartype time: datetime - :ivar snapshot_id: The id of the snapshot + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteConfigResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteConfigResourceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SiteConfigurationSnapshotInfo(ProxyOnlyResource): + """A snapshot of a web app configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :ivar time: The time the snapshot was taken. + :vartype time: ~datetime.datetime + :ivar snapshot_id: The id of the snapshot. :vartype snapshot_id: int """ @@ -9603,17 +10858,51 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfigurationSnapshotInfo, self).__init__(**kwargs) self.time = None self.snapshot_id = None +class SiteConfigurationSnapshotInfoCollection(msrest.serialization.Model): + """Collection of metadata for the app configuration snapshots that can be restored. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteConfigurationSnapshotInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteExtensionInfo(ProxyOnlyResource): """Site Extension Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9627,10 +10916,8 @@ class SiteExtensionInfo(ProxyOnlyResource): :type extension_id: str :param title: :type title: str - :param extension_type: Site extension type. Possible values include: - 'Gallery', 'WebRoot' - :type extension_type: str or - ~azure.mgmt.web.v2018_02_01.models.SiteExtensionType + :param extension_type: Site extension type. Possible values include: "Gallery", "WebRoot". + :type extension_type: str or ~azure.mgmt.web.v2018_02_01.models.SiteExtensionType :param summary: Summary description. :type summary: str :param description: Detailed description. @@ -9652,16 +10939,16 @@ class SiteExtensionInfo(ProxyOnlyResource): :param installer_command_line_params: Installer command line parameters. :type installer_command_line_params: str :param published_date_time: Published timestamp. - :type published_date_time: datetime + :type published_date_time: ~datetime.datetime :param download_count: Count of downloads. :type download_count: int - :param local_is_latest_version: true if the local version is - the latest version; false otherwise. + :param local_is_latest_version: :code:`true` if the local version is the latest + version; :code:`false` otherwise. :type local_is_latest_version: bool :param local_path: Local path. :type local_path: str :param installed_date_time: Installed timestamp. - :type installed_date_time: datetime + :type installed_date_time: ~datetime.datetime :param provisioning_state: Provisioning state. :type provisioning_state: str :param comment: Site Extension comment. @@ -9681,7 +10968,7 @@ class SiteExtensionInfo(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'extension_id': {'key': 'properties.extension_id', 'type': 'str'}, 'title': {'key': 'properties.title', 'type': 'str'}, - 'extension_type': {'key': 'properties.extension_type', 'type': 'SiteExtensionType'}, + 'extension_type': {'key': 'properties.extension_type', 'type': 'str'}, 'summary': {'key': 'properties.summary', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'str'}, @@ -9701,7 +10988,10 @@ class SiteExtensionInfo(ProxyOnlyResource): 'comment': {'key': 'properties.comment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteExtensionInfo, self).__init__(**kwargs) self.extension_id = kwargs.get('extension_id', None) self.title = kwargs.get('title', None) @@ -9725,11 +11015,42 @@ def __init__(self, **kwargs): self.comment = kwargs.get('comment', None) +class SiteExtensionInfoCollection(msrest.serialization.Model): + """Collection of Kudu site extension information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteExtensionInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteExtensionInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteInstance(ProxyOnlyResource): """Instance of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9758,12 +11079,15 @@ class SiteInstance(ProxyOnlyResource): 'site_instance_name': {'key': 'properties.siteInstanceName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteInstance, self).__init__(**kwargs) self.site_instance_name = None -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -9780,7 +11104,10 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) @@ -9790,8 +11117,7 @@ def __init__(self, **kwargs): class SiteLogsConfig(ProxyOnlyResource): """Configuration of App Service site logs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9802,16 +11128,13 @@ class SiteLogsConfig(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param application_logs: Application logs configuration. - :type application_logs: - ~azure.mgmt.web.v2018_02_01.models.ApplicationLogsConfig + :type application_logs: ~azure.mgmt.web.v2018_02_01.models.ApplicationLogsConfig :param http_logs: HTTP logs configuration. :type http_logs: ~azure.mgmt.web.v2018_02_01.models.HttpLogsConfig :param failed_requests_tracing: Failed requests tracing configuration. - :type failed_requests_tracing: - ~azure.mgmt.web.v2018_02_01.models.EnabledConfig + :type failed_requests_tracing: ~azure.mgmt.web.v2018_02_01.models.EnabledConfig :param detailed_error_messages: Detailed error messages configuration. - :type detailed_error_messages: - ~azure.mgmt.web.v2018_02_01.models.EnabledConfig + :type detailed_error_messages: ~azure.mgmt.web.v2018_02_01.models.EnabledConfig """ _validation = { @@ -9831,7 +11154,10 @@ class SiteLogsConfig(ProxyOnlyResource): 'detailed_error_messages': {'key': 'properties.detailedErrorMessages', 'type': 'EnabledConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLogsConfig, self).__init__(**kwargs) self.application_logs = kwargs.get('application_logs', None) self.http_logs = kwargs.get('http_logs', None) @@ -9839,7 +11165,7 @@ def __init__(self, **kwargs): self.detailed_error_messages = kwargs.get('detailed_error_messages', None) -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -9859,7 +11185,10 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = kwargs.get('validation', None) self.validation_key = kwargs.get('validation_key', None) @@ -9870,8 +11199,7 @@ def __init__(self, **kwargs): class SitePatchResource(ProxyOnlyResource): """ARM resource for a site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9881,128 +11209,108 @@ class SitePatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2018_02_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2018_02_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2018_02_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2018_02_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param geo_distributions: GeoDistributions for this site - :type geo_distributions: - list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] - :param identity: - :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity + :param geo_distributions: GeoDistributions for this site. + :type geo_distributions: list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] """ _validation = { @@ -10034,13 +11342,14 @@ class SitePatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -10068,14 +11377,17 @@ class SitePatchResource(ProxyOnlyResource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, 'geo_distributions': {'key': 'properties.geoDistributions', 'type': '[GeoDistribution]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SitePatchResource, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -10113,14 +11425,12 @@ def __init__(self, **kwargs): self.redundancy_mode = kwargs.get('redundancy_mode', None) self.in_progress_operation_id = None self.geo_distributions = kwargs.get('geo_distributions', None) - self.identity = kwargs.get('identity', None) class SitePhpErrorLogFlag(ProxyOnlyResource): """Used for getting PHP error logging flag. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10157,7 +11467,10 @@ class SitePhpErrorLogFlag(ProxyOnlyResource): 'master_log_errors_max_length': {'key': 'properties.masterLogErrorsMaxLength', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SitePhpErrorLogFlag, self).__init__(**kwargs) self.local_log_errors = kwargs.get('local_log_errors', None) self.master_log_errors = kwargs.get('master_log_errors', None) @@ -10165,12 +11478,12 @@ def __init__(self, **kwargs): self.master_log_errors_max_length = kwargs.get('master_log_errors_max_length', None) -class SiteSeal(Model): +class SiteSeal(msrest.serialization.Model): """Site seal. All required parameters must be populated in order to send to Azure. - :param html: Required. HTML snippet + :param html: Required. HTML snippet. :type html: str """ @@ -10182,16 +11495,19 @@ class SiteSeal(Model): 'html': {'key': 'html', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSeal, self).__init__(**kwargs) - self.html = kwargs.get('html', None) + self.html = kwargs['html'] -class SiteSealRequest(Model): +class SiteSealRequest(msrest.serialization.Model): """Site seal request. - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. + :param light_theme: If :code:`true` use the light color theme for site seal; + otherwise, use the default color theme. :type light_theme: bool :param locale: Locale of site seal. :type locale: str @@ -10202,7 +11518,10 @@ class SiteSealRequest(Model): 'locale': {'key': 'locale', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSealRequest, self).__init__(**kwargs) self.light_theme = kwargs.get('light_theme', None) self.locale = kwargs.get('locale', None) @@ -10211,8 +11530,7 @@ def __init__(self, **kwargs): class SiteSourceControl(ProxyOnlyResource): """Source control configuration for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10226,15 +11544,15 @@ class SiteSourceControl(ProxyOnlyResource): :type repo_url: str :param branch: Name of branch to use for deployment. :type branch: str - :param is_manual_integration: true to limit to manual - integration; false to enable continuous integration (which - configures webhooks into online repos like GitHub). + :param is_manual_integration: :code:`true` to limit to manual integration; + :code:`false` to enable continuous integration (which configures webhooks into + online repos like GitHub). :type is_manual_integration: bool - :param deployment_rollback_enabled: true to enable deployment - rollback; otherwise, false. + :param deployment_rollback_enabled: :code:`true` to enable deployment rollback; + otherwise, :code:`false`. :type deployment_rollback_enabled: bool - :param is_mercurial: true for a Mercurial repository; - false for a Git repository. + :param is_mercurial: :code:`true` for a Mercurial repository; + :code:`false` for a Git repository. :type is_mercurial: bool """ @@ -10256,7 +11574,10 @@ class SiteSourceControl(ProxyOnlyResource): 'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSourceControl, self).__init__(**kwargs) self.repo_url = kwargs.get('repo_url', None) self.branch = kwargs.get('branch', None) @@ -10265,7 +11586,7 @@ def __init__(self, **kwargs): self.is_mercurial = kwargs.get('is_mercurial', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -10285,7 +11606,10 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs.get('minimum', None) self.maximum = kwargs.get('maximum', None) @@ -10293,7 +11617,7 @@ def __init__(self, **kwargs): self.scale_type = kwargs.get('scale_type', None) -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -10310,8 +11634,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2018_02_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2018_02_01.models.Capability] """ @@ -10326,7 +11649,10 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -10338,7 +11664,7 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class SkuInfo(Model): +class SkuInfo(msrest.serialization.Model): """SKU discovery information. :param resource_type: Resource type that this SKU applies to. @@ -10355,21 +11681,55 @@ class SkuInfo(Model): 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuInfo, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.sku = kwargs.get('sku', None) self.capacity = kwargs.get('capacity', None) -class SkuInfos(Model): +class SkuInfoCollection(msrest.serialization.Model): + """Collection of SKU information. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SkuInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SkuInfos(msrest.serialization.Model): """Collection of SKU information. :param resource_type: Resource type that this SKU applies to. :type resource_type: str :param skus: List of SKUs the subscription is able to use. - :type skus: - list[~azure.mgmt.web.v2018_02_01.models.GlobalCsmSkuDescription] + :type skus: list[~azure.mgmt.web.v2018_02_01.models.GlobalCsmSkuDescription] """ _attribute_map = { @@ -10377,7 +11737,10 @@ class SkuInfos(Model): 'skus': {'key': 'skus', 'type': '[GlobalCsmSkuDescription]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuInfos, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.skus = kwargs.get('skus', None) @@ -10386,8 +11749,7 @@ def __init__(self, **kwargs): class SlotConfigNamesResource(ProxyOnlyResource): """Slot Config names azure resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10401,8 +11763,7 @@ class SlotConfigNamesResource(ProxyOnlyResource): :type connection_string_names: list[str] :param app_setting_names: List of application settings names. :type app_setting_names: list[str] - :param azure_storage_config_names: List of external Azure storage account - identifiers. + :param azure_storage_config_names: List of external Azure storage account identifiers. :type azure_storage_config_names: list[str] """ @@ -10422,7 +11783,10 @@ class SlotConfigNamesResource(ProxyOnlyResource): 'azure_storage_config_names': {'key': 'properties.azureStorageConfigNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotConfigNamesResource, self).__init__(**kwargs) self.connection_string_names = kwargs.get('connection_string_names', None) self.app_setting_names = kwargs.get('app_setting_names', None) @@ -10432,8 +11796,7 @@ def __init__(self, **kwargs): class SlotDifference(ProxyOnlyResource): """A setting difference between two deployment slots of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10445,11 +11808,9 @@ class SlotDifference(ProxyOnlyResource): :vartype type: str :ivar level: Level of the difference: Information, Warning or Error. :vartype level: str - :ivar setting_type: The type of the setting: General, AppSetting or - ConnectionString. + :ivar setting_type: The type of the setting: General, AppSetting or ConnectionString. :vartype setting_type: str - :ivar diff_rule: Rule that describes how to process the setting difference - during a slot swap. + :ivar diff_rule: Rule that describes how to process the setting difference during a slot swap. :vartype diff_rule: str :ivar setting_name: Name of the setting. :vartype setting_name: str @@ -10488,7 +11849,10 @@ class SlotDifference(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotDifference, self).__init__(**kwargs) self.level = None self.setting_type = None @@ -10499,18 +11863,48 @@ def __init__(self, **kwargs): self.description = None -class SlotSwapStatus(Model): +class SlotDifferenceCollection(msrest.serialization.Model): + """Collection of slot differences. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SlotDifference] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SlotDifference]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SlotDifferenceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -10526,14 +11920,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -10550,7 +11947,10 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = kwargs.get('time_taken', None) self.count = kwargs.get('count', None) @@ -10560,8 +11960,7 @@ def __init__(self, **kwargs): class Snapshot(ProxyOnlyResource): """A snapshot of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10590,21 +11989,56 @@ class Snapshot(ProxyOnlyResource): 'time': {'key': 'properties.time', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Snapshot, self).__init__(**kwargs) self.time = None -class SnapshotRecoverySource(Model): +class SnapshotCollection(msrest.serialization.Model): + """Collection of snapshots which can be used to revert an app to a previous time. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Snapshot] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SnapshotCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SnapshotRecoverySource(msrest.serialization.Model): """Specifies the web app that snapshot contents will be retrieved from. - :param location: Geographical location of the source web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the source web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the source app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -10614,7 +12048,10 @@ class SnapshotRecoverySource(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoverySource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.id = kwargs.get('id', None) @@ -10623,10 +12060,7 @@ def __init__(self, **kwargs): class SnapshotRestoreRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10636,26 +12070,24 @@ class SnapshotRestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app restore should be - done, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app restore should be done, formatted as a + DateTime string. :type snapshot_time: str - :param recovery_source: Optional. Specifies the web app that snapshot - contents will be retrieved from. + :param recovery_source: Optional. Specifies the web app that snapshot contents will be + retrieved from. If empty, the targeted web app will be used as the source. - :type recovery_source: - ~azure.mgmt.web.v2018_02_01.models.SnapshotRecoverySource - :param overwrite: Required. If true the restore operation can - overwrite source app; otherwise, false. + :type recovery_source: ~azure.mgmt.web.v2018_02_01.models.SnapshotRecoverySource + :param overwrite: If :code:`true` the restore operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -10663,7 +12095,6 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -10679,7 +12110,10 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRestoreRequest, self).__init__(**kwargs) self.snapshot_time = kwargs.get('snapshot_time', None) self.recovery_source = kwargs.get('recovery_source', None) @@ -10689,25 +12123,24 @@ def __init__(self, **kwargs): self.use_dr_secondary = kwargs.get('use_dr_secondary', None) -class Solution(Model): +class Solution(msrest.serialization.Model): """Class Representing Solution for problems detected. :param id: Solution Id. :type id: float - :param display_name: Display Name of the solution + :param display_name: Display Name of the solution. :type display_name: str :param order: Order of the solution. :type order: float - :param description: Description of the solution + :param description: Description of the solution. :type description: str - :param type: Type of Solution. Possible values include: 'QuickSolution', - 'DeepInvestigation', 'BestPractices' + :param type: Type of Solution. Possible values include: "QuickSolution", "DeepInvestigation", + "BestPractices". :type type: str or ~azure.mgmt.web.v2018_02_01.models.SolutionType :param data: Solution Data. :type data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] :param metadata: Solution Metadata. - :type metadata: - list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] + :type metadata: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] """ _attribute_map = { @@ -10715,12 +12148,15 @@ class Solution(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'float'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'SolutionType'}, + 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'data', 'type': '[[NameValuePair]]'}, 'metadata': {'key': 'metadata', 'type': '[[NameValuePair]]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Solution, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.display_name = kwargs.get('display_name', None) @@ -10734,8 +12170,7 @@ def __init__(self, **kwargs): class SourceControl(ProxyOnlyResource): """The source control OAuth token. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10752,7 +12187,7 @@ class SourceControl(ProxyOnlyResource): :param refresh_token: OAuth refresh token. :type refresh_token: str :param expiration_time: OAuth token expiration. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime """ _validation = { @@ -10772,7 +12207,10 @@ class SourceControl(ProxyOnlyResource): 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SourceControl, self).__init__(**kwargs) self.token = kwargs.get('token', None) self.token_secret = kwargs.get('token_secret', None) @@ -10780,21 +12218,52 @@ def __init__(self, **kwargs): self.expiration_time = kwargs.get('expiration_time', None) -class StackMajorVersion(Model): +class SourceControlCollection(msrest.serialization.Model): + """Collection of source controls. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SourceControlCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class StackMajorVersion(msrest.serialization.Model): """Application stack major version. :param display_version: Application stack major version (display only). :type display_version: str :param runtime_version: Application stack major version (runtime only). :type runtime_version: str - :param is_default: true if this is the default major version; - otherwise, false. + :param is_default: :code:`true` if this is the default major version; otherwise, + :code:`false`. :type is_default: bool :param minor_versions: Minor versions associated with the major version. - :type minor_versions: - list[~azure.mgmt.web.v2018_02_01.models.StackMinorVersion] - :param application_insights: true if this supports - Application Insights; otherwise, false. + :type minor_versions: list[~azure.mgmt.web.v2018_02_01.models.StackMinorVersion] + :param application_insights: :code:`true` if this supports Application Insights; + otherwise, :code:`false`. :type application_insights: bool """ @@ -10806,7 +12275,10 @@ class StackMajorVersion(Model): 'application_insights': {'key': 'applicationInsights', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StackMajorVersion, self).__init__(**kwargs) self.display_version = kwargs.get('display_version', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -10815,18 +12287,18 @@ def __init__(self, **kwargs): self.application_insights = kwargs.get('application_insights', None) -class StackMinorVersion(Model): +class StackMinorVersion(msrest.serialization.Model): """Application stack minor version. :param display_version: Application stack minor version (display only). :type display_version: str :param runtime_version: Application stack minor version (runtime only). :type runtime_version: str - :param is_default: true if this is the default minor version; - otherwise, false. + :param is_default: :code:`true` if this is the default minor version; otherwise, + :code:`false`. :type is_default: bool - :param is_remote_debugging_enabled: true if this supports - Remote Debugging, otherwise false. + :param is_remote_debugging_enabled: :code:`true` if this supports Remote + Debugging, otherwise :code:`false`. :type is_remote_debugging_enabled: bool """ @@ -10837,7 +12309,10 @@ class StackMinorVersion(Model): 'is_remote_debugging_enabled': {'key': 'isRemoteDebuggingEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StackMinorVersion, self).__init__(**kwargs) self.display_version = kwargs.get('display_version', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -10845,42 +12320,37 @@ def __init__(self, **kwargs): self.is_remote_debugging_enabled = kwargs.get('is_remote_debugging_enabled', None) -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3', 'Default' - :type worker_size: str or - ~azure.mgmt.web.v2018_02_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Small", "Medium", "Large", + "D1", "D2", "D3", "Default". + :type worker_size: str or ~azure.mgmt.web.v2018_02_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str - :param is_linux: Is this a linux stamp capacity + :param is_linux: Is this a linux stamp capacity. :type is_linux: bool """ @@ -10889,8 +12359,8 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, @@ -10898,7 +12368,10 @@ class StampCapacity(Model): 'is_linux': {'key': 'isLinux', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available_capacity = kwargs.get('available_capacity', None) @@ -10913,7 +12386,39 @@ def __init__(self, **kwargs): self.is_linux = kwargs.get('is_linux', None) -class StatusCodesBasedTrigger(Model): +class StampCapacityCollection(msrest.serialization.Model): + """Collection of stamp capacities. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StampCapacity]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StampCapacityCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -10936,7 +12441,10 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.sub_status = kwargs.get('sub_status', None) @@ -10948,10 +12456,7 @@ def __init__(self, **kwargs): class StorageMigrationOptions(ProxyOnlyResource): """Options for app content migration. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10961,17 +12466,15 @@ class StorageMigrationOptions(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param azurefiles_connection_string: Required. AzureFiles connection - string. + :param azurefiles_connection_string: AzureFiles connection string. :type azurefiles_connection_string: str - :param azurefiles_share: Required. AzureFiles share. + :param azurefiles_share: AzureFiles share. :type azurefiles_share: str - :param switch_site_after_migration: trueif the app should be - switched over; otherwise, false. Default value: False . + :param switch_site_after_migration: :code:`true`if the app should be switched + over; otherwise, :code:`false`. :type switch_site_after_migration: bool - :param block_write_access_to_site: true if the app should be - read only during copy operation; otherwise, false. Default - value: False . + :param block_write_access_to_site: :code:`true` if the app should be read only + during copy operation; otherwise, :code:`false`. :type block_write_access_to_site: bool """ @@ -10979,8 +12482,6 @@ class StorageMigrationOptions(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'azurefiles_connection_string': {'required': True}, - 'azurefiles_share': {'required': True}, } _attribute_map = { @@ -10994,7 +12495,10 @@ class StorageMigrationOptions(ProxyOnlyResource): 'block_write_access_to_site': {'key': 'properties.blockWriteAccessToSite', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageMigrationOptions, self).__init__(**kwargs) self.azurefiles_connection_string = kwargs.get('azurefiles_connection_string', None) self.azurefiles_share = kwargs.get('azurefiles_share', None) @@ -11005,8 +12509,7 @@ def __init__(self, **kwargs): class StorageMigrationResponse(ProxyOnlyResource): """Response for a migration of app content request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11016,8 +12519,8 @@ class StorageMigrationResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the migration process, it will - return an operation ID identifying that particular migration operation. + :ivar operation_id: When server starts the migration process, it will return an operation ID + identifying that particular migration operation. :vartype operation_id: str """ @@ -11036,7 +12539,10 @@ class StorageMigrationResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageMigrationResponse, self).__init__(**kwargs) self.operation_id = None @@ -11044,8 +12550,7 @@ def __init__(self, **kwargs): class StringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11073,17 +12578,18 @@ class StringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringDictionary, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) class SwiftVirtualNetwork(ProxyOnlyResource): - """Swift Virtual Network Contract. This is used to enable the new Swift way of - doing virtual network integration. + """Swift Virtual Network Contract. This is used to enable the new Swift way of doing virtual network integration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11093,12 +12599,12 @@ class SwiftVirtualNetwork(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param subnet_resource_id: The Virtual Network subnet's resource ID. This - is the subnet that this Web App will join. This subnet must have a - delegation to Microsoft.Web/serverFarms defined first. + :param subnet_resource_id: The Virtual Network subnet's resource ID. This is the subnet that + this Web App will join. This subnet must have a delegation to Microsoft.Web/serverFarms defined + first. :type subnet_resource_id: str - :param swift_supported: A flag that specifies if the scale unit this Web - App is on supports Swift integration. + :param swift_supported: A flag that specifies if the scale unit this Web App is on supports + Swift integration. :type swift_supported: bool """ @@ -11117,13 +12623,16 @@ class SwiftVirtualNetwork(ProxyOnlyResource): 'swift_supported': {'key': 'properties.swiftSupported', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SwiftVirtualNetwork, self).__init__(**kwargs) self.subnet_resource_id = kwargs.get('subnet_resource_id', None) self.swift_supported = kwargs.get('swift_supported', None) -class TldLegalAgreement(Model): +class TldLegalAgreement(msrest.serialization.Model): """Legal agreement for a top level domain. All required parameters must be populated in order to send to Azure. @@ -11151,19 +12660,53 @@ class TldLegalAgreement(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TldLegalAgreement, self).__init__(**kwargs) - self.agreement_key = kwargs.get('agreement_key', None) - self.title = kwargs.get('title', None) - self.content = kwargs.get('content', None) + self.agreement_key = kwargs['agreement_key'] + self.title = kwargs['title'] + self.content = kwargs['content'] self.url = kwargs.get('url', None) +class TldLegalAgreementCollection(msrest.serialization.Model): + """Collection of top-level domain legal agreements. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TldLegalAgreement] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TldLegalAgreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TldLegalAgreementCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TopLevelDomain(ProxyOnlyResource): """A top level domain object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11173,8 +12716,8 @@ class TopLevelDomain(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param privacy: If true, then the top level domain supports - domain privacy; otherwise, false. + :param privacy: If :code:`true`, then the top level domain supports domain + privacy; otherwise, :code:`false`. :type privacy: bool """ @@ -11192,21 +12735,22 @@ class TopLevelDomain(ProxyOnlyResource): 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopLevelDomain, self).__init__(**kwargs) self.privacy = kwargs.get('privacy', None) -class TopLevelDomainAgreementOption(Model): +class TopLevelDomainAgreementOption(msrest.serialization.Model): """Options for retrieving the list of top level domain legal agreements. - :param include_privacy: If true, then the list of agreements - will include agreements for domain privacy as well; otherwise, - false. + :param include_privacy: If :code:`true`, then the list of agreements will include + agreements for domain privacy as well; otherwise, :code:`false`. :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. + :param for_transfer: If :code:`true`, then the list of agreements will include + agreements for domain transfer as well; otherwise, :code:`false`. :type for_transfer: bool """ @@ -11215,18 +12759,51 @@ class TopLevelDomainAgreementOption(Model): 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopLevelDomainAgreementOption, self).__init__(**kwargs) self.include_privacy = kwargs.get('include_privacy', None) self.for_transfer = kwargs.get('for_transfer', None) +class TopLevelDomainCollection(msrest.serialization.Model): + """Collection of Top-level domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TopLevelDomain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopLevelDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TopLevelDomainCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TriggeredJobHistory(ProxyOnlyResource): - """Triggered Web Job History. List of Triggered Web Job Run Information - elements. + """Triggered Web Job History. List of Triggered Web Job Run Information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11254,16 +12831,50 @@ class TriggeredJobHistory(ProxyOnlyResource): 'runs': {'key': 'properties.runs', 'type': '[TriggeredJobRun]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredJobHistory, self).__init__(**kwargs) self.runs = kwargs.get('runs', None) +class TriggeredJobHistoryCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredJobHistory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TriggeredJobHistoryCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TriggeredJobRun(ProxyOnlyResource): """Triggered Web Job Run Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11277,14 +12888,12 @@ class TriggeredJobRun(ProxyOnlyResource): :type web_job_id: str :param web_job_name: Job name. :type web_job_name: str - :param status: Job status. Possible values include: 'Success', 'Failed', - 'Error' - :type status: str or - ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobStatus + :param status: Job status. Possible values include: "Success", "Failed", "Error". + :type status: str or ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobStatus :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime + :type end_time: ~datetime.datetime :param duration: Job duration. :type duration: str :param output_url: Output URL. @@ -11312,7 +12921,7 @@ class TriggeredJobRun(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'web_job_id': {'key': 'properties.web_job_id', 'type': 'str'}, 'web_job_name': {'key': 'properties.web_job_name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TriggeredWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'start_time': {'key': 'properties.start_time', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.end_time', 'type': 'iso-8601'}, 'duration': {'key': 'properties.duration', 'type': 'str'}, @@ -11323,7 +12932,10 @@ class TriggeredJobRun(ProxyOnlyResource): 'trigger': {'key': 'properties.trigger', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredJobRun, self).__init__(**kwargs) self.web_job_id = kwargs.get('web_job_id', None) self.web_job_name = kwargs.get('web_job_name', None) @@ -11341,8 +12953,7 @@ def __init__(self, **kwargs): class TriggeredWebJob(ProxyOnlyResource): """Triggered Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11364,12 +12975,11 @@ class TriggeredWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2018_02_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -11392,13 +13002,16 @@ class TriggeredWebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredWebJob, self).__init__(**kwargs) self.latest_run = kwargs.get('latest_run', None) self.history_url = kwargs.get('history_url', None) @@ -11412,11 +13025,42 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) +class TriggeredWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TriggeredWebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class Usage(ProxyOnlyResource): """Usage of the quota resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11437,11 +13081,10 @@ class Usage(ProxyOnlyResource): :ivar limit: The resource limit. :vartype limit: long :ivar next_reset_time: Next reset time for the resource counter. - :vartype next_reset_time: datetime - :ivar compute_mode: Compute mode used for this usage. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :vartype compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :vartype next_reset_time: ~datetime.datetime + :ivar compute_mode: Compute mode used for this usage. Possible values include: "Shared", + "Dedicated", "Dynamic". + :vartype compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions :ivar site_mode: Site mode used for this usage. :vartype site_mode: str """ @@ -11471,11 +13114,14 @@ class Usage(ProxyOnlyResource): 'current_value': {'key': 'properties.currentValue', 'type': 'long'}, 'limit': {'key': 'properties.limit', 'type': 'long'}, 'next_reset_time': {'key': 'properties.nextResetTime', 'type': 'iso-8601'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'site_mode': {'key': 'properties.siteMode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Usage, self).__init__(**kwargs) self.display_name = None self.resource_name = None @@ -11487,14 +13133,43 @@ def __init__(self, **kwargs): self.site_mode = None -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class UsageCollection(msrest.serialization.Model): + """Collection of usages. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Usage] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UsageCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class User(ProxyOnlyResource): + """User credentials used for publishing activity. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -11503,14 +13178,13 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str :param scm_uri: Url of SCM site. :type scm_uri: str @@ -11520,7 +13194,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -11535,7 +13208,10 @@ class User(ProxyOnlyResource): 'scm_uri': {'key': 'properties.scmUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(User, self).__init__(**kwargs) self.publishing_user_name = kwargs.get('publishing_user_name', None) self.publishing_password = kwargs.get('publishing_password', None) @@ -11544,20 +13220,20 @@ def __init__(self, **kwargs): self.scm_uri = kwargs.get('scm_uri', None) -class ValidateContainerSettingsRequest(Model): +class ValidateContainerSettingsRequest(msrest.serialization.Model): """Container settings validation request context. - :param base_url: Base URL of the container registry + :param base_url: Base URL of the container registry. :type base_url: str - :param username: Username for to access the container registry + :param username: Username for to access the container registry. :type username: str - :param password: Password for to access the container registry + :param password: Password for to access the container registry. :type password: str - :param repository: Repository name (image name) + :param repository: Repository name (image name). :type repository: str - :param tag: Image tag + :param tag: Image tag. :type tag: str - :param platform: Platform (windows or linux) + :param platform: Platform (windows or linux). :type platform: str """ @@ -11570,7 +13246,10 @@ class ValidateContainerSettingsRequest(Model): 'platform': {'key': 'platform', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateContainerSettingsRequest, self).__init__(**kwargs) self.base_url = kwargs.get('base_url', None) self.username = kwargs.get('username', None) @@ -11580,37 +13259,35 @@ def __init__(self, **kwargs): self.platform = kwargs.get('platform', None) -class ValidateRequest(Model): +class ValidateRequest(msrest.serialization.Model): """Resource validation request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'ServerFarm', 'Site' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.ValidateResourceTypes + :param type: Required. Resource type used for verification. Possible values include: + "ServerFarm", "Site". + :type type: str or ~azure.mgmt.web.v2018_02_01.models.ValidateResourceTypes :param location: Required. Expected location of the resource. :type location: str - :param server_farm_id: ARM resource ID of an App Service plan that would - host the app. + :param server_farm_id: ARM resource ID of an App Service plan that would host the app. :type server_farm_id: str :param sku_name: Name of the target SKU for the App Service plan. :type sku_name: str - :param need_linux_workers: true if App Service plan is for - Linux workers; otherwise, false. + :param need_linux_workers: :code:`true` if App Service plan is for Linux workers; + otherwise, :code:`false`. :type need_linux_workers: bool - :param is_spot: true if App Service plan is for Spot - instances; otherwise, false. + :param is_spot: :code:`true` if App Service plan is for Spot instances; otherwise, + :code:`false`. :type is_spot: bool :param capacity: Target capacity of the App Service plan (number of VMs). :type capacity: int - :param hosting_environment: Name of App Service Environment where app or - App Service plan should be created. + :param hosting_environment: Name of App Service Environment where app or App Service plan + should be created. :type hosting_environment: str - :param is_xenon: true if App Service plan is running as a - windows container + :param is_xenon: :code:`true` if App Service plan is running as a windows + container. :type is_xenon: bool """ @@ -11634,11 +13311,14 @@ class ValidateRequest(Model): 'is_xenon': {'key': 'properties.isXenon', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.location = kwargs.get('location', None) + self.name = kwargs['name'] + self.type = kwargs['type'] + self.location = kwargs['location'] self.server_farm_id = kwargs.get('server_farm_id', None) self.sku_name = kwargs.get('sku_name', None) self.need_linux_workers = kwargs.get('need_linux_workers', None) @@ -11648,7 +13328,7 @@ def __init__(self, **kwargs): self.is_xenon = kwargs.get('is_xenon', None) -class ValidateResponse(Model): +class ValidateResponse(msrest.serialization.Model): """Describes the result of resource validation. :param status: Result of validation. @@ -11662,13 +13342,16 @@ class ValidateResponse(Model): 'error': {'key': 'error', 'type': 'ValidateResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateResponse, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.error = kwargs.get('error', None) -class ValidateResponseError(Model): +class ValidateResponseError(msrest.serialization.Model): """Error details for when validation fails. :param code: Validation error code. @@ -11682,25 +13365,27 @@ class ValidateResponseError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateResponseError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2018_02_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2018_02_01.models.VirtualDirectory] """ _attribute_map = { @@ -11710,7 +13395,10 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) @@ -11718,7 +13406,7 @@ def __init__(self, **kwargs): self.virtual_directories = kwargs.get('virtual_directories', None) -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -11732,13 +13420,16 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -11758,7 +13449,10 @@ class VirtualIPMapping(Model): 'in_use': {'key': 'inUse', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = kwargs.get('virtual_ip', None) self.internal_http_port = kwargs.get('internal_http_port', None) @@ -11766,11 +13460,10 @@ def __init__(self, **kwargs): self.in_use = kwargs.get('in_use', None) -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -11794,7 +13487,10 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None @@ -11803,13 +13499,9 @@ def __init__(self, **kwargs): class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11821,8 +13513,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -11830,7 +13521,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -11842,7 +13532,10 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetGateway, self).__init__(**kwargs) self.vnet_name = kwargs.get('vnet_name', None) self.vpn_package_uri = kwargs.get('vpn_package_uri', None) @@ -11851,8 +13544,7 @@ def __init__(self, **kwargs): class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11866,19 +13558,19 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: str :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str - :param is_swift: Flag that is used to denote if this is VNET injection + :param is_swift: Flag that is used to denote if this is VNET injection. :type is_swift: bool """ @@ -11905,7 +13597,10 @@ class VnetInfo(ProxyOnlyResource): 'is_swift': {'key': 'properties.isSwift', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetInfo, self).__init__(**kwargs) self.vnet_resource_id = kwargs.get('vnet_resource_id', None) self.cert_thumbprint = None @@ -11919,8 +13614,7 @@ def __init__(self, **kwargs): class VnetParameters(ProxyOnlyResource): """The required set of inputs to validate a VNET. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11930,11 +13624,11 @@ class VnetParameters(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_resource_group: The Resource Group of the VNET to be validated + :param vnet_resource_group: The Resource Group of the VNET to be validated. :type vnet_resource_group: str - :param vnet_name: The name of the VNET to be validated + :param vnet_name: The name of the VNET to be validated. :type vnet_name: str - :param vnet_subnet_name: The subnet name to be validated + :param vnet_subnet_name: The subnet name to be validated. :type vnet_subnet_name: str """ @@ -11954,7 +13648,10 @@ class VnetParameters(ProxyOnlyResource): 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetParameters, self).__init__(**kwargs) self.vnet_resource_group = kwargs.get('vnet_resource_group', None) self.vnet_name = kwargs.get('vnet_name', None) @@ -11962,11 +13659,9 @@ def __init__(self, **kwargs): class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11976,20 +13671,19 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2018_02_01.models.RouteType """ @@ -12009,7 +13703,10 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetRoute, self).__init__(**kwargs) self.start_address = kwargs.get('start_address', None) self.end_address = kwargs.get('end_address', None) @@ -12019,8 +13716,7 @@ def __init__(self, **kwargs): class VnetValidationFailureDetails(ProxyOnlyResource): """A class that describes the reason for a validation failure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12033,8 +13729,7 @@ class VnetValidationFailureDetails(ProxyOnlyResource): :param failed: A flag describing whether or not validation failed. :type failed: bool :param failed_tests: A list of tests that failed in the validation. - :type failed_tests: - list[~azure.mgmt.web.v2018_02_01.models.VnetValidationTestFailure] + :type failed_tests: list[~azure.mgmt.web.v2018_02_01.models.VnetValidationTestFailure] """ _validation = { @@ -12052,7 +13747,10 @@ class VnetValidationFailureDetails(ProxyOnlyResource): 'failed_tests': {'key': 'properties.failedTests', 'type': '[VnetValidationTestFailure]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetValidationFailureDetails, self).__init__(**kwargs) self.failed = kwargs.get('failed', None) self.failed_tests = kwargs.get('failed_tests', None) @@ -12061,8 +13759,7 @@ def __init__(self, **kwargs): class VnetValidationTestFailure(ProxyOnlyResource): """A class that describes a test that failed during NSG and UDR validation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12074,8 +13771,7 @@ class VnetValidationTestFailure(ProxyOnlyResource): :vartype type: str :param test_name: The name of the test that failed. :type test_name: str - :param details: The details of what caused the failure, e.g. the blocking - rule name, etc. + :param details: The details of what caused the failure, e.g. the blocking rule name, etc. :type details: str """ @@ -12094,17 +13790,19 @@ class VnetValidationTestFailure(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetValidationTestFailure, self).__init__(**kwargs) self.test_name = kwargs.get('test_name', None) self.details = kwargs.get('details', None) -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -12124,17 +13822,51 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] + self.next_link = None + + +class WebAppInstanceCollection(msrest.serialization.Model): + """Collection of app instances. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteInstance] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebAppInstanceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] self.next_link = None class WebJob(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12150,12 +13882,11 @@ class WebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2018_02_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -12175,13 +13906,16 @@ class WebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebJob, self).__init__(**kwargs) self.run_command = kwargs.get('run_command', None) self.url = kwargs.get('url', None) @@ -12192,24 +13926,53 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) -class WorkerPool(Model): +class WebJobCollection(msrest.serialization.Model): + """Collection of Kudu web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.WebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -12219,13 +13982,16 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) @@ -12234,11 +14000,42 @@ def __init__(self, **kwargs): self.instance_names = None +class WorkerPoolCollection(msrest.serialization.Model): + """Collection of worker pools. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkerPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkerPoolCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class WorkerPoolResource(ProxyOnlyResource): """Worker pool of an App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12248,21 +14045,19 @@ class WorkerPoolResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] - :param sku: - :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription """ _validation = { @@ -12277,19 +14072,22 @@ class WorkerPoolResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_size_id': {'key': 'properties.workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'worker_size': {'key': 'properties.workerSize', 'type': 'str'}, 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, 'instance_names': {'key': 'properties.instanceNames', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPoolResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) self.worker_size = kwargs.get('worker_size', None) self.worker_count = kwargs.get('worker_count', None) self.instance_names = None - self.sku = kwargs.get('sku', None) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models_py3.py index fd7a60480c3a..34e3629f0ce1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_models_py3.py @@ -1,29 +1,30 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AbnormalTimePeriod(Model): +from ._web_site_management_client_enums import * + + +class AbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period identified in diagnosis. - :param start_time: Start time of the downtime - :type start_time: datetime - :param end_time: End time of the downtime - :type end_time: datetime - :param events: List of Possible Cause of downtime - :type events: - list[~azure.mgmt.web.v2018_02_01.models.DetectorAbnormalTimePeriod] - :param solutions: List of proposed solutions + :param start_time: Start time of the downtime. + :type start_time: ~datetime.datetime + :param end_time: End time of the downtime. + :type end_time: ~datetime.datetime + :param events: List of Possible Cause of downtime. + :type events: list[~azure.mgmt.web.v2018_02_01.models.DetectorAbnormalTimePeriod] + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2018_02_01.models.Solution] """ @@ -34,7 +35,15 @@ class AbnormalTimePeriod(Model): 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, *, start_time=None, end_time=None, events=None, solutions=None, **kwargs) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + events: Optional[List["DetectorAbnormalTimePeriod"]] = None, + solutions: Optional[List["Solution"]] = None, + **kwargs + ): super(AbnormalTimePeriod, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -42,7 +51,7 @@ def __init__(self, *, start_time=None, end_time=None, events=None, solutions=Non self.solutions = solutions -class Address(Model): +class Address(msrest.serialization.Model): """Address information for domain registration. All required parameters must be populated in order to send to Azure. @@ -78,7 +87,17 @@ class Address(Model): 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, *, address1: str, city: str, country: str, postal_code: str, state: str, address2: str=None, **kwargs) -> None: + def __init__( + self, + *, + address1: str, + city: str, + country: str, + postal_code: str, + state: str, + address2: Optional[str] = None, + **kwargs + ): super(Address, self).__init__(**kwargs) self.address1 = address1 self.address2 = address2 @@ -88,20 +107,18 @@ def __init__(self, *, address1: str, city: str, country: str, postal_code: str, self.state = state -class AddressResponse(Model): +class AddressResponse(msrest.serialization.Model): """Describes main public IP address and any extra virtual IPs. :param service_ip_address: Main public virtual IP. :type service_ip_address: str - :param internal_ip_address: Virtual Network internal IP address of the App - Service Environment if it is in internal load-balancing mode. + :param internal_ip_address: Virtual Network internal IP address of the App Service Environment + if it is in internal load-balancing mode. :type internal_ip_address: str - :param outbound_ip_addresses: IP addresses appearing on outbound - connections. + :param outbound_ip_addresses: IP addresses appearing on outbound connections. :type outbound_ip_addresses: list[str] :param vip_mappings: Additional virtual IPs. - :type vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :type vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] """ _attribute_map = { @@ -111,7 +128,15 @@ class AddressResponse(Model): 'vip_mappings': {'key': 'vipMappings', 'type': '[VirtualIPMapping]'}, } - def __init__(self, *, service_ip_address: str=None, internal_ip_address: str=None, outbound_ip_addresses=None, vip_mappings=None, **kwargs) -> None: + def __init__( + self, + *, + service_ip_address: Optional[str] = None, + internal_ip_address: Optional[str] = None, + outbound_ip_addresses: Optional[List[str]] = None, + vip_mappings: Optional[List["VirtualIPMapping"]] = None, + **kwargs + ): super(AddressResponse, self).__init__(**kwargs) self.service_ip_address = service_ip_address self.internal_ip_address = internal_ip_address @@ -119,22 +144,19 @@ def __init__(self, *, service_ip_address: str=None, internal_ip_address: str=Non self.vip_mappings = vip_mappings -class AnalysisData(Model): +class AnalysisData(msrest.serialization.Model): """Class Representing Detector Evidence used for analysis. - :param source: Name of the Detector + :param source: Name of the Detector. :type source: str - :param detector_definition: Detector Definition - :type detector_definition: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition - :param metrics: Source Metrics - :type metrics: - list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] - :param data: Additional Source Data + :param detector_definition: Detector Definition. + :type detector_definition: ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition + :param metrics: Source Metrics. + :type metrics: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] + :param data: Additional Source Data. :type data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] - :param detector_meta_data: Detector Meta Data - :type detector_meta_data: - ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData + :param detector_meta_data: Detector Meta Data. + :type detector_meta_data: ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData """ _attribute_map = { @@ -145,7 +167,16 @@ class AnalysisData(Model): 'detector_meta_data': {'key': 'detectorMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, *, source: str=None, detector_definition=None, metrics=None, data=None, detector_meta_data=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional[str] = None, + detector_definition: Optional["DetectorDefinition"] = None, + metrics: Optional[List["DiagnosticMetricSet"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + detector_meta_data: Optional["ResponseMetaData"] = None, + **kwargs + ): super(AnalysisData, self).__init__(**kwargs) self.source = source self.detector_definition = detector_definition @@ -154,12 +185,10 @@ def __init__(self, *, source: str=None, detector_definition=None, metrics=None, self.detector_meta_data = detector_meta_data -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -184,7 +213,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -195,8 +229,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class AnalysisDefinition(ProxyOnlyResource): """Definition of Analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -206,7 +239,7 @@ class AnalysisDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the Analysis + :ivar description: Description of the Analysis. :vartype description: str """ @@ -225,12 +258,17 @@ class AnalysisDefinition(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(AnalysisDefinition, self).__init__(kind=kind, **kwargs) self.description = None -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -241,19 +279,22 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = url -class ApplicationLogsConfig(Model): +class ApplicationLogsConfig(msrest.serialization.Model): """Application logs configuration. :param file_system: Application logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2018_02_01.models.FileSystemApplicationLogsConfig - :param azure_table_storage: Application logs to azure table storage - configuration. + :type file_system: ~azure.mgmt.web.v2018_02_01.models.FileSystemApplicationLogsConfig + :param azure_table_storage: Application logs to azure table storage configuration. :type azure_table_storage: ~azure.mgmt.web.v2018_02_01.models.AzureTableStorageApplicationLogsConfig :param azure_blob_storage: Application logs to blob storage configuration. @@ -267,14 +308,21 @@ class ApplicationLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageApplicationLogsConfig'}, } - def __init__(self, *, file_system=None, azure_table_storage=None, azure_blob_storage=None, **kwargs) -> None: + def __init__( + self, + *, + file_system: Optional["FileSystemApplicationLogsConfig"] = None, + azure_table_storage: Optional["AzureTableStorageApplicationLogsConfig"] = None, + azure_blob_storage: Optional["AzureBlobStorageApplicationLogsConfig"] = None, + **kwargs + ): super(ApplicationLogsConfig, self).__init__(**kwargs) self.file_system = file_system self.azure_table_storage = azure_table_storage self.azure_blob_storage = azure_blob_storage -class ApplicationStack(Model): +class ApplicationStack(msrest.serialization.Model): """Application stack. :param name: Application stack name. @@ -284,11 +332,9 @@ class ApplicationStack(Model): :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2018_02_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2018_02_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] """ _attribute_map = { @@ -299,7 +345,16 @@ class ApplicationStack(Model): 'frameworks': {'key': 'frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, *, name: str=None, display: str=None, dependency: str=None, major_versions=None, frameworks=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional[str] = None, + dependency: Optional[str] = None, + major_versions: Optional[List["StackMajorVersion"]] = None, + frameworks: Optional[List["ApplicationStack"]] = None, + **kwargs + ): super(ApplicationStack, self).__init__(**kwargs) self.name = name self.display = display @@ -308,24 +363,55 @@ def __init__(self, *, name: str=None, display: str=None, dependency: str=None, m self.frameworks = frameworks -class AppServiceCertificate(Model): +class ApplicationStackCollection(msrest.serialization.Model): + """Collection of Application Stacks. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationStack]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ApplicationStack"], + **kwargs + ): + super(ApplicationStackCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppServiceCertificate(msrest.serialization.Model): """Key Vault container for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus """ _validation = { @@ -335,21 +421,60 @@ class AppServiceCertificate(Model): _attribute_map = { 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } - def __init__(self, *, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificate, self).__init__(**kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name self.provisioning_state = None -class Resource(Model): +class AppServiceCertificateCollection(msrest.serialization.Model): + """Collection of certificate order certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceCertificateResource"], + **kwargs + ): + super(AppServiceCertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -363,7 +488,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -383,7 +508,14 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -396,8 +528,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> Non class AppServiceCertificateOrder(Resource): """SSL certificate purchase order. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -411,63 +542,54 @@ class AppServiceCertificateOrder(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2018_02_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -477,7 +599,6 @@ class AppServiceCertificateOrder(Resource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -503,10 +624,10 @@ class AppServiceCertificateOrder(Resource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -519,7 +640,21 @@ class AppServiceCertificateOrder(Resource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, product_type, kind: str=None, tags=None, certificates=None, distinguished_name: str=None, validity_in_years: int=1, key_size: int=2048, auto_renew: bool=True, csr: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + certificates: Optional[Dict[str, "AppServiceCertificate"]] = None, + distinguished_name: Optional[str] = None, + validity_in_years: Optional[int] = 1, + key_size: Optional[int] = 2048, + product_type: Optional[Union[str, "CertificateProductType"]] = None, + auto_renew: Optional[bool] = True, + csr: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateOrder, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.certificates = certificates self.distinguished_name = distinguished_name @@ -542,14 +677,45 @@ def __init__(self, *, location: str, product_type, kind: str=None, tags=None, ce self.next_auto_renewal_time_stamp = None -class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): - """ARM resource for a certificate order that is purchased through Azure. +class AppServiceCertificateOrderCollection(msrest.serialization.Model): + """Collection of certificate orders. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateOrder]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceCertificateOrder"], + **kwargs + ): + super(AppServiceCertificateOrderCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): + """ARM resource for a certificate order that is purchased through Azure. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -559,60 +725,51 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2018_02_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2018_02_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2018_02_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -621,7 +778,6 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -645,10 +801,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -661,7 +817,19 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, product_type, kind: str=None, certificates=None, distinguished_name: str=None, validity_in_years: int=1, key_size: int=2048, auto_renew: bool=True, csr: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + certificates: Optional[Dict[str, "AppServiceCertificate"]] = None, + distinguished_name: Optional[str] = None, + validity_in_years: Optional[int] = 1, + key_size: Optional[int] = 2048, + product_type: Optional[Union[str, "CertificateProductType"]] = None, + auto_renew: Optional[bool] = True, + csr: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateOrderPatchResource, self).__init__(kind=kind, **kwargs) self.certificates = certificates self.distinguished_name = distinguished_name @@ -685,11 +853,9 @@ def __init__(self, *, product_type, kind: str=None, certificates=None, distingui class AppServiceCertificatePatchResource(ProxyOnlyResource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -703,14 +869,12 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus """ _validation = { @@ -727,10 +891,17 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, kind: str=None, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificatePatchResource, self).__init__(kind=kind, **kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name @@ -738,11 +909,9 @@ def __init__(self, *, kind: str=None, key_vault_id: str=None, key_vault_secret_n class AppServiceCertificateResource(Resource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -756,20 +925,18 @@ class AppServiceCertificateResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus """ _validation = { @@ -789,71 +956,72 @@ class AppServiceCertificateResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name self.provisioning_state = None -class AppServiceEnvironment(Model): +class AppServiceEnvironment(msrest.serialization.Model): """Description of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param name: Required. Name of the App Service Environment. :type name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param location: Required. Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :type virtual_network: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2018_02_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Required. Description of worker pools with worker size IDs, VM sizes, and + number of workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2018_02_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -861,35 +1029,29 @@ class AppServiceEnvironment(Model): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2018_02_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -897,34 +1059,31 @@ class AppServiceEnvironment(Model): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -955,13 +1114,13 @@ class AppServiceEnvironment(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, 'vnet_name': {'key': 'vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'workerPools', 'type': '[WorkerPool]'}, @@ -994,7 +1153,33 @@ class AppServiceEnvironment(Model): 'ssl_cert_key_vault_secret_name': {'key': 'sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, *, name: str, location: str, virtual_network, worker_pools, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, has_linux_workers: bool=None, ssl_cert_key_vault_id: str=None, ssl_cert_key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + location: str, + virtual_network: "VirtualNetworkProfile", + worker_pools: List["WorkerPool"], + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + has_linux_workers: Optional[bool] = None, + ssl_cert_key_vault_id: Optional[str] = None, + ssl_cert_key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceEnvironment, self).__init__(**kwargs) self.name = name self.location = location @@ -1037,14 +1222,45 @@ def __init__(self, *, name: str, location: str, virtual_network, worker_pools, v self.ssl_cert_key_vault_secret_name = ssl_cert_key_vault_secret_name -class AppServiceEnvironmentPatchResource(ProxyOnlyResource): - """ARM resource for a app service environment. +class AppServiceEnvironmentCollection(msrest.serialization.Model): + """Collection of App Service Environments. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceEnvironmentResource"], + **kwargs + ): + super(AppServiceEnvironmentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppServiceEnvironmentPatchResource(ProxyOnlyResource): + """ARM resource for a app service environment. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -1053,54 +1269,46 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_environment_patch_resource_name: Required. Name of the - App Service Environment. - :type app_service_environment_patch_resource_name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location: Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2018_02_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2018_02_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1108,35 +1316,29 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2018_02_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1144,34 +1346,31 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1179,12 +1378,8 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_environment_patch_resource_name': {'required': True}, - 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1207,15 +1402,15 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_environment_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1248,9 +1443,36 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, *, app_service_environment_patch_resource_name: str, location: str, virtual_network, worker_pools, kind: str=None, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, has_linux_workers: bool=None, ssl_cert_key_vault_id: str=None, ssl_cert_key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + location: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + virtual_network: Optional["VirtualNetworkProfile"] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + worker_pools: Optional[List["WorkerPool"]] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + has_linux_workers: Optional[bool] = None, + ssl_cert_key_vault_id: Optional[str] = None, + ssl_cert_key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceEnvironmentPatchResource, self).__init__(kind=kind, **kwargs) - self.app_service_environment_patch_resource_name = app_service_environment_patch_resource_name + self.name_properties_name = name_properties_name self.location = location self.provisioning_state = None self.status = None @@ -1294,8 +1516,7 @@ def __init__(self, *, app_service_environment_patch_resource_name: str, location class AppServiceEnvironmentResource(Resource): """App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1309,56 +1530,48 @@ class AppServiceEnvironmentResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_environment_resource_name: Required. Name of the App - Service Environment. - :type app_service_environment_resource_name: str - :param app_service_environment_resource_location: Required. Location of - the App Service Environment, e.g. "West US". - :type app_service_environment_resource_location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location_properties_location: Location of the App Service Environment, e.g. "West US". + :type location_properties_location: str + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2018_02_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2018_02_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1366,35 +1579,29 @@ class AppServiceEnvironmentResource(Resource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2018_02_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2018_02_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1402,34 +1609,31 @@ class AppServiceEnvironmentResource(Resource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1438,12 +1642,8 @@ class AppServiceEnvironmentResource(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_environment_resource_name': {'required': True}, - 'app_service_environment_resource_location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1468,15 +1668,15 @@ class AppServiceEnvironmentResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_environment_resource_name': {'key': 'properties.name', 'type': 'str'}, - 'app_service_environment_resource_location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1509,10 +1709,39 @@ class AppServiceEnvironmentResource(Resource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, *, location: str, app_service_environment_resource_name: str, app_service_environment_resource_location: str, virtual_network, worker_pools, kind: str=None, tags=None, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, has_linux_workers: bool=None, ssl_cert_key_vault_id: str=None, ssl_cert_key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + name_properties_name: Optional[str] = None, + location_properties_location: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + virtual_network: Optional["VirtualNetworkProfile"] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + worker_pools: Optional[List["WorkerPool"]] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + has_linux_workers: Optional[bool] = None, + ssl_cert_key_vault_id: Optional[str] = None, + ssl_cert_key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceEnvironmentResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_environment_resource_name = app_service_environment_resource_name - self.app_service_environment_resource_location = app_service_environment_resource_location + self.name_properties_name = name_properties_name + self.location_properties_location = location_properties_location self.provisioning_state = None self.status = None self.vnet_name = vnet_name @@ -1555,8 +1784,7 @@ def __init__(self, *, location: str, app_service_environment_resource_name: str, class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1570,66 +1798,59 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState """ _validation = { @@ -1653,8 +1874,9 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1671,12 +1893,32 @@ class AppServicePlan(Resource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, worker_tier_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, maximum_elastic_worker_count: int=None, is_spot: bool=None, spot_expiration_time=None, free_offer_expiration_time=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SkuDescription"] = None, + worker_tier_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + maximum_elastic_worker_count: Optional[int] = None, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + free_offer_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.sku = sku self.worker_tier_name = worker_tier_name self.status = None self.subscription = None @@ -1696,14 +1938,46 @@ def __init__(self, *, location: str, kind: str=None, tags=None, worker_tier_name self.target_worker_count = target_worker_count self.target_worker_size_id = target_worker_size_id self.provisioning_state = None - self.sku = sku + + +class AppServicePlanCollection(msrest.serialization.Model): + """Collection of App Service plans. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServicePlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServicePlan"], + **kwargs + ): + super(AppServicePlanCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None class AppServicePlanPatchResource(ProxyOnlyResource): """ARM resource for a app service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1713,62 +1987,55 @@ class AppServicePlanPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState """ _validation = { @@ -1790,7 +2057,7 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1807,10 +2074,27 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, kind: str=None, worker_tier_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, maximum_elastic_worker_count: int=None, is_spot: bool=None, spot_expiration_time=None, free_offer_expiration_time=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + worker_tier_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + maximum_elastic_worker_count: Optional[int] = None, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + free_offer_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlanPatchResource, self).__init__(kind=kind, **kwargs) self.worker_tier_name = worker_tier_name self.status = None @@ -1833,37 +2117,42 @@ def __init__(self, *, kind: str=None, worker_tier_name: str=None, hosting_enviro self.provisioning_state = None -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2018_02_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2018_02_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2018_02_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2018_02_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "AutoHealActionType"]] = None, + custom_action: Optional["AutoHealCustomAction"] = None, + min_process_execution_time: Optional[str] = None, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = action_type self.custom_action = custom_action self.min_process_execution_time = min_process_execution_time -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -1876,17 +2165,22 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: + def __init__( + self, + *, + exe: Optional[str] = None, + parameters: Optional[str] = None, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = exe self.parameters = parameters -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2018_02_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2018_02_01.models.AutoHealActions @@ -1897,13 +2191,19 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + triggers: Optional["AutoHealTriggers"] = None, + actions: Optional["AutoHealActions"] = None, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = triggers self.actions = actions -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -1911,11 +2211,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2018_02_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2018_02_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2018_02_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2018_02_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -1925,7 +2223,15 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: + def __init__( + self, + *, + requests: Optional["RequestsBasedTrigger"] = None, + private_bytes_in_kb: Optional[int] = None, + status_codes: Optional[List["StatusCodesBasedTrigger"]] = None, + slow_requests: Optional["SlowRequestsBasedTrigger"] = None, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = requests self.private_bytes_in_kb = private_bytes_in_kb @@ -1933,14 +2239,13 @@ def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes self.slow_requests = slow_requests -class AzureBlobStorageApplicationLogsConfig(Model): +class AzureBlobStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs azure blob storage configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2018_02_01.models.LogLevel - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. @@ -1949,30 +2254,36 @@ class AzureBlobStorageApplicationLogsConfig(Model): """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, } - def __init__(self, *, level=None, sas_url: str=None, retention_in_days: int=None, **kwargs) -> None: + def __init__( + self, + *, + level: Optional[Union[str, "LogLevel"]] = None, + sas_url: Optional[str] = None, + retention_in_days: Optional[int] = None, + **kwargs + ): super(AzureBlobStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = level self.sas_url = sas_url self.retention_in_days = retention_in_days -class AzureBlobStorageHttpLogsConfig(Model): +class AzureBlobStorageHttpLogsConfig(msrest.serialization.Model): """Http logs to azure blob storage configuration. - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -1982,37 +2293,38 @@ class AzureBlobStorageHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, sas_url: str=None, retention_in_days: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + sas_url: Optional[str] = None, + retention_in_days: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(AzureBlobStorageHttpLogsConfig, self).__init__(**kwargs) self.sas_url = sas_url self.retention_in_days = retention_in_days self.enabled = enabled -class AzureStorageInfoValue(Model): - """Azure Files or Blob Storage access information value for dictionary - storage. +class AzureStorageInfoValue(msrest.serialization.Model): + """Azure Files or Blob Storage access information value for dictionary storage. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of storage. Possible values include: 'AzureFiles', - 'AzureBlob' + :param type: Type of storage. Possible values include: "AzureFiles", "AzureBlob". :type type: str or ~azure.mgmt.web.v2018_02_01.models.AzureStorageType :param account_name: Name of the storage account. :type account_name: str - :param share_name: Name of the file share (container name, for Blob - storage). + :param share_name: Name of the file share (container name, for Blob storage). :type share_name: str :param access_key: Access key for the storage account. :type access_key: str - :param mount_path: Path to mount the storage within the site's runtime - environment. + :param mount_path: Path to mount the storage within the site's runtime environment. :type mount_path: str - :ivar state: State of the storage account. Possible values include: 'Ok', - 'InvalidCredentials', 'InvalidShare' - :vartype state: str or - ~azure.mgmt.web.v2018_02_01.models.AzureStorageState + :ivar state: State of the storage account. Possible values include: "Ok", "InvalidCredentials", + "InvalidShare". + :vartype state: str or ~azure.mgmt.web.v2018_02_01.models.AzureStorageState """ _validation = { @@ -2020,15 +2332,24 @@ class AzureStorageInfoValue(Model): } _attribute_map = { - 'type': {'key': 'type', 'type': 'AzureStorageType'}, + 'type': {'key': 'type', 'type': 'str'}, 'account_name': {'key': 'accountName', 'type': 'str'}, 'share_name': {'key': 'shareName', 'type': 'str'}, 'access_key': {'key': 'accessKey', 'type': 'str'}, 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'AzureStorageState'}, + 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, *, type=None, account_name: str=None, share_name: str=None, access_key: str=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "AzureStorageType"]] = None, + account_name: Optional[str] = None, + share_name: Optional[str] = None, + access_key: Optional[str] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(AzureStorageInfoValue, self).__init__(**kwargs) self.type = type self.account_name = account_name @@ -2041,8 +2362,7 @@ def __init__(self, *, type=None, account_name: str=None, share_name: str=None, a class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): """AzureStorageInfo dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2053,8 +2373,7 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] + :type properties: dict[str, ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] """ _validation = { @@ -2071,21 +2390,26 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{AzureStorageInfoValue}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, "AzureStorageInfoValue"]] = None, + **kwargs + ): super(AzureStoragePropertyDictionaryResource, self).__init__(kind=kind, **kwargs) self.properties = properties -class AzureTableStorageApplicationLogsConfig(Model): +class AzureTableStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs to Azure table storage configuration. All required parameters must be populated in order to send to Azure. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2018_02_01.models.LogLevel - :param sas_url: Required. SAS URL to an Azure table with add/query/delete - permissions. + :param sas_url: Required. SAS URL to an Azure table with add/query/delete permissions. :type sas_url: str """ @@ -2094,11 +2418,17 @@ class AzureTableStorageApplicationLogsConfig(Model): } _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } - def __init__(self, *, sas_url: str, level=None, **kwargs) -> None: + def __init__( + self, + *, + sas_url: str, + level: Optional[Union[str, "LogLevel"]] = None, + **kwargs + ): super(AzureTableStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = level self.sas_url = sas_url @@ -2107,8 +2437,7 @@ def __init__(self, *, sas_url: str, level=None, **kwargs) -> None: class BackupItem(ProxyOnlyResource): """Backup description. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2120,40 +2449,35 @@ class BackupItem(ProxyOnlyResource): :vartype type: str :ivar backup_id: Id of the backup. :vartype backup_id: int - :ivar storage_account_url: SAS URL for the storage account container which - contains this backup. + :ivar storage_account_url: SAS URL for the storage account container which contains this + backup. :vartype storage_account_url: str :ivar blob_name: Name of the blob which contains data for this backup. :vartype blob_name: str - :ivar backup_item_name: Name of this backup. - :vartype backup_item_name: str - :ivar status: Backup status. Possible values include: 'InProgress', - 'Failed', 'Succeeded', 'TimedOut', 'Created', 'Skipped', - 'PartiallySucceeded', 'DeleteInProgress', 'DeleteFailed', 'Deleted' - :vartype status: str or - ~azure.mgmt.web.v2018_02_01.models.BackupItemStatus + :ivar name_properties_name: Name of this backup. + :vartype name_properties_name: str + :ivar status: Backup status. Possible values include: "InProgress", "Failed", "Succeeded", + "TimedOut", "Created", "Skipped", "PartiallySucceeded", "DeleteInProgress", "DeleteFailed", + "Deleted". + :vartype status: str or ~azure.mgmt.web.v2018_02_01.models.BackupItemStatus :ivar size_in_bytes: Size of the backup in bytes. :vartype size_in_bytes: long :ivar created: Timestamp of the backup creation. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar log: Details regarding this backup. Might contain an error message. :vartype log: str :ivar databases: List of databases included in the backup. - :vartype databases: - list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] - :ivar scheduled: True if this backup has been created due to a schedule - being triggered. + :vartype databases: list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] + :ivar scheduled: True if this backup has been created due to a schedule being triggered. :vartype scheduled: bool - :ivar last_restore_time_stamp: Timestamp of a last restore operation which - used this backup. - :vartype last_restore_time_stamp: datetime + :ivar last_restore_time_stamp: Timestamp of a last restore operation which used this backup. + :vartype last_restore_time_stamp: ~datetime.datetime :ivar finished_time_stamp: Timestamp when this backup finished. - :vartype finished_time_stamp: datetime - :ivar correlation_id: Unique correlation identifier. Please use this along - with the timestamp while communicating with Azure support. + :vartype finished_time_stamp: ~datetime.datetime + :ivar correlation_id: Unique correlation identifier. Please use this along with the timestamp + while communicating with Azure support. :vartype correlation_id: str - :ivar website_size_in_bytes: Size of the original web app which has been - backed up. + :ivar website_size_in_bytes: Size of the original web app which has been backed up. :vartype website_size_in_bytes: long """ @@ -2164,7 +2488,7 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'readonly': True}, 'storage_account_url': {'readonly': True}, 'blob_name': {'readonly': True}, - 'backup_item_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'status': {'readonly': True}, 'size_in_bytes': {'readonly': True}, 'created': {'readonly': True}, @@ -2185,8 +2509,8 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'key': 'properties.id', 'type': 'int'}, 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'blob_name': {'key': 'properties.blobName', 'type': 'str'}, - 'backup_item_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'BackupItemStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, 'created': {'key': 'properties.created', 'type': 'iso-8601'}, 'log': {'key': 'properties.log', 'type': 'str'}, @@ -2198,12 +2522,17 @@ class BackupItem(ProxyOnlyResource): 'website_size_in_bytes': {'key': 'properties.websiteSizeInBytes', 'type': 'long'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(BackupItem, self).__init__(kind=kind, **kwargs) self.backup_id = None self.storage_account_url = None self.blob_name = None - self.backup_item_name = None + self.name_properties_name = None self.status = None self.size_in_bytes = None self.created = None @@ -2216,14 +2545,45 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.website_size_in_bytes = None -class BackupRequest(ProxyOnlyResource): - """Description of a backup which will be performed. +class BackupItemCollection(msrest.serialization.Model): + """Collection of backup items. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.BackupItem] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BackupItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["BackupItem"], + **kwargs + ): + super(BackupItemCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class BackupRequest(ProxyOnlyResource): + """Description of a backup which will be performed. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2234,24 +2594,21 @@ class BackupRequest(ProxyOnlyResource): :vartype type: str :param backup_name: Name of the backup. :type backup_name: str - :param enabled: True if the backup schedule is enabled (must be included - in that case), false if the backup schedule should be disabled. + :param enabled: True if the backup schedule is enabled (must be included in that case), false + if the backup schedule should be disabled. :type enabled: bool - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str - :param backup_schedule: Schedule for the backup if it is executed - periodically. + :param backup_schedule: Schedule for the backup if it is executed periodically. :type backup_schedule: ~azure.mgmt.web.v2018_02_01.models.BackupSchedule :param databases: Databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] + :type databases: list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, } _attribute_map = { @@ -2266,7 +2623,17 @@ class BackupRequest(ProxyOnlyResource): 'databases': {'key': 'properties.databases', 'type': '[DatabaseBackupSetting]'}, } - def __init__(self, *, storage_account_url: str, kind: str=None, backup_name: str=None, enabled: bool=None, backup_schedule=None, databases=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + backup_name: Optional[str] = None, + enabled: Optional[bool] = None, + storage_account_url: Optional[str] = None, + backup_schedule: Optional["BackupSchedule"] = None, + databases: Optional[List["DatabaseBackupSetting"]] = None, + **kwargs + ): super(BackupRequest, self).__init__(kind=kind, **kwargs) self.backup_name = backup_name self.enabled = enabled @@ -2275,36 +2642,29 @@ def __init__(self, *, storage_account_url: str, kind: str=None, backup_name: str self.databases = databases -class BackupSchedule(Model): - """Description of a backup schedule. Describes how often should be the backup - performed and what should be the retention policy. +class BackupSchedule(msrest.serialization.Model): + """Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param frequency_interval: Required. How often the backup should be - executed (e.g. for weekly backup, this should be set to 7 and - FrequencyUnit should be set to Day). Default value: 7 . + :param frequency_interval: Required. How often the backup should be executed (e.g. for weekly + backup, this should be set to 7 and FrequencyUnit should be set to Day). :type frequency_interval: int - :param frequency_unit: Required. The unit of time for how often the backup - should be executed (e.g. for weekly backup, this should be set to Day and - FrequencyInterval should be set to 7). Possible values include: 'Day', - 'Hour'. Default value: "Day" . - :type frequency_unit: str or - ~azure.mgmt.web.v2018_02_01.models.FrequencyUnit - :param keep_at_least_one_backup: Required. True if the retention policy - should always keep at least one backup in the storage account, regardless - how old it is; false otherwise. Default value: True . + :param frequency_unit: Required. The unit of time for how often the backup should be executed + (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). + Possible values include: "Day", "Hour". Default value: "Day". + :type frequency_unit: str or ~azure.mgmt.web.v2018_02_01.models.FrequencyUnit + :param keep_at_least_one_backup: Required. True if the retention policy should always keep at + least one backup in the storage account, regardless how old it is; false otherwise. :type keep_at_least_one_backup: bool - :param retention_period_in_days: Required. After how many days backups - should be deleted. Default value: 30 . + :param retention_period_in_days: Required. After how many days backups should be deleted. :type retention_period_in_days: int :param start_time: When the schedule should start working. - :type start_time: datetime + :type start_time: ~datetime.datetime :ivar last_execution_time: Last time when this schedule was triggered. - :vartype last_execution_time: datetime + :vartype last_execution_time: ~datetime.datetime """ _validation = { @@ -2317,14 +2677,23 @@ class BackupSchedule(Model): _attribute_map = { 'frequency_interval': {'key': 'frequencyInterval', 'type': 'int'}, - 'frequency_unit': {'key': 'frequencyUnit', 'type': 'FrequencyUnit'}, + 'frequency_unit': {'key': 'frequencyUnit', 'type': 'str'}, 'keep_at_least_one_backup': {'key': 'keepAtLeastOneBackup', 'type': 'bool'}, 'retention_period_in_days': {'key': 'retentionPeriodInDays', 'type': 'int'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, } - def __init__(self, *, frequency_interval: int=7, frequency_unit="Day", keep_at_least_one_backup: bool=True, retention_period_in_days: int=30, start_time=None, **kwargs) -> None: + def __init__( + self, + *, + frequency_interval: int = 7, + frequency_unit: Union[str, "FrequencyUnit"] = "Day", + keep_at_least_one_backup: bool = True, + retention_period_in_days: int = 30, + start_time: Optional[datetime.datetime] = None, + **kwargs + ): super(BackupSchedule, self).__init__(**kwargs) self.frequency_interval = frequency_interval self.frequency_unit = frequency_unit @@ -2335,11 +2704,9 @@ def __init__(self, *, frequency_interval: int=7, frequency_unit="Day", keep_at_l class BillingMeter(ProxyOnlyResource): - """App Service billing entity that contains information about meter which the - Azure billing system utilizes to charge users for services. + """App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2349,17 +2716,17 @@ class BillingMeter(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param meter_id: Meter GUID onboarded in Commerce + :param meter_id: Meter GUID onboarded in Commerce. :type meter_id: str - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param short_name: Short Name from App Service Azure pricing Page + :param short_name: Short Name from App Service Azure pricing Page. :type short_name: str - :param friendly_name: Friendly name of the meter + :param friendly_name: Friendly name of the meter. :type friendly_name: str - :param resource_type: App Service ResourceType meter used for + :param resource_type: App Service ResourceType meter used for. :type resource_type: str - :param os_type: App Service OS type meter used for + :param os_type: App Service OS type meter used for. :type os_type: str """ @@ -2382,7 +2749,18 @@ class BillingMeter(ProxyOnlyResource): 'os_type': {'key': 'properties.osType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, meter_id: str=None, billing_location: str=None, short_name: str=None, friendly_name: str=None, resource_type: str=None, os_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + meter_id: Optional[str] = None, + billing_location: Optional[str] = None, + short_name: Optional[str] = None, + friendly_name: Optional[str] = None, + resource_type: Optional[str] = None, + os_type: Optional[str] = None, + **kwargs + ): super(BillingMeter, self).__init__(kind=kind, **kwargs) self.meter_id = meter_id self.billing_location = billing_location @@ -2392,7 +2770,41 @@ def __init__(self, *, kind: str=None, meter_id: str=None, billing_location: str= self.os_type = os_type -class Capability(Model): +class BillingMeterCollection(msrest.serialization.Model): + """Collection of Billing Meters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.BillingMeter] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingMeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["BillingMeter"], + **kwargs + ): + super(BillingMeterCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -2409,7 +2821,14 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + reason: Optional[str] = None, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = name self.value = value @@ -2419,8 +2838,7 @@ def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwarg class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2434,7 +2852,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -2451,37 +2869,35 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -2498,7 +2914,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2531,11 +2946,24 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, *, location: str, password: str, kind: str=None, tags=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + **kwargs + ): super(Certificate, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.friendly_name = None self.subject_name = None @@ -2558,31 +2986,64 @@ def __init__(self, *, location: str, password: str, kind: str=None, tags=None, h self.server_farm_id = server_farm_id -class CertificateDetails(Model): - """SSL certificate details. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: Certificate Version. - :vartype version: int - :ivar serial_number: Certificate Serial Number. - :vartype serial_number: str - :ivar thumbprint: Certificate Thumbprint. - :vartype thumbprint: str - :ivar subject: Certificate Subject. - :vartype subject: str - :ivar not_before: Date Certificate is valid from. - :vartype not_before: datetime - :ivar not_after: Date Certificate is valid to. - :vartype not_after: datetime - :ivar signature_algorithm: Certificate Signature algorithm. - :vartype signature_algorithm: str - :ivar issuer: Certificate Issuer. - :vartype issuer: str - :ivar raw_data: Raw certificate data. - :vartype raw_data: str - """ + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Certificate"], + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificateDetails(msrest.serialization.Model): + """SSL certificate details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Certificate Version. + :vartype version: int + :ivar serial_number: Certificate Serial Number. + :vartype serial_number: str + :ivar thumbprint: Certificate Thumbprint. + :vartype thumbprint: str + :ivar subject: Certificate Subject. + :vartype subject: str + :ivar not_before: Date Certificate is valid from. + :vartype not_before: ~datetime.datetime + :ivar not_after: Date Certificate is valid to. + :vartype not_after: ~datetime.datetime + :ivar signature_algorithm: Certificate Signature algorithm. + :vartype signature_algorithm: str + :ivar issuer: Certificate Issuer. + :vartype issuer: str + :ivar raw_data: Raw certificate data. + :vartype raw_data: str + """ _validation = { 'version': {'readonly': True}, @@ -2608,7 +3069,10 @@ class CertificateDetails(Model): 'raw_data': {'key': 'rawData', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateDetails, self).__init__(**kwargs) self.version = None self.serial_number = None @@ -2624,8 +3088,7 @@ def __init__(self, **kwargs) -> None: class CertificateEmail(ProxyOnlyResource): """SSL certificate email. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2638,7 +3101,7 @@ class CertificateEmail(ProxyOnlyResource): :param email_id: Email id. :type email_id: str :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime """ _validation = { @@ -2656,7 +3119,14 @@ class CertificateEmail(ProxyOnlyResource): 'time_stamp': {'key': 'properties.timeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, email_id: str=None, time_stamp=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + email_id: Optional[str] = None, + time_stamp: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateEmail, self).__init__(kind=kind, **kwargs) self.email_id = email_id self.time_stamp = time_stamp @@ -2665,8 +3135,7 @@ def __init__(self, *, kind: str=None, email_id: str=None, time_stamp=None, **kwa class CertificateOrderAction(ProxyOnlyResource): """Certificate order action. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2676,16 +3145,14 @@ class CertificateOrderAction(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar action_type: Action type. Possible values include: - 'CertificateIssued', 'CertificateOrderCanceled', - 'CertificateOrderCreated', 'CertificateRevoked', - 'DomainValidationComplete', 'FraudDetected', 'OrgNameChange', - 'OrgValidationComplete', 'SanDrop', 'FraudCleared', 'CertificateExpired', - 'CertificateExpirationWarning', 'FraudDocumentationRequired', 'Unknown' - :vartype action_type: str or - ~azure.mgmt.web.v2018_02_01.models.CertificateOrderActionType + :ivar action_type: Action type. Possible values include: "CertificateIssued", + "CertificateOrderCanceled", "CertificateOrderCreated", "CertificateRevoked", + "DomainValidationComplete", "FraudDetected", "OrgNameChange", "OrgValidationComplete", + "SanDrop", "FraudCleared", "CertificateExpired", "CertificateExpirationWarning", + "FraudDocumentationRequired", "Unknown". + :vartype action_type: str or ~azure.mgmt.web.v2018_02_01.models.CertificateOrderActionType :ivar created_at: Time at which the certificate action was performed. - :vartype created_at: datetime + :vartype created_at: ~datetime.datetime """ _validation = { @@ -2701,11 +3168,16 @@ class CertificateOrderAction(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'action_type': {'key': 'properties.actionType', 'type': 'CertificateOrderActionType'}, + 'action_type': {'key': 'properties.actionType', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(CertificateOrderAction, self).__init__(kind=kind, **kwargs) self.action_type = None self.created_at = None @@ -2714,10 +3186,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class CertificatePatchResource(ProxyOnlyResource): """ARM resource for a certificate. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2742,37 +3211,35 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_02_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -2788,7 +3255,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2819,11 +3285,22 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + **kwargs + ): super(CertificatePatchResource, self).__init__(kind=kind, **kwargs) self.friendly_name = None self.subject_name = None @@ -2846,51 +3323,48 @@ def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: self.server_farm_id = server_farm_id -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str - :param source_web_app_location: Location of source app ex: West US or - North Europe + :param source_web_app_location: Location of source app ex: West US or North Europe. :type source_web_app_location: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str """ @@ -2912,7 +3386,22 @@ class CloningInfo(Model): 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, } - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, source_web_app_location: str=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + source_web_app_id: str, + correlation_id: Optional[str] = None, + overwrite: Optional[bool] = None, + clone_custom_host_names: Optional[bool] = None, + clone_source_control: Optional[bool] = None, + source_web_app_location: Optional[str] = None, + hosting_environment: Optional[str] = None, + app_settings_overrides: Optional[Dict[str, str]] = None, + configure_load_balancing: Optional[bool] = None, + traffic_manager_profile_id: Optional[str] = None, + traffic_manager_profile_name: Optional[str] = None, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = correlation_id self.overwrite = overwrite @@ -2927,19 +3416,40 @@ def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrit self.traffic_manager_profile_name = traffic_manager_profile_name -class CloudError(Model): - """CloudError. +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned 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(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + class ConnectionStringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2950,8 +3460,7 @@ class ConnectionStringDictionary(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.ConnStringValueTypePair] + :type properties: dict[str, ~azure.mgmt.web.v2018_02_01.models.ConnStringValueTypePair] """ _validation = { @@ -2968,47 +3477,60 @@ class ConnectionStringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{ConnStringValueTypePair}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, "ConnStringValueTypePair"]] = None, + **kwargs + ): super(ConnectionStringDictionary, self).__init__(kind=kind, **kwargs) self.properties = properties -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2018_02_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + connection_string: Optional[str] = None, + type: Optional[Union[str, "ConnectionStringType"]] = None, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = name self.connection_string = connection_string self.type = type -class ConnStringValueTypePair(Model): +class ConnStringValueTypePair(msrest.serialization.Model): """Database connection string value to type pair. All required parameters must be populated in order to send to Azure. :param value: Required. Value of pair. :type value: str - :param type: Required. Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Required. Type of database. Possible values include: "MySql", "SQLServer", + "SQLAzure", "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", + "RedisCache", "PostgreSQL". :type type: str or ~azure.mgmt.web.v2018_02_01.models.ConnectionStringType """ @@ -3019,20 +3541,24 @@ class ConnStringValueTypePair(Model): _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, value: str, type, **kwargs) -> None: + def __init__( + self, + *, + value: str, + type: Union[str, "ConnectionStringType"], + **kwargs + ): super(ConnStringValueTypePair, self).__init__(**kwargs) self.value = value self.type = type -class Contact(Model): - """Contact information for domain registration. If 'Domain Privacy' option is - not selected then the contact information is made publicly available - through the Whois - directories as per ICANN requirements. +class Contact(msrest.serialization.Model): + """Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information is made publicly available through the Whois +directories as per ICANN requirements. All required parameters must be populated in order to send to Azure. @@ -3075,7 +3601,20 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, email: str, name_first: str, name_last: str, phone: str, address_mailing=None, fax: str=None, job_title: str=None, name_middle: str=None, organization: str=None, **kwargs) -> None: + def __init__( + self, + *, + email: str, + name_first: str, + name_last: str, + phone: str, + address_mailing: Optional["Address"] = None, + fax: Optional[str] = None, + job_title: Optional[str] = None, + name_middle: Optional[str] = None, + organization: Optional[str] = None, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.address_mailing = address_mailing self.email = email @@ -3091,8 +3630,7 @@ def __init__(self, *, email: str, name_first: str, name_last: str, phone: str, a class ContinuousWebJob(ProxyOnlyResource): """Continuous Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3102,10 +3640,9 @@ class ContinuousWebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param status: Job status. Possible values include: 'Initializing', - 'Starting', 'Running', 'PendingRestart', 'Stopped' - :type status: str or - ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobStatus + :param status: Job status. Possible values include: "Initializing", "Starting", "Running", + "PendingRestart", "Stopped". + :type status: str or ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobStatus :param detailed_status: Detailed status. :type detailed_status: str :param log_url: Log URL. @@ -3116,12 +3653,11 @@ class ContinuousWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2018_02_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -3138,19 +3674,34 @@ class ContinuousWebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ContinuousWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'detailed_status': {'key': 'properties.detailed_status', 'type': 'str'}, 'log_url': {'key': 'properties.log_url', 'type': 'str'}, 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, status=None, detailed_status: str=None, log_url: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, web_job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + status: Optional[Union[str, "ContinuousWebJobStatus"]] = None, + detailed_status: Optional[str] = None, + log_url: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + web_job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(ContinuousWebJob, self).__init__(kind=kind, **kwargs) self.status = status self.detailed_status = detailed_status @@ -3164,15 +3715,49 @@ def __init__(self, *, kind: str=None, status=None, detailed_status: str=None, lo self.settings = settings -class CorsSettings(Model): +class ContinuousWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContinuousWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ContinuousWebJob"], + **kwargs + ): + super(ContinuousWebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] - :param support_credentials: Gets or sets whether CORS requests with - credentials are allowed. See + :param support_credentials: Gets or sets whether CORS requests with credentials are allowed. + See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials for more details. :type support_credentials: bool @@ -3183,15 +3768,20 @@ class CorsSettings(Model): 'support_credentials': {'key': 'supportCredentials', 'type': 'bool'}, } - def __init__(self, *, allowed_origins=None, support_credentials: bool=None, **kwargs) -> None: + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + support_credentials: Optional[bool] = None, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.support_credentials = support_credentials -class CsmMoveResourceEnvelope(Model): - """Object with a list of the resources that need to be moved and the resource - group they should be moved to. +class CsmMoveResourceEnvelope(msrest.serialization.Model): + """Object with a list of the resources that need to be moved and the resource group they should be moved to. :param target_resource_group: :type target_resource_group: str @@ -3208,24 +3798,63 @@ class CsmMoveResourceEnvelope(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, *, target_resource_group: str=None, resources=None, **kwargs) -> None: + def __init__( + self, + *, + target_resource_group: Optional[str] = None, + resources: Optional[List[str]] = None, + **kwargs + ): super(CsmMoveResourceEnvelope, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources -class CsmOperationDescription(Model): +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmOperationDescription"], + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2018_02_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -3235,7 +3864,15 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["CsmOperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["CsmOperationDescriptionProperties"] = None, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = name self.display = display @@ -3243,24 +3880,29 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties self.properties = properties -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2018_02_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2018_02_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = service_specification -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -3280,7 +3922,15 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3288,17 +3938,15 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class CsmPublishingProfileOptions(Model): +class CsmPublishingProfileOptions(msrest.serialization.Model): """Publishing options for requested profile. :param format: Name of the format. Valid values are: FileZilla3 WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2018_02_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the DisasterRecover - endpoint if true + Ftp. Possible values include: "FileZilla3", "WebDeploy", "Ftp". + :type format: str or ~azure.mgmt.web.v2018_02_01.models.PublishingProfileFormat + :param include_disaster_recovery_endpoints: Include the DisasterRecover endpoint if true. :type include_disaster_recovery_endpoints: bool """ @@ -3307,22 +3955,27 @@ class CsmPublishingProfileOptions(Model): 'include_disaster_recovery_endpoints': {'key': 'includeDisasterRecoveryEndpoints', 'type': 'bool'}, } - def __init__(self, *, format=None, include_disaster_recovery_endpoints: bool=None, **kwargs) -> None: + def __init__( + self, + *, + format: Optional[Union[str, "PublishingProfileFormat"]] = None, + include_disaster_recovery_endpoints: Optional[bool] = None, + **kwargs + ): super(CsmPublishingProfileOptions, self).__init__(**kwargs) self.format = format self.include_disaster_recovery_endpoints = include_disaster_recovery_endpoints -class CsmSlotEntity(Model): +class CsmSlotEntity(msrest.serialization.Model): """Deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during swap - operation. + :param target_slot: Required. Destination deployment slot during swap operation. :type target_slot: str - :param preserve_vnet: Required. true to preserve Virtual - Network to the slot during swap; otherwise, false. + :param preserve_vnet: Required. :code:`true` to preserve Virtual Network to the + slot during swap; otherwise, :code:`false`. :type preserve_vnet: bool """ @@ -3336,19 +3989,25 @@ class CsmSlotEntity(Model): 'preserve_vnet': {'key': 'preserveVnet', 'type': 'bool'}, } - def __init__(self, *, target_slot: str, preserve_vnet: bool, **kwargs) -> None: + def __init__( + self, + *, + target_slot: str, + preserve_vnet: bool, + **kwargs + ): super(CsmSlotEntity, self).__init__(**kwargs) self.target_slot = target_slot self.preserve_vnet = preserve_vnet -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -3365,7 +4024,16 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=None, limit: int=None, name=None, **kwargs) -> None: + def __init__( + self, + *, + unit: Optional[str] = None, + next_reset_time: Optional[datetime.datetime] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["LocalizableString"] = None, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = unit self.next_reset_time = next_reset_time @@ -3374,11 +4042,44 @@ def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=N self.name = name +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmUsageQuota"], + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class CustomHostnameAnalysisResult(ProxyOnlyResource): """Custom domain analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3388,25 +4089,25 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar is_hostname_already_verified: true if hostname is - already verified; otherwise, false. + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. - Possible values include: 'Passed', 'Failed', 'Skipped' + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.web.v2018_02_01.models.DnsVerificationTestResult - :ivar custom_domain_verification_failure_info: Raw failure information if - DNS verification fails. + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. :vartype custom_domain_verification_failure_info: ~azure.mgmt.web.v2018_02_01.models.ErrorEntity - :ivar has_conflict_on_scale_unit: true if there is a conflict - on a scale unit; otherwise, false. + :ivar has_conflict_on_scale_unit: :code:`true` if there is a conflict on a scale + unit; otherwise, :code:`false`. :vartype has_conflict_on_scale_unit: bool - :ivar has_conflict_across_subscription: true if there is a - conflict across subscriptions; otherwise, false. + :ivar has_conflict_across_subscription: :code:`true` if there is a conflict across + subscriptions; otherwise, :code:`false`. :vartype has_conflict_across_subscription: bool - :ivar conflicting_app_resource_id: Name of the conflicting app on scale - unit if it's within the same subscription. + :ivar conflicting_app_resource_id: Name of the conflicting app on scale unit if it's within the + same subscription. :vartype conflicting_app_resource_id: str :param c_name_records: CName records controller can see for this hostname. :type c_name_records: list[str] @@ -3414,11 +4115,9 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type txt_records: list[str] :param a_records: A records controller can see for this hostname. :type a_records: list[str] - :param alternate_cname_records: Alternate CName records controller can see - for this hostname. - :type alternate_cname_records: list[str] - :param alternate_txt_records: Alternate TXT records controller can see for - this hostname. + :param alternate_c_name_records: Alternate CName records controller can see for this hostname. + :type alternate_c_name_records: list[str] + :param alternate_txt_records: Alternate TXT records controller can see for this hostname. :type alternate_txt_records: list[str] """ @@ -3440,7 +4139,7 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'DnsVerificationTestResult'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'ErrorEntity'}, 'has_conflict_on_scale_unit': {'key': 'properties.hasConflictOnScaleUnit', 'type': 'bool'}, 'has_conflict_across_subscription': {'key': 'properties.hasConflictAcrossSubscription', 'type': 'bool'}, @@ -3448,11 +4147,21 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_cname_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, } - def __init__(self, *, kind: str=None, c_name_records=None, txt_records=None, a_records=None, alternate_cname_records=None, alternate_txt_records=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + c_name_records: Optional[List[str]] = None, + txt_records: Optional[List[str]] = None, + a_records: Optional[List[str]] = None, + alternate_c_name_records: Optional[List[str]] = None, + alternate_txt_records: Optional[List[str]] = None, + **kwargs + ): super(CustomHostnameAnalysisResult, self).__init__(kind=kind, **kwargs) self.is_hostname_already_verified = None self.custom_domain_verification_test = None @@ -3463,28 +4172,27 @@ def __init__(self, *, kind: str=None, c_name_records=None, txt_records=None, a_r self.c_name_records = c_name_records self.txt_records = txt_records self.a_records = a_records - self.alternate_cname_records = alternate_cname_records + self.alternate_c_name_records = alternate_c_name_records self.alternate_txt_records = alternate_txt_records -class DatabaseBackupSetting(Model): +class DatabaseBackupSetting(msrest.serialization.Model): """Database backup settings. All required parameters must be populated in order to send to Azure. - :param database_type: Required. Database type (e.g. SqlAzure / MySql). - Possible values include: 'SqlAzure', 'MySql', 'LocalMySql', 'PostgreSql' - :type database_type: str or - ~azure.mgmt.web.v2018_02_01.models.DatabaseType + :param database_type: Required. Database type (e.g. SqlAzure / MySql). Possible values include: + "SqlAzure", "MySql", "LocalMySql", "PostgreSql". + :type database_type: str or ~azure.mgmt.web.v2018_02_01.models.DatabaseType :param name: :type name: str - :param connection_string_name: Contains a connection string name that is - linked to the SiteConfig.ConnectionStrings. + :param connection_string_name: Contains a connection string name that is linked to the + SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. :type connection_string_name: str - :param connection_string: Contains a connection string to a database which - is being backed up or restored. If the restore should happen to a new - database, the database name inside is the new one. + :param connection_string: Contains a connection string to a database which is being backed up + or restored. If the restore should happen to a new database, the database name inside is the + new one. :type connection_string: str """ @@ -3499,7 +4207,15 @@ class DatabaseBackupSetting(Model): 'connection_string': {'key': 'connectionString', 'type': 'str'}, } - def __init__(self, *, database_type, name: str=None, connection_string_name: str=None, connection_string: str=None, **kwargs) -> None: + def __init__( + self, + *, + database_type: Union[str, "DatabaseType"], + name: Optional[str] = None, + connection_string_name: Optional[str] = None, + connection_string: Optional[str] = None, + **kwargs + ): super(DatabaseBackupSetting, self).__init__(**kwargs) self.database_type = database_type self.name = name @@ -3507,14 +4223,13 @@ def __init__(self, *, database_type, name: str=None, connection_string_name: str self.connection_string = connection_string -class DataSource(Model): +class DataSource(msrest.serialization.Model): """Class representing data source used by the detectors. - :param instructions: Instructions if any for the data source + :param instructions: Instructions if any for the data source. :type instructions: list[str] - :param data_source_uri: Datasource Uri Links - :type data_source_uri: - list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] + :param data_source_uri: Datasource Uri Links. + :type data_source_uri: list[~azure.mgmt.web.v2018_02_01.models.NameValuePair] """ _attribute_map = { @@ -3522,20 +4237,26 @@ class DataSource(Model): 'data_source_uri': {'key': 'dataSourceUri', 'type': '[NameValuePair]'}, } - def __init__(self, *, instructions=None, data_source_uri=None, **kwargs) -> None: + def __init__( + self, + *, + instructions: Optional[List[str]] = None, + data_source_uri: Optional[List["NameValuePair"]] = None, + **kwargs + ): super(DataSource, self).__init__(**kwargs) self.instructions = instructions self.data_source_uri = data_source_uri -class DataTableResponseColumn(Model): +class DataTableResponseColumn(msrest.serialization.Model): """Column definition. - :param column_name: Name of the column + :param column_name: Name of the column. :type column_name: str :param data_type: Data type which looks like 'String' or 'Int32'. :type data_type: str - :param column_type: Column Type + :param column_type: Column Type. :type column_type: str """ @@ -3545,22 +4266,28 @@ class DataTableResponseColumn(Model): 'column_type': {'key': 'columnType', 'type': 'str'}, } - def __init__(self, *, column_name: str=None, data_type: str=None, column_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + column_name: Optional[str] = None, + data_type: Optional[str] = None, + column_type: Optional[str] = None, + **kwargs + ): super(DataTableResponseColumn, self).__init__(**kwargs) self.column_name = column_name self.data_type = data_type self.column_type = column_type -class DataTableResponseObject(Model): +class DataTableResponseObject(msrest.serialization.Model): """Data Table which defines columns and raw row values. - :param table_name: Name of the table + :param table_name: Name of the table. :type table_name: str - :param columns: List of columns with data types - :type columns: - list[~azure.mgmt.web.v2018_02_01.models.DataTableResponseColumn] - :param rows: Raw row values + :param columns: List of columns with data types. + :type columns: list[~azure.mgmt.web.v2018_02_01.models.DataTableResponseColumn] + :param rows: Raw row values. :type rows: list[list[str]] """ @@ -3570,22 +4297,27 @@ class DataTableResponseObject(Model): 'rows': {'key': 'rows', 'type': '[[str]]'}, } - def __init__(self, *, table_name: str=None, columns=None, rows=None, **kwargs) -> None: + def __init__( + self, + *, + table_name: Optional[str] = None, + columns: Optional[List["DataTableResponseColumn"]] = None, + rows: Optional[List[List[str]]] = None, + **kwargs + ): super(DataTableResponseObject, self).__init__(**kwargs) self.table_name = table_name self.columns = columns self.rows = rows -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseError """ _validation = { @@ -3596,28 +4328,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -3626,8 +4348,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2018_02_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -3647,7 +4368,12 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, *, details=None, **kwargs) -> None: + def __init__( + self, + *, + details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -3656,11 +4382,10 @@ def __init__(self, *, details=None, **kwargs) -> None: self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -3682,7 +4407,10 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None @@ -3692,8 +4420,7 @@ def __init__(self, **kwargs) -> None: class DeletedAppRestoreRequest(ProxyOnlyResource): """Details about restoring a deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3704,17 +4431,16 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param deleted_site_id: ARM resource ID of the deleted app. Example: - /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}. :type deleted_site_id: str - :param recover_configuration: If true, deleted site configuration, in - addition to content, will be restored. + :param recover_configuration: If true, deleted site configuration, in addition to content, will + be restored. :type recover_configuration: bool - :param snapshot_time: Point in time to restore the deleted app from, - formatted as a DateTime string. + :param snapshot_time: Point in time to restore the deleted app from, formatted as a DateTime + string. If unspecified, default value is the time that the app was deleted. :type snapshot_time: str - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -3735,7 +4461,16 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, deleted_site_id: str=None, recover_configuration: bool=None, snapshot_time: str=None, use_dr_secondary: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + deleted_site_id: Optional[str] = None, + recover_configuration: Optional[bool] = None, + snapshot_time: Optional[str] = None, + use_dr_secondary: Optional[bool] = None, + **kwargs + ): super(DeletedAppRestoreRequest, self).__init__(kind=kind, **kwargs) self.deleted_site_id = deleted_site_id self.recover_configuration = recover_configuration @@ -3746,8 +4481,7 @@ def __init__(self, *, kind: str=None, deleted_site_id: str=None, recover_configu class DeletedSite(ProxyOnlyResource): """A deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3757,21 +4491,21 @@ class DeletedSite(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deleted_site_id: Numeric id for the deleted site + :ivar deleted_site_id: Numeric id for the deleted site. :vartype deleted_site_id: int :ivar deleted_timestamp: Time in UTC when the app was deleted. :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site + :ivar subscription: Subscription containing the deleted site. :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site + :ivar resource_group: ResourceGroup that contained the deleted site. :vartype resource_group: str - :ivar deleted_site_name: Name of the deleted site + :ivar deleted_site_name: Name of the deleted site. :vartype deleted_site_name: str - :ivar slot: Slot of the deleted site + :ivar slot: Slot of the deleted site. :vartype slot: str - :ivar deleted_site_kind: Kind of site that was deleted - :vartype deleted_site_kind: str - :ivar geo_region_name: Geo Region of the deleted site + :ivar kind_properties_kind: Kind of site that was deleted. + :vartype kind_properties_kind: str + :ivar geo_region_name: Geo Region of the deleted site. :vartype geo_region_name: str """ @@ -3785,7 +4519,7 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'readonly': True}, 'deleted_site_name': {'readonly': True}, 'slot': {'readonly': True}, - 'deleted_site_kind': {'readonly': True}, + 'kind_properties_kind': {'readonly': True}, 'geo_region_name': {'readonly': True}, } @@ -3800,11 +4534,16 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, 'deleted_site_name': {'key': 'properties.deletedSiteName', 'type': 'str'}, 'slot': {'key': 'properties.slot', 'type': 'str'}, - 'deleted_site_kind': {'key': 'properties.kind', 'type': 'str'}, + 'kind_properties_kind': {'key': 'properties.kind', 'type': 'str'}, 'geo_region_name': {'key': 'properties.geoRegionName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DeletedSite, self).__init__(kind=kind, **kwargs) self.deleted_site_id = None self.deleted_timestamp = None @@ -3812,15 +4551,48 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.resource_group = None self.deleted_site_name = None self.slot = None - self.deleted_site_kind = None + self.kind_properties_kind = None self.geo_region_name = None +class DeletedWebAppCollection(msrest.serialization.Model): + """Collection of deleted apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DeletedSite] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DeletedSite"], + **kwargs + ): + super(DeletedWebAppCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class Deployment(ProxyOnlyResource): """User credentials used for publishing activity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3841,11 +4613,11 @@ class Deployment(ProxyOnlyResource): :param author_email: Author email. :type author_email: str :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime - :param active: True if deployment is currently active, false if completed - and null if not started. + :type end_time: ~datetime.datetime + :param active: True if deployment is currently active, false if completed and null if not + started. :type active: bool :param details: Details on deployment. :type details: str @@ -3873,7 +4645,21 @@ class Deployment(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, *, kind: str=None, status: int=None, message: str=None, author: str=None, deployer: str=None, author_email: str=None, start_time=None, end_time=None, active: bool=None, details: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + status: Optional[int] = None, + message: Optional[str] = None, + author: Optional[str] = None, + deployer: Optional[str] = None, + author_email: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + active: Optional[bool] = None, + details: Optional[str] = None, + **kwargs + ): super(Deployment, self).__init__(kind=kind, **kwargs) self.status = status self.message = message @@ -3886,18 +4672,51 @@ def __init__(self, *, kind: str=None, status: int=None, message: str=None, autho self.details = details -class DeploymentLocations(Model): +class DeploymentCollection(msrest.serialization.Model): + """Collection of app deployments. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Deployment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Deployment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Deployment"], + **kwargs + ): + super(DeploymentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentLocations(msrest.serialization.Model): """List of available locations (regions or App Service Environments) for - deployment of App Service resources. +deployment of App Service resources. :param locations: Available regions. :type locations: list[~azure.mgmt.web.v2018_02_01.models.GeoRegion] - :param hosting_environments: Available App Service Environments with full - descriptions of the environments. - :type hosting_environments: - list[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironment] - :param hosting_environment_deployment_infos: Available App Service - Environments with basic information. + :param hosting_environments: Available App Service Environments with full descriptions of the + environments. + :type hosting_environments: list[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironment] + :param hosting_environment_deployment_infos: Available App Service Environments with basic + information. :type hosting_environment_deployment_infos: list[~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDeploymentInfo] """ @@ -3908,34 +4727,40 @@ class DeploymentLocations(Model): 'hosting_environment_deployment_infos': {'key': 'hostingEnvironmentDeploymentInfos', 'type': '[HostingEnvironmentDeploymentInfo]'}, } - def __init__(self, *, locations=None, hosting_environments=None, hosting_environment_deployment_infos=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List["GeoRegion"]] = None, + hosting_environments: Optional[List["AppServiceEnvironment"]] = None, + hosting_environment_deployment_infos: Optional[List["HostingEnvironmentDeploymentInfo"]] = None, + **kwargs + ): super(DeploymentLocations, self).__init__(**kwargs) self.locations = locations self.hosting_environments = hosting_environments self.hosting_environment_deployment_infos = hosting_environment_deployment_infos -class DetectorAbnormalTimePeriod(Model): +class DetectorAbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period detected. - :param start_time: Start time of the correlated event - :type start_time: datetime - :param end_time: End time of the correlated event - :type end_time: datetime - :param message: Message describing the event + :param start_time: Start time of the correlated event. + :type start_time: ~datetime.datetime + :param end_time: End time of the correlated event. + :type end_time: ~datetime.datetime + :param message: Message describing the event. :type message: str - :param source: Represents the name of the Detector + :param source: Represents the name of the Detector. :type source: str - :param priority: Represents the rank of the Detector + :param priority: Represents the rank of the Detector. :type priority: float - :param meta_data: Downtime metadata - :type meta_data: - list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] - :param type: Represents the type of the Detector. Possible values include: - 'ServiceIncident', 'AppDeployment', 'AppCrash', 'RuntimeIssueDetected', - 'AseDeployment', 'UserIssue', 'PlatformIssue', 'Other' + :param meta_data: Downtime metadata. + :type meta_data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] + :param type: Represents the type of the Detector. Possible values include: "ServiceIncident", + "AppDeployment", "AppCrash", "RuntimeIssueDetected", "AseDeployment", "UserIssue", + "PlatformIssue", "Other". :type type: str or ~azure.mgmt.web.v2018_02_01.models.IssueType - :param solutions: List of proposed solutions + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2018_02_01.models.Solution] """ @@ -3946,11 +4771,23 @@ class DetectorAbnormalTimePeriod(Model): 'source': {'key': 'source', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'float'}, 'meta_data': {'key': 'metaData', 'type': '[[NameValuePair]]'}, - 'type': {'key': 'type', 'type': 'IssueType'}, + 'type': {'key': 'type', 'type': 'str'}, 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, *, start_time=None, end_time=None, message: str=None, source: str=None, priority: float=None, meta_data=None, type=None, solutions=None, **kwargs) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + message: Optional[str] = None, + source: Optional[str] = None, + priority: Optional[float] = None, + meta_data: Optional[List[List["NameValuePair"]]] = None, + type: Optional[Union[str, "IssueType"]] = None, + solutions: Optional[List["Solution"]] = None, + **kwargs + ): super(DetectorAbnormalTimePeriod, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -3965,8 +4802,7 @@ def __init__(self, *, start_time=None, end_time=None, message: str=None, source: class DetectorDefinition(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3976,11 +4812,11 @@ class DetectorDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar display_name: Display name of the detector + :ivar display_name: Display name of the detector. :vartype display_name: str - :ivar description: Description of the detector + :ivar description: Description of the detector. :vartype description: str - :ivar rank: Detector Rank + :ivar rank: Detector Rank. :vartype rank: float :ivar is_enabled: Flag representing whether detector is enabled or not. :vartype is_enabled: bool @@ -4007,7 +4843,12 @@ class DetectorDefinition(ProxyOnlyResource): 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DetectorDefinition, self).__init__(kind=kind, **kwargs) self.display_name = None self.description = None @@ -4015,19 +4856,18 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.is_enabled = None -class DetectorInfo(Model): +class DetectorInfo(msrest.serialization.Model): """Definition of Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Short description of the detector and its purpose + :ivar description: Short description of the detector and its purpose. :vartype description: str - :ivar category: Support Category + :ivar category: Support Category. :vartype category: str - :ivar sub_category: Support Sub Category + :ivar sub_category: Support Sub Category. :vartype sub_category: str - :ivar support_topic_id: Support Topic Id + :ivar support_topic_id: Support Topic Id. :vartype support_topic_id: str """ @@ -4045,7 +4885,10 @@ class DetectorInfo(Model): 'support_topic_id': {'key': 'supportTopicId', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DetectorInfo, self).__init__(**kwargs) self.description = None self.category = None @@ -4056,8 +4899,7 @@ def __init__(self, **kwargs) -> None: class DetectorResponse(ProxyOnlyResource): """Class representing Response from Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4067,9 +4909,9 @@ class DetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param metadata: metadata for the detector + :param metadata: metadata for the detector. :type metadata: ~azure.mgmt.web.v2018_02_01.models.DetectorInfo - :param dataset: Data Set + :param dataset: Data Set. :type dataset: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticData] """ @@ -4088,17 +4930,57 @@ class DetectorResponse(ProxyOnlyResource): 'dataset': {'key': 'properties.dataset', 'type': '[DiagnosticData]'}, } - def __init__(self, *, kind: str=None, metadata=None, dataset=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + metadata: Optional["DetectorInfo"] = None, + dataset: Optional[List["DiagnosticData"]] = None, + **kwargs + ): super(DetectorResponse, self).__init__(kind=kind, **kwargs) self.metadata = metadata self.dataset = dataset +class DetectorResponseCollection(msrest.serialization.Model): + """Collection of detector responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DetectorResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DetectorResponse"], + **kwargs + ): + super(DetectorResponseCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticAnalysis(ProxyOnlyResource): """Class representing a diagnostic analysis done on an application. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4108,19 +4990,16 @@ class DiagnosticAnalysis(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param abnormal_time_periods: List of time periods. - :type abnormal_time_periods: - list[~azure.mgmt.web.v2018_02_01.models.AbnormalTimePeriod] - :param payload: Data by each detector + :type abnormal_time_periods: list[~azure.mgmt.web.v2018_02_01.models.AbnormalTimePeriod] + :param payload: Data by each detector. :type payload: list[~azure.mgmt.web.v2018_02_01.models.AnalysisData] - :param non_correlated_detectors: Data by each detector for detectors that - did not corelate - :type non_correlated_detectors: - list[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] + :param non_correlated_detectors: Data by each detector for detectors that did not corelate. + :type non_correlated_detectors: list[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] """ _validation = { @@ -4141,7 +5020,17 @@ class DiagnosticAnalysis(ProxyOnlyResource): 'non_correlated_detectors': {'key': 'properties.nonCorrelatedDetectors', 'type': '[DetectorDefinition]'}, } - def __init__(self, *, kind: str=None, start_time=None, end_time=None, abnormal_time_periods=None, payload=None, non_correlated_detectors=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + abnormal_time_periods: Optional[List["AbnormalTimePeriod"]] = None, + payload: Optional[List["AnalysisData"]] = None, + non_correlated_detectors: Optional[List["DetectorDefinition"]] = None, + **kwargs + ): super(DiagnosticAnalysis, self).__init__(kind=kind, **kwargs) self.start_time = start_time self.end_time = end_time @@ -4150,11 +5039,44 @@ def __init__(self, *, kind: str=None, start_time=None, end_time=None, abnormal_t self.non_correlated_detectors = non_correlated_detectors +class DiagnosticAnalysisCollection(msrest.serialization.Model): + """Collection of Diagnostic Analyses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.AnalysisDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AnalysisDefinition"], + **kwargs + ): + super(DiagnosticAnalysisCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticCategory(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4164,7 +5086,7 @@ class DiagnosticCategory(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the diagnostic category + :ivar description: Description of the diagnostic category. :vartype description: str """ @@ -4183,18 +5105,56 @@ class DiagnosticCategory(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DiagnosticCategory, self).__init__(kind=kind, **kwargs) self.description = None -class DiagnosticData(Model): +class DiagnosticCategoryCollection(msrest.serialization.Model): + """Collection of Diagnostic Categories. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticCategory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiagnosticCategory"], + **kwargs + ): + super(DiagnosticCategoryCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DiagnosticData(msrest.serialization.Model): """Set of data with rendering instructions. - :param table: Data in table form + :param table: Data in table form. :type table: ~azure.mgmt.web.v2018_02_01.models.DataTableResponseObject - :param rendering_properties: Properties that describe how the table should - be rendered + :param rendering_properties: Properties that describe how the table should be rendered. :type rendering_properties: ~azure.mgmt.web.v2018_02_01.models.Rendering """ @@ -4203,17 +5163,56 @@ class DiagnosticData(Model): 'rendering_properties': {'key': 'renderingProperties', 'type': 'Rendering'}, } - def __init__(self, *, table=None, rendering_properties=None, **kwargs) -> None: + def __init__( + self, + *, + table: Optional["DataTableResponseObject"] = None, + rendering_properties: Optional["Rendering"] = None, + **kwargs + ): super(DiagnosticData, self).__init__(**kwargs) self.table = table self.rendering_properties = rendering_properties +class DiagnosticDetectorCollection(msrest.serialization.Model): + """Collection of Diagnostic Detectors. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DetectorDefinition"], + **kwargs + ): + super(DiagnosticDetectorCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticDetectorResponse(ProxyOnlyResource): """Class representing Response from Diagnostic Detectors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4223,27 +5222,23 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param issue_detected: Flag representing Issue was detected. :type issue_detected: bool - :param detector_definition: Detector's definition - :type detector_definition: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition - :param metrics: Metrics provided by the detector - :type metrics: - list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] - :param abnormal_time_periods: List of Correlated events found by the - detector + :param detector_definition: Detector's definition. + :type detector_definition: ~azure.mgmt.web.v2018_02_01.models.DetectorDefinition + :param metrics: Metrics provided by the detector. + :type metrics: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSet] + :param abnormal_time_periods: List of Correlated events found by the detector. :type abnormal_time_periods: list[~azure.mgmt.web.v2018_02_01.models.DetectorAbnormalTimePeriod] :param data: Additional Data that detector wants to send. :type data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] - :param response_meta_data: Meta Data - :type response_meta_data: - ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData + :param response_meta_data: Meta Data. + :type response_meta_data: ~azure.mgmt.web.v2018_02_01.models.ResponseMetaData """ _validation = { @@ -4267,7 +5262,20 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): 'response_meta_data': {'key': 'properties.responseMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, *, kind: str=None, start_time=None, end_time=None, issue_detected: bool=None, detector_definition=None, metrics=None, abnormal_time_periods=None, data=None, response_meta_data=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + issue_detected: Optional[bool] = None, + detector_definition: Optional["DetectorDefinition"] = None, + metrics: Optional[List["DiagnosticMetricSet"]] = None, + abnormal_time_periods: Optional[List["DetectorAbnormalTimePeriod"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + response_meta_data: Optional["ResponseMetaData"] = None, + **kwargs + ): super(DiagnosticDetectorResponse, self).__init__(kind=kind, **kwargs) self.start_time = start_time self.end_time = end_time @@ -4279,28 +5287,24 @@ def __init__(self, *, kind: str=None, start_time=None, end_time=None, issue_dete self.response_meta_data = response_meta_data -class DiagnosticMetricSample(Model): +class DiagnosticMetricSample(msrest.serialization.Model): """Class representing Diagnostic Metric. - :param timestamp: Time at which metric is measured - :type timestamp: datetime - :param role_instance: Role Instance. Null if this counter is not per - instance - This is returned and should be whichever instance name we desire to be - returned + :param timestamp: Time at which metric is measured. + :type timestamp: ~datetime.datetime + :param role_instance: Role Instance. Null if this counter is not per instance + This is returned and should be whichever instance name we desire to be returned i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) - where RDWORKERNAME is Machine name below and RoleInstance name in - parenthesis + where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis. :type role_instance: str - :param total: Total value of the metric. If multiple measurements are made - this will have sum of all. + :param total: Total value of the metric. If multiple measurements are made this will have sum + of all. :type total: float - :param maximum: Maximum of the metric sampled during the time period + :param maximum: Maximum of the metric sampled during the time period. :type maximum: float - :param minimum: Minimum of the metric sampled during the time period + :param minimum: Minimum of the metric sampled during the time period. :type minimum: float - :param is_aggregated: Whether the values are aggregates across all workers - or not + :param is_aggregated: Whether the values are aggregates across all workers or not. :type is_aggregated: bool """ @@ -4313,7 +5317,17 @@ class DiagnosticMetricSample(Model): 'is_aggregated': {'key': 'isAggregated', 'type': 'bool'}, } - def __init__(self, *, timestamp=None, role_instance: str=None, total: float=None, maximum: float=None, minimum: float=None, is_aggregated: bool=None, **kwargs) -> None: + def __init__( + self, + *, + timestamp: Optional[datetime.datetime] = None, + role_instance: Optional[str] = None, + total: Optional[float] = None, + maximum: Optional[float] = None, + minimum: Optional[float] = None, + is_aggregated: Optional[bool] = None, + **kwargs + ): super(DiagnosticMetricSample, self).__init__(**kwargs) self.timestamp = timestamp self.role_instance = role_instance @@ -4323,25 +5337,22 @@ def __init__(self, *, timestamp=None, role_instance: str=None, total: float=None self.is_aggregated = is_aggregated -class DiagnosticMetricSet(Model): +class DiagnosticMetricSet(msrest.serialization.Model): """Class representing Diagnostic Metric information. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param unit: Metric's unit + :param unit: Metric's unit. :type unit: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime - :param time_grain: Presented time grain. Supported grains at the moment - are PT1M, PT1H, P1D + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime + :param time_grain: Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D. :type time_grain: str - :param values: Collection of metric values for the selected period based - on the - {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} - :type values: - list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSample] + :param values: Collection of metric values for the selected period based on the + {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain}. + :type values: list[~azure.mgmt.web.v2018_02_01.models.DiagnosticMetricSample] """ _attribute_map = { @@ -4353,7 +5364,17 @@ class DiagnosticMetricSet(Model): 'values': {'key': 'values', 'type': '[DiagnosticMetricSample]'}, } - def __init__(self, *, name: str=None, unit: str=None, start_time=None, end_time=None, time_grain: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + unit: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + values: Optional[List["DiagnosticMetricSample"]] = None, + **kwargs + ): super(DiagnosticMetricSet, self).__init__(**kwargs) self.name = name self.unit = unit @@ -4363,10 +5384,9 @@ def __init__(self, *, name: str=None, unit: str=None, start_time=None, end_time= self.values = values -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -4385,7 +5405,15 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, internal_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -4396,8 +5424,7 @@ def __init__(self, *, name: str=None, display_name: str=None, internal_name: str class Domain(Resource): """Information about a domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -4411,62 +5438,58 @@ class Domain(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2018_02_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2018_02_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2018_02_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2018_02_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2018_02_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2018_02_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.DomainPropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType :param auth_code: :type auth_code: str @@ -4477,10 +5500,6 @@ class Domain(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -4489,7 +5508,6 @@ class Domain(Resource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -4504,8 +5522,8 @@ class Domain(Resource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -4516,13 +5534,31 @@ class Domain(Resource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, *, location: str, contact_admin, contact_billing, contact_registrant, contact_tech, consent, kind: str=None, tags=None, privacy: bool=None, auto_renew: bool=True, dns_type=None, dns_zone_id: str=None, target_dns_type=None, auth_code: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + contact_admin: Optional["Contact"] = None, + contact_billing: Optional["Contact"] = None, + contact_registrant: Optional["Contact"] = None, + contact_tech: Optional["Contact"] = None, + privacy: Optional[bool] = None, + auto_renew: Optional[bool] = True, + consent: Optional["DomainPurchaseConsent"] = None, + dns_type: Optional[Union[str, "DnsType"]] = None, + dns_zone_id: Optional[str] = None, + target_dns_type: Optional[Union[str, "DnsType"]] = None, + auth_code: Optional[str] = None, + **kwargs + ): super(Domain, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.contact_admin = contact_admin self.contact_billing = contact_billing @@ -4546,46 +5582,85 @@ def __init__(self, *, location: str, contact_admin, contact_billing, contact_reg self.auth_code = auth_code -class DomainAvailablilityCheckResult(Model): +class DomainAvailablilityCheckResult(msrest.serialization.Model): """Domain availability check result. :param name: Name of the domain. :type name: str - :param available: true if domain can be purchased using - CreateDomain API; otherwise, false. + :param available: :code:`true` if domain can be purchased using CreateDomain API; + otherwise, :code:`false`. :type available: bool - :param domain_type: Valid values are Regular domain: Azure will charge the - full price of domain registration, SoftDeleted: Purchasing this domain - will simply restore it and this operation will not cost anything. Possible - values include: 'Regular', 'SoftDeleted' + :param domain_type: Valid values are Regular domain: Azure will charge the full price of domain + registration, SoftDeleted: Purchasing this domain will simply restore it and this operation + will not cost anything. Possible values include: "Regular", "SoftDeleted". :type domain_type: str or ~azure.mgmt.web.v2018_02_01.models.DomainType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'available': {'key': 'available', 'type': 'bool'}, - 'domain_type': {'key': 'domainType', 'type': 'DomainType'}, + 'domain_type': {'key': 'domainType', 'type': 'str'}, } - def __init__(self, *, name: str=None, available: bool=None, domain_type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available: Optional[bool] = None, + domain_type: Optional[Union[str, "DomainType"]] = None, + **kwargs + ): super(DomainAvailablilityCheckResult, self).__init__(**kwargs) self.name = name self.available = available self.domain_type = domain_type -class DomainControlCenterSsoRequest(Model): +class DomainCollection(msrest.serialization.Model): + """Collection of domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Domain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Domain"], + **kwargs + ): + super(DomainCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DomainControlCenterSsoRequest(msrest.serialization.Model): """Single sign-on request information for domain management. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar url: URL where the single sign-on request is to be made. :vartype url: str :ivar post_parameter_key: Post parameter key. :vartype post_parameter_key: str - :ivar post_parameter_value: Post parameter value. Client should use - 'application/x-www-form-urlencoded' encoding for this value. + :ivar post_parameter_value: Post parameter value. Client should use 'application/x-www-form- + urlencoded' encoding for this value. :vartype post_parameter_value: str """ @@ -4601,7 +5676,10 @@ class DomainControlCenterSsoRequest(Model): 'post_parameter_value': {'key': 'postParameterValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DomainControlCenterSsoRequest, self).__init__(**kwargs) self.url = None self.post_parameter_key = None @@ -4611,8 +5689,7 @@ def __init__(self, **kwargs) -> None: class DomainOwnershipIdentifier(ProxyOnlyResource): """Domain ownership Identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4640,19 +5717,56 @@ class DomainOwnershipIdentifier(ProxyOnlyResource): 'ownership_id': {'key': 'properties.ownershipId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, ownership_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + ownership_id: Optional[str] = None, + **kwargs + ): super(DomainOwnershipIdentifier, self).__init__(kind=kind, **kwargs) self.ownership_id = ownership_id -class DomainPatchResource(ProxyOnlyResource): - """ARM resource for a domain. +class DomainOwnershipIdentifierCollection(msrest.serialization.Model): + """Collection of domain ownership identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DomainOwnershipIdentifier"], + **kwargs + ): + super(DomainOwnershipIdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DomainPatchResource(ProxyOnlyResource): + """ARM resource for a domain. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -4661,60 +5775,56 @@ class DomainPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2018_02_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2018_02_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2018_02_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_02_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2018_02_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2018_02_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2018_02_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2018_02_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2018_02_01.models.DomainPatchResourcePropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2018_02_01.models.DnsType :param auth_code: :type auth_code: str @@ -4724,10 +5834,6 @@ class DomainPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -4736,7 +5842,6 @@ class DomainPatchResource(ProxyOnlyResource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -4749,8 +5854,8 @@ class DomainPatchResource(ProxyOnlyResource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -4761,13 +5866,29 @@ class DomainPatchResource(ProxyOnlyResource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, *, contact_admin, contact_billing, contact_registrant, contact_tech, consent, kind: str=None, privacy: bool=None, auto_renew: bool=True, dns_type=None, dns_zone_id: str=None, target_dns_type=None, auth_code: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + contact_admin: Optional["Contact"] = None, + contact_billing: Optional["Contact"] = None, + contact_registrant: Optional["Contact"] = None, + contact_tech: Optional["Contact"] = None, + privacy: Optional[bool] = None, + auto_renew: Optional[bool] = True, + consent: Optional["DomainPurchaseConsent"] = None, + dns_type: Optional[Union[str, "DnsType"]] = None, + dns_zone_id: Optional[str] = None, + target_dns_type: Optional[Union[str, "DnsType"]] = None, + auth_code: Optional[str] = None, + **kwargs + ): super(DomainPatchResource, self).__init__(kind=kind, **kwargs) self.contact_admin = contact_admin self.contact_billing = contact_billing @@ -4791,18 +5912,16 @@ def __init__(self, *, contact_admin, contact_billing, contact_registrant, contac self.auth_code = auth_code -class DomainPurchaseConsent(Model): - """Domain purchase consent object, representing acceptance of applicable legal - agreements. +class DomainPurchaseConsent(msrest.serialization.Model): + """Domain purchase consent object, representing acceptance of applicable legal agreements. - :param agreement_keys: List of applicable legal agreement keys. This list - can be retrieved using ListLegalAgreements API under - TopLevelDomain resource. + :param agreement_keys: List of applicable legal agreement keys. This list can be retrieved + using ListLegalAgreements API under :code:`TopLevelDomain` resource. :type agreement_keys: list[str] :param agreed_by: Client IP address. :type agreed_by: str :param agreed_at: Timestamp when the agreements were accepted. - :type agreed_at: datetime + :type agreed_at: ~datetime.datetime """ _attribute_map = { @@ -4811,18 +5930,24 @@ class DomainPurchaseConsent(Model): 'agreed_at': {'key': 'agreedAt', 'type': 'iso-8601'}, } - def __init__(self, *, agreement_keys=None, agreed_by: str=None, agreed_at=None, **kwargs) -> None: + def __init__( + self, + *, + agreement_keys: Optional[List[str]] = None, + agreed_by: Optional[str] = None, + agreed_at: Optional[datetime.datetime] = None, + **kwargs + ): super(DomainPurchaseConsent, self).__init__(**kwargs) self.agreement_keys = agreement_keys self.agreed_by = agreed_by self.agreed_at = agreed_at -class DomainRecommendationSearchParameters(Model): +class DomainRecommendationSearchParameters(msrest.serialization.Model): """Domain recommendation search parameters. - :param keywords: Keywords to be used for generating domain - recommendations. + :param keywords: Keywords to be used for generating domain recommendations. :type keywords: str :param max_domain_recommendations: Maximum number of recommendations. :type max_domain_recommendations: int @@ -4833,17 +5958,23 @@ class DomainRecommendationSearchParameters(Model): 'max_domain_recommendations': {'key': 'maxDomainRecommendations', 'type': 'int'}, } - def __init__(self, *, keywords: str=None, max_domain_recommendations: int=None, **kwargs) -> None: + def __init__( + self, + *, + keywords: Optional[str] = None, + max_domain_recommendations: Optional[int] = None, + **kwargs + ): super(DomainRecommendationSearchParameters, self).__init__(**kwargs) self.keywords = keywords self.max_domain_recommendations = max_domain_recommendations -class EnabledConfig(Model): +class EnabledConfig(msrest.serialization.Model): """Enabled configuration. - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -4851,21 +5982,23 @@ class EnabledConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(EnabledConfig, self).__init__(**kwargs) self.enabled = enabled -class EndpointDependency(Model): - """A domain name that a service is reached at, including details of the - current connection status. +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at, including details of the current connection status. :param domain_name: The domain name of the dependency. :type domain_name: str - :param endpoint_details: The IP Addresses and Ports used when connecting - to DomainName. - :type endpoint_details: - list[~azure.mgmt.web.v2018_02_01.models.EndpointDetail] + :param endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :type endpoint_details: list[~azure.mgmt.web.v2018_02_01.models.EndpointDetail] """ _attribute_map = { @@ -4873,26 +6006,30 @@ class EndpointDependency(Model): 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, } - def __init__(self, *, domain_name: str=None, endpoint_details=None, **kwargs) -> None: + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["EndpointDetail"]] = None, + **kwargs + ): super(EndpointDependency, self).__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(Model): - """Current TCP connectivity information from the App Service Environment to a - single endpoint. +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the App Service Environment to a single endpoint. :param ip_address: An IP Address that Domain Name currently resolves to. :type ip_address: str :param port: The port an endpoint is connected to. :type port: int - :param latency: The time in milliseconds it takes for a TCP connection to - be created from the App Service Environment to this IpAddress at this - Port. + :param latency: The time in milliseconds it takes for a TCP connection to be created from the + App Service Environment to this IpAddress at this Port. :type latency: float - :param is_accessable: Whether it is possible to create a TCP connection - from the App Service Environment to this IpAddress at this Port. + :param is_accessable: Whether it is possible to create a TCP connection from the App Service + Environment to this IpAddress at this Port. :type is_accessable: bool """ @@ -4903,7 +6040,15 @@ class EndpointDetail(Model): 'is_accessable': {'key': 'isAccessable', 'type': 'bool'}, } - def __init__(self, *, ip_address: str=None, port: int=None, latency: float=None, is_accessable: bool=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + latency: Optional[float] = None, + is_accessable: Optional[bool] = None, + **kwargs + ): super(EndpointDetail, self).__init__(**kwargs) self.ip_address = ip_address self.port = port @@ -4911,7 +6056,7 @@ def __init__(self, *, ip_address: str=None, port: int=None, latency: float=None, self.is_accessable = is_accessable -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -4937,7 +6082,17 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, extended_code: str=None, message_template: str=None, parameters=None, inner_errors=None, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["ErrorEntity"]] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = extended_code self.message_template = message_template @@ -4947,7 +6102,7 @@ def __init__(self, *, extended_code: str=None, message_template: str=None, param self.message = message -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -4958,33 +6113,42 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: + def __init__( + self, + *, + ramp_up_rules: Optional[List["RampUpRule"]] = None, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = ramp_up_rules -class FileSystemApplicationLogsConfig(Model): +class FileSystemApplicationLogsConfig(msrest.serialization.Model): """Application logs to file system configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error'. Default value: "Off" . + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2018_02_01.models.LogLevel """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, } - def __init__(self, *, level="Off", **kwargs) -> None: + def __init__( + self, + *, + level: Optional[Union[str, "LogLevel"]] = None, + **kwargs + ): super(FileSystemApplicationLogsConfig, self).__init__(**kwargs) self.level = level -class FileSystemHttpLogsConfig(Model): +class FileSystemHttpLogsConfig(msrest.serialization.Model): """Http logs to file system configuration. - :param retention_in_mb: Maximum size in megabytes that http log files can - use. + :param retention_in_mb: Maximum size in megabytes that http log files can use. When reached old log files will be removed to make space for new ones. Value can range between 25 and 100. :type retention_in_mb: int @@ -4992,8 +6156,8 @@ class FileSystemHttpLogsConfig(Model): Remove files older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -5007,7 +6171,14 @@ class FileSystemHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, retention_in_mb: int=None, retention_in_days: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + retention_in_mb: Optional[int] = None, + retention_in_days: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(FileSystemHttpLogsConfig, self).__init__(**kwargs) self.retention_in_mb = retention_in_mb self.retention_in_days = retention_in_days @@ -5017,8 +6188,7 @@ def __init__(self, *, retention_in_mb: int=None, retention_in_days: int=None, en class FunctionEnvelope(ProxyOnlyResource): """Function information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5048,11 +6218,11 @@ class FunctionEnvelope(ProxyOnlyResource): :type files: dict[str, str] :param test_data: Test data used when testing via the Azure Portal. :type test_data: str - :param invoke_url_template: The invocation URL + :param invoke_url_template: The invocation URL. :type invoke_url_template: str - :param language: The function language + :param language: The function language. :type language: str - :param is_disabled: Value indicating whether the function is disabled + :param is_disabled: Value indicating whether the function is disabled. :type is_disabled: bool """ @@ -5082,7 +6252,25 @@ class FunctionEnvelope(ProxyOnlyResource): 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, function_app_id: str=None, script_root_path_href: str=None, script_href: str=None, config_href: str=None, test_data_href: str=None, secrets_file_href: str=None, href: str=None, config=None, files=None, test_data: str=None, invoke_url_template: str=None, language: str=None, is_disabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + function_app_id: Optional[str] = None, + script_root_path_href: Optional[str] = None, + script_href: Optional[str] = None, + config_href: Optional[str] = None, + test_data_href: Optional[str] = None, + secrets_file_href: Optional[str] = None, + href: Optional[str] = None, + config: Optional[object] = None, + files: Optional[Dict[str, str]] = None, + test_data: Optional[str] = None, + invoke_url_template: Optional[str] = None, + language: Optional[str] = None, + is_disabled: Optional[bool] = None, + **kwargs + ): super(FunctionEnvelope, self).__init__(kind=kind, **kwargs) self.function_app_id = function_app_id self.script_root_path_href = script_root_path_href @@ -5099,11 +6287,44 @@ def __init__(self, *, kind: str=None, function_app_id: str=None, script_root_pat self.is_disabled = is_disabled +class FunctionEnvelopeCollection(msrest.serialization.Model): + """Collection of Kudu function information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["FunctionEnvelope"], + **kwargs + ): + super(FunctionEnvelopeCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class FunctionSecrets(ProxyOnlyResource): """Function secrets. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5134,13 +6355,20 @@ class FunctionSecrets(ProxyOnlyResource): 'trigger_url': {'key': 'properties.trigger_url', 'type': 'str'}, } - def __init__(self, *, kind: str=None, key: str=None, trigger_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key: Optional[str] = None, + trigger_url: Optional[str] = None, + **kwargs + ): super(FunctionSecrets, self).__init__(kind=kind, **kwargs) self.key = key self.trigger_url = trigger_url -class GeoDistribution(Model): +class GeoDistribution(msrest.serialization.Model): """A global distribution definition. :param location: Location. @@ -5154,7 +6382,13 @@ class GeoDistribution(Model): 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, } - def __init__(self, *, location: str=None, number_of_workers: int=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + number_of_workers: Optional[int] = None, + **kwargs + ): super(GeoDistribution, self).__init__(**kwargs) self.location = location self.number_of_workers = number_of_workers @@ -5163,8 +6397,7 @@ def __init__(self, *, location: str=None, number_of_workers: int=None, **kwargs) class GeoRegion(ProxyOnlyResource): """Geographical region. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5197,13 +6430,52 @@ class GeoRegion(ProxyOnlyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(GeoRegion, self).__init__(kind=kind, **kwargs) self.description = None self.display_name = None -class GlobalCsmSkuDescription(Model): +class GeoRegionCollection(msrest.serialization.Model): + """Collection of geographical regions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.GeoRegion] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GeoRegion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GeoRegion"], + **kwargs + ): + super(GeoRegionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class GlobalCsmSkuDescription(msrest.serialization.Model): """A Global SKU Description. :param name: Name of the resource SKU. @@ -5218,8 +6490,7 @@ class GlobalCsmSkuDescription(Model): :type capacity: ~azure.mgmt.web.v2018_02_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2018_02_01.models.Capability] """ @@ -5233,7 +6504,18 @@ class GlobalCsmSkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(GlobalCsmSkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5244,19 +6526,16 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -5266,14 +6545,21 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: + def __init__( + self, + *, + extension: Optional[str] = None, + script_processor: Optional[str] = None, + arguments: Optional[str] = None, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = extension self.script_processor = script_processor self.arguments = arguments -class HostingEnvironmentDeploymentInfo(Model): +class HostingEnvironmentDeploymentInfo(msrest.serialization.Model): """Information needed to create resources on an App Service Environment. :param name: Name of the App Service Environment. @@ -5287,13 +6573,19 @@ class HostingEnvironmentDeploymentInfo(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, name: str=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentDeploymentInfo, self).__init__(**kwargs) self.name = name self.location = location -class HostingEnvironmentDiagnostics(Model): +class HostingEnvironmentDiagnostics(msrest.serialization.Model): """Diagnostics for an App Service Environment. :param name: Name/identifier of the diagnostics. @@ -5307,17 +6599,22 @@ class HostingEnvironmentDiagnostics(Model): 'diagnosics_output': {'key': 'diagnosicsOutput', 'type': 'str'}, } - def __init__(self, *, name: str=None, diagnosics_output: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + diagnosics_output: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentDiagnostics, self).__init__(**kwargs) self.name = name self.diagnosics_output = diagnosics_output -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -5338,14 +6635,19 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = id self.name = None self.type = None -class HostKeys(Model): +class HostKeys(msrest.serialization.Model): """Functions host level keys. :param master_key: Secret key. @@ -5362,50 +6664,63 @@ class HostKeys(Model): 'system_keys': {'key': 'systemKeys', 'type': '{str}'}, } - def __init__(self, *, master_key: str=None, function_keys=None, system_keys=None, **kwargs) -> None: + def __init__( + self, + *, + master_key: Optional[str] = None, + function_keys: Optional[Dict[str, str]] = None, + system_keys: Optional[Dict[str, str]] = None, + **kwargs + ): super(HostKeys, self).__init__(**kwargs) self.master_key = master_key self.function_keys = function_keys self.system_keys = system_keys -class HostName(Model): +class HostName(msrest.serialization.Model): """Details of a hostname derived from a domain. :param name: Name of the hostname. :type name: str - :param site_names: List of apps the hostname is assigned to. This list - will have more than one app only if the hostname is pointing to a Traffic - Manager. + :param site_names: List of apps the hostname is assigned to. This list will have more than one + app only if the hostname is pointing to a Traffic Manager. :type site_names: list[str] - :param azure_resource_name: Name of the Azure resource the hostname is - assigned to. If it is assigned to a Traffic Manager then it will be the - Traffic Manager name otherwise it will be the app name. + :param azure_resource_name: Name of the Azure resource the hostname is assigned to. If it is + assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the + app name. :type azure_resource_name: str - :param azure_resource_type: Type of the Azure resource the hostname is - assigned to. Possible values include: 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2018_02_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Type of the DNS record. Possible - values include: 'CName', 'A' + :param azure_resource_type: Type of the Azure resource the hostname is assigned to. Possible + values include: "Website", "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2018_02_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Type of the DNS record. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2018_02_01.models.CustomHostNameDnsRecordType - :param host_name_type: Type of the hostname. Possible values include: - 'Verified', 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2018_02_01.models.HostNameType + :param host_name_type: Type of the hostname. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2018_02_01.models.HostNameType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'site_names': {'key': 'siteNames', 'type': '[str]'}, 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'hostNameType', 'type': 'HostNameType'}, - } - - def __init__(self, *, name: str=None, site_names=None, azure_resource_name: str=None, azure_resource_type=None, custom_host_name_dns_record_type=None, host_name_type=None, **kwargs) -> None: + 'azure_resource_type': {'key': 'azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'hostNameType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + site_names: Optional[List[str]] = None, + azure_resource_name: Optional[str] = None, + azure_resource_type: Optional[Union[str, "AzureResourceType"]] = None, + custom_host_name_dns_record_type: Optional[Union[str, "CustomHostNameDnsRecordType"]] = None, + host_name_type: Optional[Union[str, "HostNameType"]] = None, + **kwargs + ): super(HostName, self).__init__(**kwargs) self.name = name self.site_names = site_names @@ -5418,8 +6733,7 @@ def __init__(self, *, name: str=None, site_names=None, azure_resource_name: str= class HostNameBinding(ProxyOnlyResource): """A hostname binding object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5435,25 +6749,21 @@ class HostNameBinding(ProxyOnlyResource): :type domain_id: str :param azure_resource_name: Azure resource name. :type azure_resource_name: str - :param azure_resource_type: Azure resource type. Possible values include: - 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2018_02_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Custom DNS record type. Possible - values include: 'CName', 'A' + :param azure_resource_type: Azure resource type. Possible values include: "Website", + "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2018_02_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Custom DNS record type. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2018_02_01.models.CustomHostNameDnsRecordType - :param host_name_type: Hostname type. Possible values include: 'Verified', - 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2018_02_01.models.HostNameType - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param host_name_type: Hostname type. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2018_02_01.models.HostNameType + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2018_02_01.models.SslState - :param thumbprint: SSL certificate thumbprint + :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :vartype virtual_ip: str """ @@ -5472,15 +6782,28 @@ class HostNameBinding(ProxyOnlyResource): 'site_name': {'key': 'properties.siteName', 'type': 'str'}, 'domain_id': {'key': 'properties.domainId', 'type': 'str'}, 'azure_resource_name': {'key': 'properties.azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'properties.hostNameType', 'type': 'HostNameType'}, - 'ssl_state': {'key': 'properties.sslState', 'type': 'SslState'}, + 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'properties.hostNameType', 'type': 'str'}, + 'ssl_state': {'key': 'properties.sslState', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'virtual_ip': {'key': 'properties.virtualIP', 'type': 'str'}, } - def __init__(self, *, kind: str=None, site_name: str=None, domain_id: str=None, azure_resource_name: str=None, azure_resource_type=None, custom_host_name_dns_record_type=None, host_name_type=None, ssl_state=None, thumbprint: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + site_name: Optional[str] = None, + domain_id: Optional[str] = None, + azure_resource_name: Optional[str] = None, + azure_resource_type: Optional[Union[str, "AzureResourceType"]] = None, + custom_host_name_dns_record_type: Optional[Union[str, "CustomHostNameDnsRecordType"]] = None, + host_name_type: Optional[Union[str, "HostNameType"]] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + thumbprint: Optional[str] = None, + **kwargs + ): super(HostNameBinding, self).__init__(kind=kind, **kwargs) self.site_name = site_name self.domain_id = domain_id @@ -5493,36 +6816,79 @@ def __init__(self, *, kind: str=None, site_name: str=None, domain_id: str=None, self.virtual_ip = None -class HostNameSslState(Model): +class HostNameBindingCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.HostNameBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostNameBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["HostNameBinding"], + **kwargs + ): + super(HostNameBindingCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2018_02_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2018_02_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: + 'host_type': {'key': 'hostType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + virtual_ip: Optional[str] = None, + thumbprint: Optional[str] = None, + to_update: Optional[bool] = None, + host_type: Optional[Union[str, "HostType"]] = None, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = name self.ssl_state = ssl_state @@ -5532,15 +6898,13 @@ def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thum self.host_type = host_type -class HttpLogsConfig(Model): +class HttpLogsConfig(msrest.serialization.Model): """Http logs configuration. :param file_system: Http logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2018_02_01.models.FileSystemHttpLogsConfig + :type file_system: ~azure.mgmt.web.v2018_02_01.models.FileSystemHttpLogsConfig :param azure_blob_storage: Http logs to azure blob storage configuration. - :type azure_blob_storage: - ~azure.mgmt.web.v2018_02_01.models.AzureBlobStorageHttpLogsConfig + :type azure_blob_storage: ~azure.mgmt.web.v2018_02_01.models.AzureBlobStorageHttpLogsConfig """ _attribute_map = { @@ -5548,7 +6912,13 @@ class HttpLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageHttpLogsConfig'}, } - def __init__(self, *, file_system=None, azure_blob_storage=None, **kwargs) -> None: + def __init__( + self, + *, + file_system: Optional["FileSystemHttpLogsConfig"] = None, + azure_blob_storage: Optional["AzureBlobStorageHttpLogsConfig"] = None, + **kwargs + ): super(HttpLogsConfig, self).__init__(**kwargs) self.file_system = file_system self.azure_blob_storage = azure_blob_storage @@ -5557,8 +6927,7 @@ def __init__(self, *, file_system=None, azure_blob_storage=None, **kwargs) -> No class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5578,15 +6947,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -5611,7 +6980,20 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + service_bus_namespace: Optional[str] = None, + relay_name: Optional[str] = None, + relay_arm_uri: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + send_key_name: Optional[str] = None, + send_key_value: Optional[str] = None, + service_bus_suffix: Optional[str] = None, + **kwargs + ): super(HybridConnection, self).__init__(kind=kind, **kwargs) self.service_bus_namespace = service_bus_namespace self.relay_name = relay_name @@ -5623,12 +7005,44 @@ def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_nam self.service_bus_suffix = service_bus_suffix +class HybridConnectionCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.HybridConnection] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HybridConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["HybridConnection"], + **kwargs + ): + super(HybridConnectionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5661,18 +7075,21 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) self.send_key_name = None self.send_key_value = None class HybridConnectionLimits(ProxyOnlyResource): - """Hybrid Connection limits contract. This is used to return the plan limits - of Hybrid Connections. + """Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5705,7 +7122,12 @@ class HybridConnectionLimits(ProxyOnlyResource): 'maximum': {'key': 'properties.maximum', 'type': 'int'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionLimits, self).__init__(kind=kind, **kwargs) self.current = None self.maximum = None @@ -5714,8 +7136,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5725,8 +7146,8 @@ class Identifier(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str + :param id_properties_id: String representation of the identity. + :type id_properties_id: str """ _validation = { @@ -5740,26 +7161,62 @@ class Identifier(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, + 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + id_properties_id: Optional[str] = None, + **kwargs + ): super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id + self.id_properties_id = id_properties_id + + +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Identifier"], + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class InboundEnvironmentEndpoint(Model): - """The IP Addresses and Ports that require inbound network access to and - within the subnet of the App Service Environment. +class InboundEnvironmentEndpoint(msrest.serialization.Model): + """The IP Addresses and Ports that require inbound network access to and within the subnet of the App Service Environment. - :param description: Short text describing the purpose of the network - traffic. + :param description: Short text describing the purpose of the network traffic. :type description: str - :param endpoints: The IP addresses that network traffic will originate - from in cidr notation. + :param endpoints: The IP addresses that network traffic will originate from in cidr notation. :type endpoints: list[str] - :param ports: The ports that network traffic will arrive to the App - Service Environment at. + :param ports: The ports that network traffic will arrive to the App Service Environment at. :type ports: list[str] """ @@ -5769,14 +7226,55 @@ class InboundEnvironmentEndpoint(Model): 'ports': {'key': 'ports', 'type': '[str]'}, } - def __init__(self, *, description: str=None, endpoints=None, ports=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + endpoints: Optional[List[str]] = None, + ports: Optional[List[str]] = None, + **kwargs + ): super(InboundEnvironmentEndpoint, self).__init__(**kwargs) self.description = description self.endpoints = endpoints self.ports = ports -class IpSecurityRestriction(Model): +class InboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Inbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.InboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["InboundEnvironmentEndpoint"], + **kwargs + ): + super(InboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. :param ip_address: IP address the security restriction is valid for. @@ -5784,20 +7282,18 @@ class IpSecurityRestriction(Model): CIDR notation such as ipv4/mask (leading bit match). For CIDR, SubnetMask property must not be specified. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str - :param vnet_subnet_resource_id: Virtual network resource id + :param vnet_subnet_resource_id: Virtual network resource id. :type vnet_subnet_resource_id: str - :param vnet_traffic_tag: (internal) Vnet traffic tag + :param vnet_traffic_tag: (internal) Vnet traffic tag. :type vnet_traffic_tag: int - :param subnet_traffic_tag: (internal) Subnet traffic tag + :param subnet_traffic_tag: (internal) Subnet traffic tag. :type subnet_traffic_tag: int :param action: Allow or Deny access for this IP range. :type action: str - :param tag: Defines what this IP filter will be used for. This is to - support IP filtering on proxies. Possible values include: 'Default', - 'XffProxy' + :param tag: Defines what this IP filter will be used for. This is to support IP filtering on + proxies. Possible values include: "Default", "XffProxy". :type tag: str or ~azure.mgmt.web.v2018_02_01.models.IpFilterTag :param priority: Priority of IP restriction rule. :type priority: int @@ -5814,13 +7310,27 @@ class IpSecurityRestriction(Model): 'vnet_traffic_tag': {'key': 'vnetTrafficTag', 'type': 'int'}, 'subnet_traffic_tag': {'key': 'subnetTrafficTag', 'type': 'int'}, 'action': {'key': 'action', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'IpFilterTag'}, + 'tag': {'key': 'tag', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, ip_address: str=None, subnet_mask: str=None, vnet_subnet_resource_id: str=None, vnet_traffic_tag: int=None, subnet_traffic_tag: int=None, action: str=None, tag=None, priority: int=None, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: Optional[str] = None, + subnet_mask: Optional[str] = None, + vnet_subnet_resource_id: Optional[str] = None, + vnet_traffic_tag: Optional[int] = None, + subnet_traffic_tag: Optional[int] = None, + action: Optional[str] = None, + tag: Optional[Union[str, "IpFilterTag"]] = None, + priority: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = ip_address self.subnet_mask = subnet_mask @@ -5834,12 +7344,12 @@ def __init__(self, *, ip_address: str=None, subnet_mask: str=None, vnet_subnet_r self.description = description -class KeyInfo(Model): +class KeyInfo(msrest.serialization.Model): """Function key info. - :param name: Key name + :param name: Key name. :type name: str - :param value: Key value + :param value: Key value. :type value: str """ @@ -5848,13 +7358,19 @@ class KeyInfo(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(KeyInfo, self).__init__(**kwargs) self.name = name self.value = value -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -5868,13 +7384,19 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = value self.localized_value = localized_value -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log Definition of a single resource metric. :param name: @@ -5891,33 +7413,37 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. :vartype principal_id: str - :param user_assigned_identities: The list of user assigned identities - associated with the resource. The user identity dictionary key references - will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + :param user_assigned_identities: The list of user assigned identities associated with the + resource. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. :type user_assigned_identities: dict[str, - ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + ~azure.mgmt.web.v2018_02_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -5929,10 +7455,16 @@ class ManagedServiceIdentity(Model): 'type': {'key': 'type', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, } - def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = type self.tenant_id = None @@ -5940,35 +7472,7 @@ def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> Non self.user_assigned_identities = user_assigned_identities -class ManagedServiceIdentityUserAssignedIdentitiesValue(Model): - """ManagedServiceIdentityUserAssignedIdentitiesValue. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar principal_id: Principal Id of user assigned identity - :vartype principal_id: str - :ivar client_id: Client Id of user assigned 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) -> None: - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class MetricAvailabilily(Model): +class MetricAvailabilily(msrest.serialization.Model): """Metric availability and retention. :param time_grain: Time grain. @@ -5982,13 +7486,19 @@ class MetricAvailabilily(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, *, time_grain: str=None, retention: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_grain: Optional[str] = None, + retention: Optional[str] = None, + **kwargs + ): super(MetricAvailabilily, self).__init__(**kwargs) self.time_grain = time_grain self.retention = retention -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -6002,7 +7512,13 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, time_grain: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = time_grain self.blob_duration = blob_duration @@ -6011,8 +7527,7 @@ def __init__(self, *, time_grain: str=None, blob_duration: str=None, **kwargs) - class MetricDefinition(ProxyOnlyResource): """Metadata for a metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6026,10 +7541,9 @@ class MetricDefinition(ProxyOnlyResource): :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2018_02_01.models.MetricAvailabilily] + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. + :vartype metric_availabilities: list[~azure.mgmt.web.v2018_02_01.models.MetricAvailabilily] :ivar display_name: Friendly name shown in the UI. :vartype display_name: str """ @@ -6055,7 +7569,12 @@ class MetricDefinition(ProxyOnlyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MetricDefinition, self).__init__(kind=kind, **kwargs) self.unit = None self.primary_aggregation_type = None @@ -6063,7 +7582,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.display_name = None -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -6095,8 +7614,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2018_02_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2018_02_01.models.MetricAvailability] """ _attribute_map = { @@ -6117,7 +7635,26 @@ class MetricSpecification(Model): 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, supports_instance_level_aggregation: bool=None, enable_regional_mdm_account: bool=None, source_mdm_account: str=None, source_mdm_namespace: str=None, metric_filter_pattern: str=None, fill_gap_with_zero: bool=None, is_internal: bool=None, dimensions=None, category: str=None, availabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supports_instance_level_aggregation: Optional[bool] = None, + enable_regional_mdm_account: Optional[bool] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + metric_filter_pattern: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + is_internal: Optional[bool] = None, + dimensions: Optional[List["Dimension"]] = None, + category: Optional[str] = None, + availabilities: Optional[List["MetricAvailability"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -6139,10 +7676,7 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio class MigrateMySqlRequest(ProxyOnlyResource): """MySQL migration request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6152,21 +7686,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param connection_string: Required. Connection string to the remote MySQL - database. + :param connection_string: Connection string to the remote MySQL database. :type connection_string: str - :param migration_type: Required. The type of migration operation to be - done. Possible values include: 'LocalToRemote', 'RemoteToLocal' - :type migration_type: str or - ~azure.mgmt.web.v2018_02_01.models.MySqlMigrationType + :param migration_type: The type of migration operation to be done. Possible values include: + "LocalToRemote", "RemoteToLocal". + :type migration_type: str or ~azure.mgmt.web.v2018_02_01.models.MySqlMigrationType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'connection_string': {'required': True}, - 'migration_type': {'required': True}, } _attribute_map = { @@ -6175,10 +7705,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'migration_type': {'key': 'properties.migrationType', 'type': 'MySqlMigrationType'}, + 'migration_type': {'key': 'properties.migrationType', 'type': 'str'}, } - def __init__(self, *, connection_string: str, migration_type, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + connection_string: Optional[str] = None, + migration_type: Optional[Union[str, "MySqlMigrationType"]] = None, + **kwargs + ): super(MigrateMySqlRequest, self).__init__(kind=kind, **kwargs) self.connection_string = connection_string self.migration_type = migration_type @@ -6187,8 +7724,7 @@ def __init__(self, *, connection_string: str, migration_type, kind: str=None, ** class MigrateMySqlStatus(ProxyOnlyResource): """MySQL migration status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6198,13 +7734,12 @@ class MigrateMySqlStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar migration_operation_status: Status of the migration task. Possible - values include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' - :vartype migration_operation_status: str or - ~azure.mgmt.web.v2018_02_01.models.OperationStatus + :ivar migration_operation_status: Status of the migration task. Possible values include: + "InProgress", "Failed", "Succeeded", "TimedOut", "Created". + :vartype migration_operation_status: str or ~azure.mgmt.web.v2018_02_01.models.OperationStatus :ivar operation_id: Operation ID for the migration task. :vartype operation_id: str - :ivar local_my_sql_enabled: True if the web app has in app MySql enabled + :ivar local_my_sql_enabled: True if the web app has in app MySql enabled. :vartype local_my_sql_enabled: bool """ @@ -6222,12 +7757,17 @@ class MigrateMySqlStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'OperationStatus'}, + 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'str'}, 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, 'local_my_sql_enabled': {'key': 'properties.localMySqlEnabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MigrateMySqlStatus, self).__init__(kind=kind, **kwargs) self.migration_operation_status = None self.operation_id = None @@ -6237,8 +7777,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class MSDeploy(ProxyOnlyResource): """MSDeploy ARM PUT information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6248,29 +7787,24 @@ class MSDeploy(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param package_uri: Package URI + :param package_uri: Package URI. :type package_uri: str - :param connection_string: SQL Connection String + :param connection_string: SQL Connection String. :type connection_string: str - :param db_type: Database Type + :param db_type: Database Type. :type db_type: str - :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must - not be set if SetParameters is used. + :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must not be set if + SetParameters is used. :type set_parameters_xml_file_uri: str - :param set_parameters: MSDeploy Parameters. Must not be set if - SetParametersXmlFileUri is used. + :param set_parameters: MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. :type set_parameters: dict[str, str] - :param skip_app_data: Controls whether the MSDeploy operation skips the - App_Data directory. - If set to true, the existing App_Data directory on the - destination - will not be deleted, and any App_Data directory in the source will be - ignored. - Setting is false by default. + :param skip_app_data: Controls whether the MSDeploy operation skips the App_Data directory. + If set to :code:`true`, the existing App_Data directory on the destination + will not be deleted, and any App_Data directory in the source will be ignored. + Setting is :code:`false` by default. :type skip_app_data: bool - :param app_offline: Sets the AppOffline rule while the MSDeploy operation - executes. - Setting is false by default. + :param app_offline: Sets the AppOffline rule while the MSDeploy operation executes. + Setting is :code:`false` by default. :type app_offline: bool """ @@ -6294,7 +7828,19 @@ class MSDeploy(ProxyOnlyResource): 'app_offline': {'key': 'properties.appOffline', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, package_uri: str=None, connection_string: str=None, db_type: str=None, set_parameters_xml_file_uri: str=None, set_parameters=None, skip_app_data: bool=None, app_offline: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + package_uri: Optional[str] = None, + connection_string: Optional[str] = None, + db_type: Optional[str] = None, + set_parameters_xml_file_uri: Optional[str] = None, + set_parameters: Optional[Dict[str, str]] = None, + skip_app_data: Optional[bool] = None, + app_offline: Optional[bool] = None, + **kwargs + ): super(MSDeploy, self).__init__(kind=kind, **kwargs) self.package_uri = package_uri self.connection_string = connection_string @@ -6308,8 +7854,7 @@ def __init__(self, *, kind: str=None, package_uri: str=None, connection_string: class MSDeployLog(ProxyOnlyResource): """MSDeploy log. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6319,9 +7864,8 @@ class MSDeployLog(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar entries: List of log entry messages - :vartype entries: - list[~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntry] + :ivar entries: List of log entry messages. + :vartype entries: list[~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntry] """ _validation = { @@ -6339,24 +7883,26 @@ class MSDeployLog(ProxyOnlyResource): 'entries': {'key': 'properties.entries', 'type': '[MSDeployLogEntry]'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MSDeployLog, self).__init__(kind=kind, **kwargs) self.entries = None -class MSDeployLogEntry(Model): +class MSDeployLogEntry(msrest.serialization.Model): """MSDeploy log entry. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar time: Timestamp of log entry - :vartype time: datetime - :ivar type: Log entry type. Possible values include: 'Message', 'Warning', - 'Error' - :vartype type: str or - ~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntryType - :ivar message: Log entry message + :ivar time: Timestamp of log entry. + :vartype time: ~datetime.datetime + :ivar type: Log entry type. Possible values include: "Message", "Warning", "Error". + :vartype type: str or ~azure.mgmt.web.v2018_02_01.models.MSDeployLogEntryType + :ivar message: Log entry message. :vartype message: str """ @@ -6368,11 +7914,14 @@ class MSDeployLogEntry(Model): _attribute_map = { 'time': {'key': 'time', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'MSDeployLogEntryType'}, + 'type': {'key': 'type', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(MSDeployLogEntry, self).__init__(**kwargs) self.time = None self.type = None @@ -6382,8 +7931,7 @@ def __init__(self, **kwargs) -> None: class MSDeployStatus(ProxyOnlyResource): """MSDeploy ARM response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6393,17 +7941,17 @@ class MSDeployStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deployer: Username of deployer + :ivar deployer: Username of deployer. :vartype deployer: str - :ivar provisioning_state: Provisioning state. Possible values include: - 'accepted', 'running', 'succeeded', 'failed', 'canceled' + :ivar provisioning_state: Provisioning state. Possible values include: "accepted", "running", + "succeeded", "failed", "canceled". :vartype provisioning_state: str or ~azure.mgmt.web.v2018_02_01.models.MSDeployProvisioningState - :ivar start_time: Start time of deploy operation - :vartype start_time: datetime - :ivar end_time: End time of deploy operation - :vartype end_time: datetime - :ivar complete: Whether the deployment operation has completed + :ivar start_time: Start time of deploy operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of deploy operation. + :vartype end_time: ~datetime.datetime + :ivar complete: Whether the deployment operation has completed. :vartype complete: bool """ @@ -6424,13 +7972,18 @@ class MSDeployStatus(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'deployer': {'key': 'properties.deployer', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'MSDeployProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'complete': {'key': 'properties.complete', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MSDeployStatus, self).__init__(kind=kind, **kwargs) self.deployer = None self.provisioning_state = None @@ -6439,7 +7992,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.complete = None -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -6450,12 +8003,51 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = name -class NameValuePair(Model): +class NameIdentifierCollection(msrest.serialization.Model): + """Collection of domain name identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.NameIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NameIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["NameIdentifier"], + **kwargs + ): + super(NameIdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -6469,18 +8061,23 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = name self.value = value -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2018_02_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2018_02_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -6490,13 +8087,21 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, *, action=None, description: str=None, order: int=None, remote_subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + action: Optional[Union[str, "AccessControlEntryAction"]] = None, + description: Optional[str] = None, + order: Optional[int] = None, + remote_subnet: Optional[str] = None, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = action self.description = description @@ -6505,11 +8110,9 @@ def __init__(self, *, action=None, description: str=None, order: int=None, remot class NetworkFeatures(ProxyOnlyResource): - """Full view of network features for an app (presently VNET integration and - Hybrid Connections). + """Full view of network features for an app (presently VNET integration and Hybrid Connections). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6522,14 +8125,12 @@ class NetworkFeatures(ProxyOnlyResource): :ivar virtual_network_name: The Virtual Network name. :vartype virtual_network_name: str :ivar virtual_network_connection: The Virtual Network summary view. - :vartype virtual_network_connection: - ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :vartype virtual_network_connection: ~azure.mgmt.web.v2018_02_01.models.VnetInfo :ivar hybrid_connections: The Hybrid Connections summary view. :vartype hybrid_connections: list[~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity] :ivar hybrid_connections_v2: The Hybrid Connection V2 (Service Bus) view. - :vartype hybrid_connections_v2: - list[~azure.mgmt.web.v2018_02_01.models.HybridConnection] + :vartype hybrid_connections_v2: list[~azure.mgmt.web.v2018_02_01.models.HybridConnection] """ _validation = { @@ -6553,7 +8154,12 @@ class NetworkFeatures(ProxyOnlyResource): 'hybrid_connections_v2': {'key': 'properties.hybridConnectionsV2', 'type': '[HybridConnection]'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(NetworkFeatures, self).__init__(kind=kind, **kwargs) self.virtual_network_name = None self.virtual_network_connection = None @@ -6561,16 +8167,16 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.hybrid_connections_v2 = None -class NetworkTrace(Model): +class NetworkTrace(msrest.serialization.Model): """Network trace. :param path: Local file path for the captured network trace file. :type path: str - :param status: Current status of the network trace operation, same as - Operation.Status (InProgress/Succeeded/Failed). + :param status: Current status of the network trace operation, same as Operation.Status + (InProgress/Succeeded/Failed). :type status: str - :param message: Detailed message of a network trace operation, e.g. error - message in case of failure. + :param message: Detailed message of a network trace operation, e.g. error message in case of + failure. :type message: str """ @@ -6580,31 +8186,38 @@ class NetworkTrace(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, path: str=None, status: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + path: Optional[str] = None, + status: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(NetworkTrace, self).__init__(**kwargs) self.path = path self.status = status self.message = message -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2018_02_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2018_02_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -6612,7 +8225,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -6620,7 +8233,19 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, created_time=None, modified_time=None, expiration_time=None, geo_master_operation_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "OperationStatus"]] = None, + errors: Optional[List["ErrorEntity"]] = None, + created_time: Optional[datetime.datetime] = None, + modified_time: Optional[datetime.datetime] = None, + expiration_time: Optional[datetime.datetime] = None, + geo_master_operation_id: Optional[str] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = id self.name = name @@ -6632,18 +8257,14 @@ def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, cr self.geo_master_operation_id = geo_master_operation_id -class OutboundEnvironmentEndpoint(Model): - """Endpoints accessed for a common purpose that the App Service Environment - requires outbound network access to. +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the App Service Environment requires outbound network access to. - :param category: The type of service accessed by the App Service - Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active - Directory. + :param category: The type of service accessed by the App Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. :type category: str - :param endpoints: The endpoints that the App Service Environment reaches - the service at. - :type endpoints: - list[~azure.mgmt.web.v2018_02_01.models.EndpointDependency] + :param endpoints: The endpoints that the App Service Environment reaches the service at. + :type endpoints: list[~azure.mgmt.web.v2018_02_01.models.EndpointDependency] """ _attribute_map = { @@ -6651,13 +8272,87 @@ class OutboundEnvironmentEndpoint(Model): 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, } - def __init__(self, *, category: str=None, endpoints=None, **kwargs) -> None: + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["EndpointDependency"]] = None, + **kwargs + ): super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) self.category = category self.endpoints = endpoints -class PerfMonResponse(Model): +class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["OutboundEnvironmentEndpoint"], + **kwargs + ): + super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PerfMonCounterCollection(msrest.serialization.Model): + """Collection of performance monitor counters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.PerfMonResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PerfMonResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PerfMonResponse"], + **kwargs + ): + super(PerfMonCounterCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PerfMonResponse(msrest.serialization.Model): """Performance monitor API response. :param code: The response code. @@ -6674,18 +8369,25 @@ class PerfMonResponse(Model): 'data': {'key': 'data', 'type': 'PerfMonSet'}, } - def __init__(self, *, code: str=None, message: str=None, data=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + data: Optional["PerfMonSet"] = None, + **kwargs + ): super(PerfMonResponse, self).__init__(**kwargs) self.code = code self.message = message self.data = data -class PerfMonSample(Model): +class PerfMonSample(msrest.serialization.Model): """Performance monitor sample in a set. :param time: Point in time for which counter was measured. - :type time: datetime + :type time: ~datetime.datetime :param instance_name: Name of the server on which the measurement is made. :type instance_name: str :param value: Value of counter at a certain time. @@ -6698,22 +8400,29 @@ class PerfMonSample(Model): 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, time=None, instance_name: str=None, value: float=None, **kwargs) -> None: + def __init__( + self, + *, + time: Optional[datetime.datetime] = None, + instance_name: Optional[str] = None, + value: Optional[float] = None, + **kwargs + ): super(PerfMonSample, self).__init__(**kwargs) self.time = time self.instance_name = instance_name self.value = value -class PerfMonSet(Model): +class PerfMonSet(msrest.serialization.Model): """Metric information. :param name: Unique key name of the counter. :type name: str :param start_time: Start time of the period. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time of the period. - :type end_time: datetime + :type end_time: ~datetime.datetime :param time_grain: Presented time grain. :type time_grain: str :param values: Collection of workers that are active during this time. @@ -6728,7 +8437,16 @@ class PerfMonSet(Model): 'values': {'key': 'values', 'type': '[PerfMonSample]'}, } - def __init__(self, *, name: str=None, start_time=None, end_time=None, time_grain: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + values: Optional[List["PerfMonSample"]] = None, + **kwargs + ): super(PerfMonSet, self).__init__(**kwargs) self.name = name self.start_time = start_time @@ -6740,8 +8458,7 @@ def __init__(self, *, name: str=None, start_time=None, end_time=None, time_grain class PremierAddOn(Resource): """Premier add-on. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -6755,7 +8472,7 @@ class PremierAddOn(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Premier add on SKU. :type sku: str @@ -6790,7 +8507,19 @@ class PremierAddOn(Resource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, sku: str=None, product: str=None, vendor: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOn, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.sku = sku self.product = product @@ -6802,8 +8531,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, sku: str=None, p class PremierAddOnOffer(ProxyOnlyResource): """Premier add-on offer. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6819,14 +8547,13 @@ class PremierAddOnOffer(ProxyOnlyResource): :type product: str :param vendor: Premier add on offer Vendor. :type vendor: str - :param promo_code_required: true if promotion code is - required; otherwise, false. + :param promo_code_required: :code:`true` if promotion code is required; otherwise, + :code:`false`. :type promo_code_required: bool :param quota: Premier add on offer Quota. :type quota: int - :param web_hosting_plan_restrictions: App Service plans this offer is - restricted to. Possible values include: 'None', 'Free', 'Shared', 'Basic', - 'Standard', 'Premium' + :param web_hosting_plan_restrictions: App Service plans this offer is restricted to. Possible + values include: "None", "Free", "Shared", "Basic", "Standard", "Premium". :type web_hosting_plan_restrictions: str or ~azure.mgmt.web.v2018_02_01.models.AppServicePlanRestrictions :param privacy_policy_url: Privacy policy URL. @@ -6855,14 +8582,29 @@ class PremierAddOnOffer(ProxyOnlyResource): 'vendor': {'key': 'properties.vendor', 'type': 'str'}, 'promo_code_required': {'key': 'properties.promoCodeRequired', 'type': 'bool'}, 'quota': {'key': 'properties.quota', 'type': 'int'}, - 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'AppServicePlanRestrictions'}, + 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'str'}, 'privacy_policy_url': {'key': 'properties.privacyPolicyUrl', 'type': 'str'}, 'legal_terms_url': {'key': 'properties.legalTermsUrl', 'type': 'str'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: str=None, promo_code_required: bool=None, quota: int=None, web_hosting_plan_restrictions=None, privacy_policy_url: str=None, legal_terms_url: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + promo_code_required: Optional[bool] = None, + quota: Optional[int] = None, + web_hosting_plan_restrictions: Optional[Union[str, "AppServicePlanRestrictions"]] = None, + privacy_policy_url: Optional[str] = None, + legal_terms_url: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOnOffer, self).__init__(kind=kind, **kwargs) self.sku = sku self.product = product @@ -6876,11 +8618,44 @@ def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: self.marketplace_offer = marketplace_offer +class PremierAddOnOfferCollection(msrest.serialization.Model): + """Collection of premier add-on offers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOffer] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremierAddOnOffer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PremierAddOnOffer"], + **kwargs + ): + super(PremierAddOnOfferCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class PremierAddOnPatchResource(ProxyOnlyResource): """ARM resource for a PremierAddOn. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6920,7 +8695,17 @@ class PremierAddOnPatchResource(ProxyOnlyResource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOnPatchResource, self).__init__(kind=kind, **kwargs) self.sku = sku self.product = product @@ -6932,8 +8717,7 @@ def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: class PrivateAccess(ProxyOnlyResource): """Description of the parameters of Private Access for a Web Site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6945,10 +8729,9 @@ class PrivateAccess(ProxyOnlyResource): :vartype type: str :param enabled: Whether private access is enabled or not. :type enabled: bool - :param virtual_networks: The Virtual Networks (and subnets) allowed to - access the site privately. - :type virtual_networks: - list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessVirtualNetwork] + :param virtual_networks: The Virtual Networks (and subnets) allowed to access the site + privately. + :type virtual_networks: list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessVirtualNetwork] """ _validation = { @@ -6966,15 +8749,21 @@ class PrivateAccess(ProxyOnlyResource): 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[PrivateAccessVirtualNetwork]'}, } - def __init__(self, *, kind: str=None, enabled: bool=None, virtual_networks=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + enabled: Optional[bool] = None, + virtual_networks: Optional[List["PrivateAccessVirtualNetwork"]] = None, + **kwargs + ): super(PrivateAccess, self).__init__(kind=kind, **kwargs) self.enabled = enabled self.virtual_networks = virtual_networks -class PrivateAccessSubnet(Model): - """Description of a Virtual Network subnet that is useable for private site - access. +class PrivateAccessSubnet(msrest.serialization.Model): + """Description of a Virtual Network subnet that is useable for private site access. :param name: The name of the subnet. :type name: str @@ -6987,26 +8776,31 @@ class PrivateAccessSubnet(Model): 'key': {'key': 'key', 'type': 'int'}, } - def __init__(self, *, name: str=None, key: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + key: Optional[int] = None, + **kwargs + ): super(PrivateAccessSubnet, self).__init__(**kwargs) self.name = name self.key = key -class PrivateAccessVirtualNetwork(Model): +class PrivateAccessVirtualNetwork(msrest.serialization.Model): """Description of a Virtual Network that is useable for private site access. :param name: The name of the Virtual Network. :type name: str :param key: The key (ID) of the Virtual Network. :type key: int - :param resource_id: The ARM uri of the Virtual Network + :param resource_id: The ARM uri of the Virtual Network. :type resource_id: str - :param subnets: A List of subnets that access is allowed to on this - Virtual Network. An empty array (but not null) is interpreted to mean that - all subnets are allowed within this Virtual Network. - :type subnets: - list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessSubnet] + :param subnets: A List of subnets that access is allowed to on this Virtual Network. An empty + array (but not null) is interpreted to mean that all subnets are allowed within this Virtual + Network. + :type subnets: list[~azure.mgmt.web.v2018_02_01.models.PrivateAccessSubnet] """ _attribute_map = { @@ -7016,7 +8810,15 @@ class PrivateAccessVirtualNetwork(Model): 'subnets': {'key': 'subnets', 'type': '[PrivateAccessSubnet]'}, } - def __init__(self, *, name: str=None, key: int=None, resource_id: str=None, subnets=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + key: Optional[int] = None, + resource_id: Optional[str] = None, + subnets: Optional[List["PrivateAccessSubnet"]] = None, + **kwargs + ): super(PrivateAccessVirtualNetwork, self).__init__(**kwargs) self.name = name self.key = key @@ -7027,8 +8829,7 @@ def __init__(self, *, name: str=None, key: int=None, resource_id: str=None, subn class ProcessInfo(ProxyOnlyResource): """Process Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7046,9 +8847,9 @@ class ProcessInfo(ProxyOnlyResource): :type href: str :param minidump: Minidump URI. :type minidump: str - :param is_profile_running: Is profile running? + :param is_profile_running: Is profile running?. :type is_profile_running: bool - :param is_iis_profile_running: Is the IIS Profile running? + :param is_iis_profile_running: Is the IIS Profile running?. :type is_iis_profile_running: bool :param iis_profile_timeout_in_seconds: IIS Profile timeout (seconds). :type iis_profile_timeout_in_seconds: float @@ -7075,7 +8876,7 @@ class ProcessInfo(ProxyOnlyResource): :param thread_count: Thread count. :type thread_count: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_cpu_time: Total CPU time. :type total_cpu_time: str :param user_cpu_time: User CPU time. @@ -7101,12 +8902,12 @@ class ProcessInfo(ProxyOnlyResource): :param peak_paged_memory: Peak paged memory. :type peak_paged_memory: long :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime :param environment_variables: List of environment variables. :type environment_variables: dict[str, str] - :param is_scm_site: Is this the SCM site? + :param is_scm_site: Is this the SCM site?. :type is_scm_site: bool - :param is_webjob: Is this a Web Job? + :param is_webjob: Is this a Web Job?. :type is_webjob: bool :param description: Description of process. :type description: str @@ -7162,7 +8963,47 @@ class ProcessInfo(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, deployment_name: str=None, href: str=None, minidump: str=None, is_profile_running: bool=None, is_iis_profile_running: bool=None, iis_profile_timeout_in_seconds: float=None, parent: str=None, children=None, threads=None, open_file_handles=None, modules=None, file_name: str=None, command_line: str=None, user_name: str=None, handle_count: int=None, module_count: int=None, thread_count: int=None, start_time=None, total_cpu_time: str=None, user_cpu_time: str=None, privileged_cpu_time: str=None, working_set: int=None, peak_working_set: int=None, private_memory: int=None, virtual_memory: int=None, peak_virtual_memory: int=None, paged_system_memory: int=None, non_paged_system_memory: int=None, paged_memory: int=None, peak_paged_memory: int=None, time_stamp=None, environment_variables=None, is_scm_site: bool=None, is_webjob: bool=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + deployment_name: Optional[str] = None, + href: Optional[str] = None, + minidump: Optional[str] = None, + is_profile_running: Optional[bool] = None, + is_iis_profile_running: Optional[bool] = None, + iis_profile_timeout_in_seconds: Optional[float] = None, + parent: Optional[str] = None, + children: Optional[List[str]] = None, + threads: Optional[List["ProcessThreadInfo"]] = None, + open_file_handles: Optional[List[str]] = None, + modules: Optional[List["ProcessModuleInfo"]] = None, + file_name: Optional[str] = None, + command_line: Optional[str] = None, + user_name: Optional[str] = None, + handle_count: Optional[int] = None, + module_count: Optional[int] = None, + thread_count: Optional[int] = None, + start_time: Optional[datetime.datetime] = None, + total_cpu_time: Optional[str] = None, + user_cpu_time: Optional[str] = None, + privileged_cpu_time: Optional[str] = None, + working_set: Optional[int] = None, + peak_working_set: Optional[int] = None, + private_memory: Optional[int] = None, + virtual_memory: Optional[int] = None, + peak_virtual_memory: Optional[int] = None, + paged_system_memory: Optional[int] = None, + non_paged_system_memory: Optional[int] = None, + paged_memory: Optional[int] = None, + peak_paged_memory: Optional[int] = None, + time_stamp: Optional[datetime.datetime] = None, + environment_variables: Optional[Dict[str, str]] = None, + is_scm_site: Optional[bool] = None, + is_webjob: Optional[bool] = None, + description: Optional[str] = None, + **kwargs + ): super(ProcessInfo, self).__init__(kind=kind, **kwargs) self.identifier = None self.deployment_name = deployment_name @@ -7202,11 +9043,44 @@ def __init__(self, *, kind: str=None, deployment_name: str=None, href: str=None, self.description = description +class ProcessInfoCollection(msrest.serialization.Model): + """Collection of Kudu process information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ProcessInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessInfo"], + **kwargs + ): + super(ProcessInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ProcessModuleInfo(ProxyOnlyResource): """Process Module Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7216,8 +9090,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param base_address: Base address. Used as module identifier in ARM - resource URI. + :param base_address: Base address. Used as module identifier in ARM resource URI. :type base_address: str :param file_name: File name. :type file_name: str @@ -7235,7 +9108,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type product: str :param product_version: Product version. :type product_version: str - :param is_debug: Is debug? + :param is_debug: Is debug?. :type is_debug: bool :param language: Module language (locale). :type language: str @@ -7265,7 +9138,23 @@ class ProcessModuleInfo(ProxyOnlyResource): 'language': {'key': 'properties.language', 'type': 'str'}, } - def __init__(self, *, kind: str=None, base_address: str=None, file_name: str=None, href: str=None, file_path: str=None, module_memory_size: int=None, file_version: str=None, file_description: str=None, product: str=None, product_version: str=None, is_debug: bool=None, language: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + base_address: Optional[str] = None, + file_name: Optional[str] = None, + href: Optional[str] = None, + file_path: Optional[str] = None, + module_memory_size: Optional[int] = None, + file_version: Optional[str] = None, + file_description: Optional[str] = None, + product: Optional[str] = None, + product_version: Optional[str] = None, + is_debug: Optional[bool] = None, + language: Optional[str] = None, + **kwargs + ): super(ProcessModuleInfo, self).__init__(kind=kind, **kwargs) self.base_address = base_address self.file_name = file_name @@ -7280,11 +9169,44 @@ def __init__(self, *, kind: str=None, base_address: str=None, file_name: str=Non self.language = language +class ProcessModuleInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessModuleInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessModuleInfo"], + **kwargs + ): + super(ProcessModuleInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ProcessThreadInfo(ProxyOnlyResource): """Process Thread Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7309,7 +9231,7 @@ class ProcessThreadInfo(ProxyOnlyResource): :param base_priority: Base priority. :type base_priority: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total processor time. :type total_processor_time: str :param user_processor_time: User processor time. @@ -7349,7 +9271,24 @@ class ProcessThreadInfo(ProxyOnlyResource): 'wait_reason': {'key': 'properties.wait_reason', 'type': 'str'}, } - def __init__(self, *, kind: str=None, href: str=None, process: str=None, start_address: str=None, current_priority: int=None, priority_level: str=None, base_priority: int=None, start_time=None, total_processor_time: str=None, user_processor_time: str=None, priviledged_processor_time: str=None, state: str=None, wait_reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + href: Optional[str] = None, + process: Optional[str] = None, + start_address: Optional[str] = None, + current_priority: Optional[int] = None, + priority_level: Optional[str] = None, + base_priority: Optional[int] = None, + start_time: Optional[datetime.datetime] = None, + total_processor_time: Optional[str] = None, + user_processor_time: Optional[str] = None, + priviledged_processor_time: Optional[str] = None, + state: Optional[str] = None, + wait_reason: Optional[str] = None, + **kwargs + ): super(ProcessThreadInfo, self).__init__(kind=kind, **kwargs) self.identifier = None self.href = href @@ -7366,11 +9305,44 @@ def __init__(self, *, kind: str=None, href: str=None, process: str=None, start_a self.wait_reason = wait_reason +class ProcessThreadInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessThreadInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessThreadInfo"], + **kwargs + ): + super(ProcessThreadInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class PublicCertificate(ProxyOnlyResource): """Public certificate object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7380,13 +9352,13 @@ class PublicCertificate(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param blob: Public Certificate byte array + :param blob: Public Certificate byte array. :type blob: bytearray - :param public_certificate_location: Public Certificate Location. Possible - values include: 'CurrentUserMy', 'LocalMachineMy', 'Unknown' + :param public_certificate_location: Public Certificate Location. Possible values include: + "CurrentUserMy", "LocalMachineMy", "Unknown". :type public_certificate_location: str or ~azure.mgmt.web.v2018_02_01.models.PublicCertificateLocation - :ivar thumbprint: Certificate Thumbprint + :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str """ @@ -7403,25 +9375,63 @@ class PublicCertificate(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, - 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'PublicCertificateLocation'}, + 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, } - def __init__(self, *, kind: str=None, blob: bytearray=None, public_certificate_location=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + blob: Optional[bytearray] = None, + public_certificate_location: Optional[Union[str, "PublicCertificateLocation"]] = None, + **kwargs + ): super(PublicCertificate, self).__init__(kind=kind, **kwargs) self.blob = blob self.public_certificate_location = public_certificate_location self.thumbprint = None -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PublicCertificateCollection(msrest.serialization.Model): + """Collection of public certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.PublicCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublicCertificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PublicCertificate"], + **kwargs + ): + super(PublicCertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -7430,22 +9440,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -7453,7 +9460,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -7467,7 +9473,16 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + is_push_enabled: Optional[bool] = None, + tag_whitelist_json: Optional[str] = None, + tags_requiring_auth: Optional[str] = None, + dynamic_tags_json: Optional[str] = None, + **kwargs + ): super(PushSettings, self).__init__(kind=kind, **kwargs) self.is_push_enabled = is_push_enabled self.tag_whitelist_json = tag_whitelist_json @@ -7475,40 +9490,38 @@ def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: self.dynamic_tags_json = dynamic_tags_json -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + :code:`MinReroutePercentage` or :code:`MaxReroutePercentage`. Site + metrics are checked every N minutes specified in :code:`ChangeIntervalInMinutes`. + Custom decision algorithm can be provided in TiPCallback site extension which URL can be + specified in :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -7523,7 +9536,19 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_host_name: Optional[str] = None, + reroute_percentage: Optional[float] = None, + change_step: Optional[float] = None, + change_interval_in_minutes: Optional[int] = None, + min_reroute_percentage: Optional[float] = None, + max_reroute_percentage: Optional[float] = None, + change_decision_callback_url: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = action_host_name self.reroute_percentage = reroute_percentage @@ -7538,8 +9563,7 @@ def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None class Recommendation(ProxyOnlyResource): """Represents a recommendation result generated by the recommendation engine. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7550,68 +9574,58 @@ class Recommendation(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param creation_time: Timestamp when this instance was created. - :type creation_time: datetime - :param recommendation_id: A GUID value that each recommendation object is - associated with. + :type creation_time: ~datetime.datetime + :param recommendation_id: A GUID value that each recommendation object is associated with. :type recommendation_id: str - :param resource_id: Full ARM resource ID string that this recommendation - object is associated with. + :param resource_id: Full ARM resource ID string that this recommendation object is associated + with. :type resource_id: str - :param resource_scope: Name of a resource type this recommendation - applies, e.g. Subscription, ServerFarm, Site. Possible values include: - 'ServerFarm', 'Subscription', 'WebSite' - :type resource_scope: str or - ~azure.mgmt.web.v2018_02_01.models.ResourceScopeType + :param resource_scope: Name of a resource type this recommendation applies, e.g. Subscription, + ServerFarm, Site. Possible values include: "ServerFarm", "Subscription", "WebSite". + :type resource_scope: str or ~azure.mgmt.web.v2018_02_01.models.ResourceScopeType :param rule_name: Unique name of the rule. :type rule_name: str :param display_name: UI friendly name of the rule (may not be unique). :type display_name: str :param message: Recommendation text. :type message: str - :param level: Level indicating how critical this recommendation can - impact. Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level indicating how critical this recommendation can impact. Possible values + include: "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2018_02_01.models.NotificationLevel - :param channels: List of channels that this recommendation can apply. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of channels that this recommendation can apply. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2018_02_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - belongs to. + :ivar category_tags: The list of category tags that this recommendation belongs to. :vartype category_tags: list[str] :param action_name: Name of action recommended by this object. :type action_name: str - :param enabled: True if this recommendation is still valid (i.e. - "actionable"). False if it is invalid. + :param enabled: True if this recommendation is still valid (i.e. "actionable"). False if it is + invalid. :type enabled: int - :param states: The list of states of this recommendation. If it's null - then it should be considered "Active". + :param states: The list of states of this recommendation. If it's null then it should be + considered "Active". :type states: list[str] - :param start_time: The beginning time in UTC of a range that the - recommendation refers to. - :type start_time: datetime - :param end_time: The end time in UTC of a range that the recommendation - refers to. - :type end_time: datetime - :param next_notification_time: When to notify this recommendation next in - UTC. Null means that this will never be notified anymore. - :type next_notification_time: datetime - :param notification_expiration_time: Date and time in UTC when this - notification expires. - :type notification_expiration_time: datetime - :param notified_time: Last timestamp in UTC this instance was actually - notified. Null means that this recommendation hasn't been notified yet. - :type notified_time: datetime + :param start_time: The beginning time in UTC of a range that the recommendation refers to. + :type start_time: ~datetime.datetime + :param end_time: The end time in UTC of a range that the recommendation refers to. + :type end_time: ~datetime.datetime + :param next_notification_time: When to notify this recommendation next in UTC. Null means that + this will never be notified anymore. + :type next_notification_time: ~datetime.datetime + :param notification_expiration_time: Date and time in UTC when this notification expires. + :type notification_expiration_time: ~datetime.datetime + :param notified_time: Last timestamp in UTC this instance was actually notified. Null means + that this recommendation hasn't been notified yet. + :type notified_time: ~datetime.datetime :param score: A metric value measured by the rule. :type score: float - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool :param extension_name: Extension name of the portal if exists. :type extension_name: str :param blade_name: Deep link to a blade on the portal. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. + :param forward_link: Forward link to an external document associated with the rule. :type forward_link: str """ @@ -7634,8 +9648,8 @@ class Recommendation(ProxyOnlyResource): 'rule_name': {'key': 'properties.ruleName', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'int'}, @@ -7652,7 +9666,34 @@ class Recommendation(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, creation_time=None, recommendation_id: str=None, resource_id: str=None, resource_scope=None, rule_name: str=None, display_name: str=None, message: str=None, level=None, channels=None, action_name: str=None, enabled: int=None, states=None, start_time=None, end_time=None, next_notification_time=None, notification_expiration_time=None, notified_time=None, score: float=None, is_dynamic: bool=None, extension_name: str=None, blade_name: str=None, forward_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + recommendation_id: Optional[str] = None, + resource_id: Optional[str] = None, + resource_scope: Optional[Union[str, "ResourceScopeType"]] = None, + rule_name: Optional[str] = None, + display_name: Optional[str] = None, + message: Optional[str] = None, + level: Optional[Union[str, "NotificationLevel"]] = None, + channels: Optional[Union[str, "Channels"]] = None, + action_name: Optional[str] = None, + enabled: Optional[int] = None, + states: Optional[List[str]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + next_notification_time: Optional[datetime.datetime] = None, + notification_expiration_time: Optional[datetime.datetime] = None, + notified_time: Optional[datetime.datetime] = None, + score: Optional[float] = None, + is_dynamic: Optional[bool] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + forward_link: Optional[str] = None, + **kwargs + ): super(Recommendation, self).__init__(kind=kind, **kwargs) self.creation_time = creation_time self.recommendation_id = recommendation_id @@ -7679,12 +9720,44 @@ def __init__(self, *, kind: str=None, creation_time=None, recommendation_id: str self.forward_link = forward_link +class RecommendationCollection(msrest.serialization.Model): + """Collection of recommendations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Recommendation] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Recommendation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Recommendation"], + **kwargs + ): + super(RecommendationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class RecommendationRule(ProxyOnlyResource): - """Represents a recommendation rule that the recommendation engine can - perform. + """Represents a recommendation rule that the recommendation engine can perform. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7700,36 +9773,30 @@ class RecommendationRule(ProxyOnlyResource): :type display_name: str :param message: Localized name of the rule (Good for UI). :type message: str - :param recommendation_id: Recommendation ID of an associated - recommendation object tied to the rule, if exists. + :param recommendation_id: Recommendation ID of an associated recommendation object tied to the + rule, if exists. If such an object doesn't exist, it is set to null. :type recommendation_id: str :param description: Localized detailed description of the rule. :type description: str - :param action_name: Name of action that is recommended by this rule in - string. + :param action_name: Name of action that is recommended by this rule in string. :type action_name: str - :param level: Level of impact indicating how critical this rule is. - Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level of impact indicating how critical this rule is. Possible values include: + "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2018_02_01.models.NotificationLevel - :param channels: List of available channels that this rule applies. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of available channels that this rule applies. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2018_02_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - rule belongs to. + :ivar category_tags: The list of category tags that this recommendation rule belongs to. :vartype category_tags: list[str] - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool - :param extension_name: Extension name of the portal if exists. Applicable - to dynamic rule only. + :param extension_name: Extension name of the portal if exists. Applicable to dynamic rule only. :type extension_name: str - :param blade_name: Deep link to a blade on the portal. Applicable to - dynamic rule only. + :param blade_name: Deep link to a blade on the portal. Applicable to dynamic rule only. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. Applicable to dynamic rule only. + :param forward_link: Forward link to an external document associated with the rule. Applicable + to dynamic rule only. :type forward_link: str """ @@ -7751,8 +9818,8 @@ class RecommendationRule(ProxyOnlyResource): 'recommendation_id': {'key': 'properties.recommendationId', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, 'extension_name': {'key': 'properties.extensionName', 'type': 'str'}, @@ -7760,7 +9827,24 @@ class RecommendationRule(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, recommendation_name: str=None, display_name: str=None, message: str=None, recommendation_id: str=None, description: str=None, action_name: str=None, level=None, channels=None, is_dynamic: bool=None, extension_name: str=None, blade_name: str=None, forward_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + recommendation_name: Optional[str] = None, + display_name: Optional[str] = None, + message: Optional[str] = None, + recommendation_id: Optional[str] = None, + description: Optional[str] = None, + action_name: Optional[str] = None, + level: Optional[Union[str, "NotificationLevel"]] = None, + channels: Optional[Union[str, "Channels"]] = None, + is_dynamic: Optional[bool] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + forward_link: Optional[str] = None, + **kwargs + ): super(RecommendationRule, self).__init__(kind=kind, **kwargs) self.recommendation_name = recommendation_name self.display_name = display_name @@ -7780,8 +9864,7 @@ def __init__(self, *, kind: str=None, recommendation_name: str=None, display_nam class ReissueCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate reissue request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7793,13 +9876,13 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): :vartype type: str :param key_size: Certificate Key Size. :type key_size: int - :param delay_existing_revoke_in_hours: Delay in hours to revoke existing - certificate after the new certificate is issued. + :param delay_existing_revoke_in_hours: Delay in hours to revoke existing certificate after the + new certificate is issued. :type delay_existing_revoke_in_hours: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -7820,7 +9903,16 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, key_size: int=None, delay_existing_revoke_in_hours: int=None, csr: str=None, is_private_key_external: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_size: Optional[int] = None, + delay_existing_revoke_in_hours: Optional[int] = None, + csr: Optional[str] = None, + is_private_key_external: Optional[bool] = None, + **kwargs + ): super(ReissueCertificateOrderRequest, self).__init__(kind=kind, **kwargs) self.key_size = key_size self.delay_existing_revoke_in_hours = delay_existing_revoke_in_hours @@ -7831,8 +9923,7 @@ def __init__(self, *, kind: str=None, key_size: int=None, delay_existing_revoke_ class RelayServiceConnectionEntity(ProxyOnlyResource): """Hybrid Connection for an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7878,7 +9969,19 @@ class RelayServiceConnectionEntity(ProxyOnlyResource): 'biztalk_uri': {'key': 'properties.biztalkUri', 'type': 'str'}, } - def __init__(self, *, kind: str=None, entity_name: str=None, entity_connection_string: str=None, resource_type: str=None, resource_connection_string: str=None, hostname: str=None, port: int=None, biztalk_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + entity_name: Optional[str] = None, + entity_connection_string: Optional[str] = None, + resource_type: Optional[str] = None, + resource_connection_string: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + biztalk_uri: Optional[str] = None, + **kwargs + ): super(RelayServiceConnectionEntity, self).__init__(kind=kind, **kwargs) self.entity_name = entity_name self.entity_connection_string = entity_connection_string @@ -7889,26 +9992,32 @@ def __init__(self, *, kind: str=None, entity_name: str=None, entity_connection_s self.biztalk_uri = biztalk_uri -class Rendering(Model): +class Rendering(msrest.serialization.Model): """Instructions for rendering the data. - :param type: Rendering Type. Possible values include: 'NoGraph', 'Table', - 'TimeSeries', 'TimeSeriesPerInstance' + :param type: Rendering Type. Possible values include: "NoGraph", "Table", "TimeSeries", + "TimeSeriesPerInstance". :type type: str or ~azure.mgmt.web.v2018_02_01.models.RenderingType - :param title: Title of data + :param title: Title of data. :type title: str - :param description: Description of the data that will help it be - interpreted + :param description: Description of the data that will help it be interpreted. :type description: str """ _attribute_map = { - 'type': {'key': 'type', 'type': 'RenderingType'}, + 'type': {'key': 'type', 'type': 'str'}, 'title': {'key': 'title', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, type=None, title: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "RenderingType"]] = None, + title: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(Rendering, self).__init__(**kwargs) self.type = type self.title = title @@ -7918,8 +10027,7 @@ def __init__(self, *, type=None, title: str=None, description: str=None, **kwarg class RenewCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate renew request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7933,8 +10041,8 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): :type key_size: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -7954,14 +10062,22 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, key_size: int=None, csr: str=None, is_private_key_external: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_size: Optional[int] = None, + csr: Optional[str] = None, + is_private_key_external: Optional[bool] = None, + **kwargs + ): super(RenewCertificateOrderRequest, self).__init__(kind=kind, **kwargs) self.key_size = key_size self.csr = csr self.is_private_key_external = is_private_key_external -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -7975,17 +10091,56 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = count self.time_interval = time_interval +class ResourceCollection(msrest.serialization.Model): + """Collection of resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[str] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List[str], + **kwargs + ): + super(ResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ResourceHealthMetadata(ProxyOnlyResource): """Used for getting ResourceHealthCheck settings. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7995,10 +10150,9 @@ class ResourceHealthMetadata(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param category: The category that the resource matches in the RHC Policy - File + :param category: The category that the resource matches in the RHC Policy File. :type category: str - :param signal_availability: Is there a health signal for the resource + :param signal_availability: Is there a health signal for the resource. :type signal_availability: bool """ @@ -8017,38 +10171,76 @@ class ResourceHealthMetadata(ProxyOnlyResource): 'signal_availability': {'key': 'properties.signalAvailability', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, category: str=None, signal_availability: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + category: Optional[str] = None, + signal_availability: Optional[bool] = None, + **kwargs + ): super(ResourceHealthMetadata, self).__init__(kind=kind, **kwargs) self.category = category self.signal_availability = signal_availability -class ResourceMetric(Model): +class ResourceHealthMetadataCollection(msrest.serialization.Model): + """Collection of resource health metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceHealthMetadata]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceHealthMetadata"], + **kwargs + ): + super(ResourceHealthMetadataCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetric(msrest.serialization.Model): """Object representing a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: Name of metric. :vartype name: ~azure.mgmt.web.v2018_02_01.models.ResourceMetricName :ivar unit: Metric unit. :vartype unit: str - :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D + :ivar time_grain: Metric granularity. E.g PT1H, PT5M, P1D. :vartype time_grain: str :ivar start_time: Metric start time. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: Metric end time. - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar resource_id: Metric resource Id. :vartype resource_id: str :ivar id: Resource Id. :vartype id: str :ivar metric_values: Metric values. - :vartype metric_values: - list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricValue] + :vartype metric_values: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricValue] :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] """ _validation = { @@ -8075,7 +10267,10 @@ class ResourceMetric(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetric, self).__init__(**kwargs) self.name = None self.unit = None @@ -8088,11 +10283,10 @@ def __init__(self, **kwargs) -> None: self.properties = None -class ResourceMetricAvailability(Model): +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -8110,17 +10304,53 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None +class ResourceMetricCollection(msrest.serialization.Model): + """Collection of metric responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetric]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetric"], + **kwargs + ): + super(ResourceMetricCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8134,8 +10364,8 @@ class ResourceMetricDefinition(ProxyOnlyResource): :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. @@ -8167,7 +10397,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) self.unit = None self.primary_aggregation_type = None @@ -8176,11 +10411,44 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.properties = None -class ResourceMetricName(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetricDefinition"], + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetricName(msrest.serialization.Model): """Name of a metric for any resource . - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: metric name value. :vartype value: str @@ -8198,13 +10466,16 @@ class ResourceMetricName(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricName, self).__init__(**kwargs) self.value = None self.localized_value = None -class ResourceMetricProperty(Model): +class ResourceMetricProperty(msrest.serialization.Model): """Resource metric property. :param key: Key for resource metric property. @@ -8218,17 +10489,22 @@ class ResourceMetricProperty(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceMetricProperty, self).__init__(**kwargs) self.key = key self.value = value -class ResourceMetricValue(Model): +class ResourceMetricValue(msrest.serialization.Model): """Value of resource metric. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp: Value timestamp. :vartype timestamp: str @@ -8243,8 +10519,7 @@ class ResourceMetricValue(Model): :ivar count: Value count. :vartype count: float :ivar properties: Resource metric properties collection. - :vartype properties: - list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] + :vartype properties: list[~azure.mgmt.web.v2018_02_01.models.ResourceMetricProperty] """ _validation = { @@ -8267,7 +10542,10 @@ class ResourceMetricValue(Model): 'properties': {'key': 'properties', 'type': '[ResourceMetricProperty]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricValue, self).__init__(**kwargs) self.timestamp = None self.average = None @@ -8278,24 +10556,21 @@ def __init__(self, **kwargs) -> None: self.properties = None -class ResourceNameAvailability(Model): +class ResourceNameAvailability(msrest.serialization.Model): """Information regarding availability of a resource name. - :param name_available: true indicates name is valid and - available. false indicates the name is invalid, unavailable, - or both. + :param name_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. :type name_available: bool - :param reason: Invalid indicates the name provided does not - match Azure App Service naming requirements. AlreadyExists - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.web.v2018_02_01.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why - the given name is invalid, and provide the resource naming requirements so - that the user can select a valid name. If reason == AlreadyExists, explain - that resource name is already in use, and direct them to select a - different name. + :param reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.web.v2018_02_01.models.InAvailabilityReasonType + :param message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. :type message: str """ @@ -8305,26 +10580,32 @@ class ResourceNameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "InAvailabilityReasonType"]] = None, + message: Optional[str] = None, + **kwargs + ): super(ResourceNameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class ResourceNameAvailabilityRequest(Model): +class ResourceNameAvailabilityRequest(msrest.serialization.Model): """Resource name availability request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes + :param type: Required. Resource type used for verification. Possible values include: "Site", + "Slot", "HostingEnvironment", "PublishingUser", "Microsoft.Web/sites", + "Microsoft.Web/sites/slots", "Microsoft.Web/hostingEnvironments", + "Microsoft.Web/publishingUsers". + :type type: str or ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool """ @@ -8340,17 +10621,24 @@ class ResourceNameAvailabilityRequest(Model): 'is_fqdn': {'key': 'isFqdn', 'type': 'bool'}, } - def __init__(self, *, name: str, type, is_fqdn: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + type: Union[str, "CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ): super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type self.is_fqdn = is_fqdn -class ResponseMetaData(Model): +class ResponseMetaData(msrest.serialization.Model): """ResponseMetaData. - :param data_source: Source of the Data + :param data_source: Source of the Data. :type data_source: ~azure.mgmt.web.v2018_02_01.models.DataSource """ @@ -8358,7 +10646,12 @@ class ResponseMetaData(Model): 'data_source': {'key': 'dataSource', 'type': 'DataSource'}, } - def __init__(self, *, data_source=None, **kwargs) -> None: + def __init__( + self, + *, + data_source: Optional["DataSource"] = None, + **kwargs + ): super(ResponseMetaData, self).__init__(**kwargs) self.data_source = data_source @@ -8366,10 +10659,7 @@ def __init__(self, *, data_source=None, **kwargs) -> None: class RestoreRequest(ProxyOnlyResource): """Description of a restore request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8379,42 +10669,37 @@ class RestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str :param blob_name: Name of a blob which contains the backup. :type blob_name: str - :param overwrite: Required. true if the restore operation can - overwrite target app; otherwise, false. true is - needed if trying to restore over an existing app. + :param overwrite: :code:`true` if the restore operation can overwrite target app; + otherwise, :code:`false`. :code:`true` is needed if trying to restore + over an existing app. :type overwrite: bool :param site_name: Name of an app. :type site_name: str - :param databases: Collection of databases which should be restored. This - list has to match the list of databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] - :param ignore_conflicting_host_names: Changes a logic when restoring an - app with custom domains. true to remove custom domains - automatically. If false, custom domains are added to - the app's object when it is being restored, but that might fail due to - conflicts during the operation. Default value: False . + :param databases: Collection of databases which should be restored. This list has to match the + list of databases included in the backup. + :type databases: list[~azure.mgmt.web.v2018_02_01.models.DatabaseBackupSetting] + :param ignore_conflicting_host_names: Changes a logic when restoring an app with custom + domains. :code:`true` to remove custom domains automatically. If + :code:`false`, custom domains are added to + the app's object when it is being restored, but that might fail due to conflicts during the + operation. :type ignore_conflicting_host_names: bool - :param ignore_databases: Ignore the databases and only restore the site - content. Default value: False . + :param ignore_databases: Ignore the databases and only restore the site content. :type ignore_databases: bool - :param app_service_plan: Specify app service plan that will own restored - site. + :param app_service_plan: Specify app service plan that will own restored site. :type app_service_plan: str - :param operation_type: Operation type. Possible values include: 'Default', - 'Clone', 'Relocation', 'Snapshot', 'CloudFS'. Default value: "Default" . - :type operation_type: str or - ~azure.mgmt.web.v2018_02_01.models.BackupRestoreOperationType - :param adjust_connection_strings: true if - SiteConfig.ConnectionStrings should be set in new app; otherwise, - false. + :param operation_type: Operation type. Possible values include: "Default", "Clone", + "Relocation", "Snapshot", "CloudFS". Default value: "Default". + :type operation_type: str or ~azure.mgmt.web.v2018_02_01.models.BackupRestoreOperationType + :param adjust_connection_strings: :code:`true` if SiteConfig.ConnectionStrings + should be set in new app; otherwise, :code:`false`. :type adjust_connection_strings: bool - :param hosting_environment: App Service Environment name, if needed (only - when restoring an app to an App Service Environment). + :param hosting_environment: App Service Environment name, if needed (only when restoring an app + to an App Service Environment). :type hosting_environment: str """ @@ -8422,8 +10707,6 @@ class RestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -8439,12 +10722,28 @@ class RestoreRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, 'ignore_databases': {'key': 'properties.ignoreDatabases', 'type': 'bool'}, 'app_service_plan': {'key': 'properties.appServicePlan', 'type': 'str'}, - 'operation_type': {'key': 'properties.operationType', 'type': 'BackupRestoreOperationType'}, + 'operation_type': {'key': 'properties.operationType', 'type': 'str'}, 'adjust_connection_strings': {'key': 'properties.adjustConnectionStrings', 'type': 'bool'}, 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, *, storage_account_url: str, overwrite: bool, kind: str=None, blob_name: str=None, site_name: str=None, databases=None, ignore_conflicting_host_names: bool=False, ignore_databases: bool=False, app_service_plan: str=None, operation_type="Default", adjust_connection_strings: bool=None, hosting_environment: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + storage_account_url: Optional[str] = None, + blob_name: Optional[str] = None, + overwrite: Optional[bool] = None, + site_name: Optional[str] = None, + databases: Optional[List["DatabaseBackupSetting"]] = None, + ignore_conflicting_host_names: Optional[bool] = False, + ignore_databases: Optional[bool] = False, + app_service_plan: Optional[str] = None, + operation_type: Optional[Union[str, "BackupRestoreOperationType"]] = "Default", + adjust_connection_strings: Optional[bool] = None, + hosting_environment: Optional[str] = None, + **kwargs + ): super(RestoreRequest, self).__init__(kind=kind, **kwargs) self.storage_account_url = storage_account_url self.blob_name = blob_name @@ -8459,15 +10758,13 @@ def __init__(self, *, storage_account_url: str, overwrite: bool, kind: str=None, self.hosting_environment = hosting_environment -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """Resource metrics service provided by Microsoft.Insights resource provider. :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2018_02_01.models.MetricSpecification] + :type metric_specifications: list[~azure.mgmt.web.v2018_02_01.models.MetricSpecification] :param log_specifications: - :type log_specifications: - list[~azure.mgmt.web.v2018_02_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.web.v2018_02_01.models.LogSpecification] """ _attribute_map = { @@ -8475,7 +10772,13 @@ class ServiceSpecification(Model): 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, *, metric_specifications=None, log_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -8484,8 +10787,7 @@ def __init__(self, *, metric_specifications=None, log_specifications=None, **kwa class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -8499,130 +10801,110 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2018_02_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2018_02_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2018_02_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2018_02_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param geo_distributions: GeoDistributions for this site - :type geo_distributions: - list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] - :param identity: - :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity + :param geo_distributions: GeoDistributions for this site. + :type geo_distributions: list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] """ _validation = { @@ -8657,13 +10939,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -8691,14 +10974,41 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, 'geo_distributions': {'key': 'properties.geoDistributions', 'type': '[GeoDistribution]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, client_cert_exclusion_paths: str=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, https_only: bool=None, redundancy_mode=None, geo_distributions=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + client_cert_exclusion_paths: Optional[str] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + https_only: Optional[bool] = None, + redundancy_mode: Optional[Union[str, "RedundancyMode"]] = None, + geo_distributions: Optional[List["GeoDistribution"]] = None, + **kwargs + ): super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -8736,15 +11046,12 @@ def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=No self.redundancy_mode = redundancy_mode self.in_progress_operation_id = None self.geo_distributions = geo_distributions - self.identity = identity class SiteAuthSettings(ProxyOnlyResource): - """Configuration settings for the Azure App Service Authentication / - Authorization feature. + """Configuration settings for the Azure App Service Authentication / Authorization feature. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8754,152 +11061,128 @@ class SiteAuthSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param enabled: true if the Authentication / Authorization - feature is enabled for the current app; otherwise, false. + :param enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. :type enabled: bool - :param runtime_version: The RuntimeVersion of the Authentication / - Authorization feature in use for the current app. - The setting in this value can control the behavior of certain features in - the Authentication / Authorization module. + :param runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. :type runtime_version: str - :param unauthenticated_client_action: The action to take when an - unauthenticated client attempts to access the app. Possible values - include: 'RedirectToLoginPage', 'AllowAnonymous' + :param unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous". :type unauthenticated_client_action: str or ~azure.mgmt.web.v2018_02_01.models.UnauthenticatedClientAction - :param token_store_enabled: true to durably store - platform-specific security tokens that are obtained during login flows; - otherwise, false. - The default is false. + :param token_store_enabled: :code:`true` to durably store platform-specific + security tokens that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. :type token_store_enabled: bool - :param allowed_external_redirect_urls: External URLs that can be - redirected to as part of logging in or logging out of the app. Note that - the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store - application backends. + :param allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. :type allowed_external_redirect_urls: list[str] - :param default_provider: The default authentication provider to use when - multiple providers are configured. - This setting is only needed if multiple providers are configured and the - unauthenticated client - action is set to "RedirectToLoginPage". Possible values include: - 'AzureActiveDirectory', 'Facebook', 'Google', 'MicrosoftAccount', - 'Twitter' - :type default_provider: str or - ~azure.mgmt.web.v2018_02_01.models.BuiltInAuthenticationProvider - :param token_refresh_extension_hours: The number of hours after session - token expiration that a session token can be used to + :param default_provider: The default authentication provider to use when multiple providers are + configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". Possible values include: "AzureActiveDirectory", + "Facebook", "Google", "MicrosoftAccount", "Twitter". + :type default_provider: str or ~azure.mgmt.web.v2018_02_01.models.BuiltInAuthenticationProvider + :param token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to call the token refresh API. The default is 72 hours. :type token_refresh_extension_hours: float - :param client_id: The Client ID of this relying party application, known - as the client_id. - This setting is required for enabling OpenID Connection authentication - with Azure Active Directory or + :param client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or other 3rd party OpenID Connect providers. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_id: str - :param client_secret: The Client Secret of this relying party application - (in Azure Active Directory, this is also referred to as the Key). - This setting is optional. If no client secret is configured, the OpenID - Connect implicit auth flow is used to authenticate end users. - Otherwise, the OpenID Connect Authorization Code Flow is used to - authenticate end users. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + :param client_secret: The Client Secret of this relying party application (in Azure Active + Directory, this is also referred to as the Key). + This setting is optional. If no client secret is configured, the OpenID Connect implicit auth + flow is used to authenticate end users. + Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_secret: str - :param client_secret_certificate_thumbprint: An alternative to the client - secret, that is the thumbprint of a certificate used for signing purposes. - This property acts as + :param client_secret_certificate_thumbprint: An alternative to the client secret, that is the + thumbprint of a certificate used for signing purposes. This property acts as a replacement for the Client Secret. It is also optional. :type client_secret_certificate_thumbprint: str - :param issuer: The OpenID Connect Issuer URI that represents the entity - which issues access tokens for this application. - When using Azure Active Directory, this value is the URI of the directory - tenant, e.g. https://sts.windows.net/{tenant-guid}/. + :param issuer: The OpenID Connect Issuer URI that represents the entity which issues access + tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://sts.windows.net/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. - More information on OpenID Connect Discovery: - http://openid.net/specs/openid-connect-discovery-1_0.html + More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect- + discovery-1_0.html. :type issuer: str - :param validate_issuer: Gets a value indicating whether the issuer should - be a valid HTTPS url and be validated as such. + :param validate_issuer: Gets a value indicating whether the issuer should be a valid HTTPS url + and be validated as such. :type validate_issuer: bool - :param allowed_audiences: Allowed audience values to consider when - validating JWTs issued by - Azure Active Directory. Note that the ClientID value is - always considered an + :param allowed_audiences: Allowed audience values to consider when validating JWTs issued by + Azure Active Directory. Note that the :code:`ClientID` value is always considered + an allowed audience, regardless of this setting. :type allowed_audiences: list[str] - :param additional_login_params: Login parameters to send to the OpenID - Connect authorization endpoint when + :param additional_login_params: Login parameters to send to the OpenID Connect authorization + endpoint when a user logs in. Each parameter must be in the form "key=value". :type additional_login_params: list[str] - :param google_client_id: The OpenID Connect Client ID for the Google web - application. + :param google_client_id: The OpenID Connect Client ID for the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_id: str - :param google_client_secret: The client secret associated with the Google - web application. + :param google_client_secret: The client secret associated with the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_secret: str - :param google_oauth_scopes: The OAuth 2.0 scopes that will be requested as - part of Google Sign-In authentication. - This setting is optional. If not specified, "openid", "profile", and - "email" are used as default scopes. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ - :type google_oauth_scopes: list[str] + :param google_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Google + Sign-In authentication. + This setting is optional. If not specified, "openid", "profile", and "email" are used as + default scopes. + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. + :type google_o_auth_scopes: list[str] :param facebook_app_id: The App ID of the Facebook app used for login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_id: str - :param facebook_app_secret: The App Secret of the Facebook app used for - Facebook Login. + :param facebook_app_secret: The App Secret of the Facebook app used for Facebook Login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_secret: str - :param facebook_oauth_scopes: The OAuth 2.0 scopes that will be requested - as part of Facebook Login authentication. + :param facebook_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Facebook + Login authentication. This setting is optional. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login - :type facebook_oauth_scopes: list[str] - :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter - application used for sign-in. + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. + :type facebook_o_auth_scopes: list[str] + :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter application used for + sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_key: str - :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the - Twitter application used for sign-in. + :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the Twitter application used + for sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_secret: str - :param microsoft_account_client_id: The OAuth 2.0 client ID that was - created for the app used for authentication. + :param microsoft_account_client_id: The OAuth 2.0 client ID that was created for the app used + for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_id: str - :param microsoft_account_client_secret: The OAuth 2.0 client secret that - was created for the app used for authentication. + :param microsoft_account_client_secret: The OAuth 2.0 client secret that was created for the + app used for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_secret: str - :param microsoft_account_oauth_scopes: The OAuth 2.0 scopes that will be - requested as part of Microsoft Account authentication. - This setting is optional. If not specified, "wl.basic" is used as the - default scope. - Microsoft Account Scopes and permissions documentation: - https://msdn.microsoft.com/en-us/library/dn631845.aspx - :type microsoft_account_oauth_scopes: list[str] + :param microsoft_account_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of + Microsoft Account authentication. + This setting is optional. If not specified, "wl.basic" is used as the default scope. + Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en- + us/library/dn631845.aspx. + :type microsoft_account_o_auth_scopes: list[str] """ _validation = { @@ -8915,10 +11198,10 @@ class SiteAuthSettings(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, - 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'UnauthenticatedClientAction'}, + 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'str'}, 'token_store_enabled': {'key': 'properties.tokenStoreEnabled', 'type': 'bool'}, 'allowed_external_redirect_urls': {'key': 'properties.allowedExternalRedirectUrls', 'type': '[str]'}, - 'default_provider': {'key': 'properties.defaultProvider', 'type': 'BuiltInAuthenticationProvider'}, + 'default_provider': {'key': 'properties.defaultProvider', 'type': 'str'}, 'token_refresh_extension_hours': {'key': 'properties.tokenRefreshExtensionHours', 'type': 'float'}, 'client_id': {'key': 'properties.clientId', 'type': 'str'}, 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, @@ -8929,18 +11212,48 @@ class SiteAuthSettings(ProxyOnlyResource): 'additional_login_params': {'key': 'properties.additionalLoginParams', 'type': '[str]'}, 'google_client_id': {'key': 'properties.googleClientId', 'type': 'str'}, 'google_client_secret': {'key': 'properties.googleClientSecret', 'type': 'str'}, - 'google_oauth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, + 'google_o_auth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, 'facebook_app_id': {'key': 'properties.facebookAppId', 'type': 'str'}, 'facebook_app_secret': {'key': 'properties.facebookAppSecret', 'type': 'str'}, - 'facebook_oauth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, + 'facebook_o_auth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, 'twitter_consumer_key': {'key': 'properties.twitterConsumerKey', 'type': 'str'}, 'twitter_consumer_secret': {'key': 'properties.twitterConsumerSecret', 'type': 'str'}, 'microsoft_account_client_id': {'key': 'properties.microsoftAccountClientId', 'type': 'str'}, 'microsoft_account_client_secret': {'key': 'properties.microsoftAccountClientSecret', 'type': 'str'}, - 'microsoft_account_oauth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, - } - - def __init__(self, *, kind: str=None, enabled: bool=None, runtime_version: str=None, unauthenticated_client_action=None, token_store_enabled: bool=None, allowed_external_redirect_urls=None, default_provider=None, token_refresh_extension_hours: float=None, client_id: str=None, client_secret: str=None, client_secret_certificate_thumbprint: str=None, issuer: str=None, validate_issuer: bool=None, allowed_audiences=None, additional_login_params=None, google_client_id: str=None, google_client_secret: str=None, google_oauth_scopes=None, facebook_app_id: str=None, facebook_app_secret: str=None, facebook_oauth_scopes=None, twitter_consumer_key: str=None, twitter_consumer_secret: str=None, microsoft_account_client_id: str=None, microsoft_account_client_secret: str=None, microsoft_account_oauth_scopes=None, **kwargs) -> None: + 'microsoft_account_o_auth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + enabled: Optional[bool] = None, + runtime_version: Optional[str] = None, + unauthenticated_client_action: Optional[Union[str, "UnauthenticatedClientAction"]] = None, + token_store_enabled: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + default_provider: Optional[Union[str, "BuiltInAuthenticationProvider"]] = None, + token_refresh_extension_hours: Optional[float] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + client_secret_certificate_thumbprint: Optional[str] = None, + issuer: Optional[str] = None, + validate_issuer: Optional[bool] = None, + allowed_audiences: Optional[List[str]] = None, + additional_login_params: Optional[List[str]] = None, + google_client_id: Optional[str] = None, + google_client_secret: Optional[str] = None, + google_o_auth_scopes: Optional[List[str]] = None, + facebook_app_id: Optional[str] = None, + facebook_app_secret: Optional[str] = None, + facebook_o_auth_scopes: Optional[List[str]] = None, + twitter_consumer_key: Optional[str] = None, + twitter_consumer_secret: Optional[str] = None, + microsoft_account_client_id: Optional[str] = None, + microsoft_account_client_secret: Optional[str] = None, + microsoft_account_o_auth_scopes: Optional[List[str]] = None, + **kwargs + ): super(SiteAuthSettings, self).__init__(kind=kind, **kwargs) self.enabled = enabled self.runtime_version = runtime_version @@ -8958,46 +11271,50 @@ def __init__(self, *, kind: str=None, enabled: bool=None, runtime_version: str=N self.additional_login_params = additional_login_params self.google_client_id = google_client_id self.google_client_secret = google_client_secret - self.google_oauth_scopes = google_oauth_scopes + self.google_o_auth_scopes = google_o_auth_scopes self.facebook_app_id = facebook_app_id self.facebook_app_secret = facebook_app_secret - self.facebook_oauth_scopes = facebook_oauth_scopes + self.facebook_o_auth_scopes = facebook_o_auth_scopes self.twitter_consumer_key = twitter_consumer_key self.twitter_consumer_secret = twitter_consumer_secret self.microsoft_account_client_id = microsoft_account_client_id self.microsoft_account_client_secret = microsoft_account_client_secret - self.microsoft_account_oauth_scopes = microsoft_account_oauth_scopes + self.microsoft_account_o_auth_scopes = microsoft_account_o_auth_scopes -class SiteCloneability(Model): +class SiteCloneability(msrest.serialization.Model): """Represents whether or not an app is cloneable. - :param result: Name of app. Possible values include: 'Cloneable', - 'PartiallyCloneable', 'NotCloneable' + :param result: Name of app. Possible values include: "Cloneable", "PartiallyCloneable", + "NotCloneable". :type result: str or ~azure.mgmt.web.v2018_02_01.models.CloneAbilityResult - :param blocking_features: List of features enabled on app that prevent - cloning. - :type blocking_features: - list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] - :param unsupported_features: List of features enabled on app that are - non-blocking but cannot be cloned. The app can still be cloned + :param blocking_features: List of features enabled on app that prevent cloning. + :type blocking_features: list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] + :param unsupported_features: List of features enabled on app that are non-blocking but cannot + be cloned. The app can still be cloned but the features in this list will not be set up on cloned app. - :type unsupported_features: - list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] - :param blocking_characteristics: List of blocking application - characteristics. + :type unsupported_features: list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] + :param blocking_characteristics: List of blocking application characteristics. :type blocking_characteristics: list[~azure.mgmt.web.v2018_02_01.models.SiteCloneabilityCriterion] """ _attribute_map = { - 'result': {'key': 'result', 'type': 'CloneAbilityResult'}, + 'result': {'key': 'result', 'type': 'str'}, 'blocking_features': {'key': 'blockingFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'unsupported_features': {'key': 'unsupportedFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'blocking_characteristics': {'key': 'blockingCharacteristics', 'type': '[SiteCloneabilityCriterion]'}, } - def __init__(self, *, result=None, blocking_features=None, unsupported_features=None, blocking_characteristics=None, **kwargs) -> None: + def __init__( + self, + *, + result: Optional[Union[str, "CloneAbilityResult"]] = None, + blocking_features: Optional[List["SiteCloneabilityCriterion"]] = None, + unsupported_features: Optional[List["SiteCloneabilityCriterion"]] = None, + blocking_characteristics: Optional[List["SiteCloneabilityCriterion"]] = None, + **kwargs + ): super(SiteCloneability, self).__init__(**kwargs) self.result = result self.blocking_features = blocking_features @@ -9005,7 +11322,7 @@ def __init__(self, *, result=None, blocking_features=None, unsupported_features= self.blocking_characteristics = blocking_characteristics -class SiteCloneabilityCriterion(Model): +class SiteCloneabilityCriterion(msrest.serialization.Model): """An app cloneability criterion. :param name: Name of criterion. @@ -9019,24 +11336,28 @@ class SiteCloneabilityCriterion(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(SiteCloneabilityCriterion, self).__init__(**kwargs) self.name = name self.description = description -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9044,27 +11365,27 @@ class SiteConfig(Model): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str @@ -9074,27 +11395,25 @@ class SiteConfig(Model): :type azure_storage_accounts: dict[str, ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2018_02_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2018_02_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9104,24 +11423,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2018_02_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2018_02_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2018_02_01.models.AutoHealRules @@ -9133,40 +11448,35 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2018_02_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2018_02_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2018_02_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2018_02_01.models.FtpsState :param reserved_instance_count: Number of reserved instances. - This setting only applies to the Consumption Plan + This setting only applies to the Consumption Plan. :type reserved_instance_count: int """ @@ -9206,9 +11516,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -9231,7 +11541,63 @@ class SiteConfig(Model): 'reserved_instance_count': {'key': 'reservedInstanceCount', 'type': 'int'}, } - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, windows_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, azure_storage_accounts=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, managed_service_identity_id: int=None, x_managed_service_identity_id: int=None, ip_security_restrictions=None, scm_ip_security_restrictions=None, scm_ip_security_restrictions_use_main: bool=None, http20_enabled: bool=True, min_tls_version=None, ftps_state=None, reserved_instance_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + windows_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + azure_storage_accounts: Optional[Dict[str, "AzureStorageInfoValue"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + managed_service_identity_id: Optional[int] = None, + x_managed_service_identity_id: Optional[int] = None, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions_use_main: Optional[bool] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + ftps_state: Optional[Union[str, "FtpsState"]] = None, + reserved_instance_count: Optional[int] = None, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -9291,8 +11657,7 @@ def __init__(self, *, number_of_workers: int=None, default_documents=None, net_f class SiteConfigResource(ProxyOnlyResource): """Web app configuration ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9306,8 +11671,7 @@ class SiteConfigResource(ProxyOnlyResource): :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9315,27 +11679,27 @@ class SiteConfigResource(ProxyOnlyResource): :type python_version: str :param node_version: Version of Node.js. :type node_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str @@ -9345,27 +11709,25 @@ class SiteConfigResource(ProxyOnlyResource): :type azure_storage_accounts: dict[str, ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2018_02_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2018_02_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2018_02_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO". :type scm_type: str or ~azure.mgmt.web.v2018_02_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9375,24 +11737,20 @@ class SiteConfigResource(ProxyOnlyResource): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2018_02_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2018_02_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2018_02_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2018_02_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2018_02_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2018_02_01.models.AutoHealRules @@ -9404,40 +11762,35 @@ class SiteConfigResource(ProxyOnlyResource): :type cors: ~azure.mgmt.web.v2018_02_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2018_02_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2018_02_01.models.ApiDefinitionInfo :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2018_02_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2018_02_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2018_02_01.models.FtpsState :param reserved_instance_count: Number of reserved instances. - This setting only applies to the Consumption Plan + This setting only applies to the Consumption Plan. :type reserved_instance_count: int """ @@ -9484,9 +11837,9 @@ class SiteConfigResource(ProxyOnlyResource): 'java_container': {'key': 'properties.javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'properties.javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'properties.appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'properties.virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'str'}, 'experiments': {'key': 'properties.experiments', 'type': 'Experiments'}, 'limits': {'key': 'properties.limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'properties.autoHealEnabled', 'type': 'bool'}, @@ -9509,7 +11862,64 @@ class SiteConfigResource(ProxyOnlyResource): 'reserved_instance_count': {'key': 'properties.reservedInstanceCount', 'type': 'int'}, } - def __init__(self, *, kind: str=None, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, windows_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, azure_storage_accounts=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, managed_service_identity_id: int=None, x_managed_service_identity_id: int=None, ip_security_restrictions=None, scm_ip_security_restrictions=None, scm_ip_security_restrictions_use_main: bool=None, http20_enabled: bool=True, min_tls_version=None, ftps_state=None, reserved_instance_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + windows_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + azure_storage_accounts: Optional[Dict[str, "AzureStorageInfoValue"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + managed_service_identity_id: Optional[int] = None, + x_managed_service_identity_id: Optional[int] = None, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions_use_main: Optional[bool] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + ftps_state: Optional[Union[str, "FtpsState"]] = None, + reserved_instance_count: Optional[int] = None, + **kwargs + ): super(SiteConfigResource, self).__init__(kind=kind, **kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -9566,11 +11976,44 @@ def __init__(self, *, kind: str=None, number_of_workers: int=None, default_docum self.reserved_instance_count = reserved_instance_count +class SiteConfigResourceCollection(msrest.serialization.Model): + """Collection of site configurations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteConfigResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteConfigResource"], + **kwargs + ): + super(SiteConfigResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteConfigurationSnapshotInfo(ProxyOnlyResource): """A snapshot of a web app configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9581,8 +12024,8 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :ivar time: The time the snapshot was taken. - :vartype time: datetime - :ivar snapshot_id: The id of the snapshot + :vartype time: ~datetime.datetime + :ivar snapshot_id: The id of the snapshot. :vartype snapshot_id: int """ @@ -9603,17 +12046,55 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'int'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SiteConfigurationSnapshotInfo, self).__init__(kind=kind, **kwargs) self.time = None self.snapshot_id = None +class SiteConfigurationSnapshotInfoCollection(msrest.serialization.Model): + """Collection of metadata for the app configuration snapshots that can be restored. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteConfigurationSnapshotInfo"], + **kwargs + ): + super(SiteConfigurationSnapshotInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteExtensionInfo(ProxyOnlyResource): """Site Extension Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9627,10 +12108,8 @@ class SiteExtensionInfo(ProxyOnlyResource): :type extension_id: str :param title: :type title: str - :param extension_type: Site extension type. Possible values include: - 'Gallery', 'WebRoot' - :type extension_type: str or - ~azure.mgmt.web.v2018_02_01.models.SiteExtensionType + :param extension_type: Site extension type. Possible values include: "Gallery", "WebRoot". + :type extension_type: str or ~azure.mgmt.web.v2018_02_01.models.SiteExtensionType :param summary: Summary description. :type summary: str :param description: Detailed description. @@ -9652,16 +12131,16 @@ class SiteExtensionInfo(ProxyOnlyResource): :param installer_command_line_params: Installer command line parameters. :type installer_command_line_params: str :param published_date_time: Published timestamp. - :type published_date_time: datetime + :type published_date_time: ~datetime.datetime :param download_count: Count of downloads. :type download_count: int - :param local_is_latest_version: true if the local version is - the latest version; false otherwise. + :param local_is_latest_version: :code:`true` if the local version is the latest + version; :code:`false` otherwise. :type local_is_latest_version: bool :param local_path: Local path. :type local_path: str :param installed_date_time: Installed timestamp. - :type installed_date_time: datetime + :type installed_date_time: ~datetime.datetime :param provisioning_state: Provisioning state. :type provisioning_state: str :param comment: Site Extension comment. @@ -9681,7 +12160,7 @@ class SiteExtensionInfo(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'extension_id': {'key': 'properties.extension_id', 'type': 'str'}, 'title': {'key': 'properties.title', 'type': 'str'}, - 'extension_type': {'key': 'properties.extension_type', 'type': 'SiteExtensionType'}, + 'extension_type': {'key': 'properties.extension_type', 'type': 'str'}, 'summary': {'key': 'properties.summary', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'str'}, @@ -9701,7 +12180,32 @@ class SiteExtensionInfo(ProxyOnlyResource): 'comment': {'key': 'properties.comment', 'type': 'str'}, } - def __init__(self, *, kind: str=None, extension_id: str=None, title: str=None, extension_type=None, summary: str=None, description: str=None, version: str=None, extension_url: str=None, project_url: str=None, icon_url: str=None, license_url: str=None, feed_url: str=None, authors=None, installer_command_line_params: str=None, published_date_time=None, download_count: int=None, local_is_latest_version: bool=None, local_path: str=None, installed_date_time=None, provisioning_state: str=None, comment: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + extension_id: Optional[str] = None, + title: Optional[str] = None, + extension_type: Optional[Union[str, "SiteExtensionType"]] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + version: Optional[str] = None, + extension_url: Optional[str] = None, + project_url: Optional[str] = None, + icon_url: Optional[str] = None, + license_url: Optional[str] = None, + feed_url: Optional[str] = None, + authors: Optional[List[str]] = None, + installer_command_line_params: Optional[str] = None, + published_date_time: Optional[datetime.datetime] = None, + download_count: Optional[int] = None, + local_is_latest_version: Optional[bool] = None, + local_path: Optional[str] = None, + installed_date_time: Optional[datetime.datetime] = None, + provisioning_state: Optional[str] = None, + comment: Optional[str] = None, + **kwargs + ): super(SiteExtensionInfo, self).__init__(kind=kind, **kwargs) self.extension_id = extension_id self.title = title @@ -9725,11 +12229,44 @@ def __init__(self, *, kind: str=None, extension_id: str=None, title: str=None, e self.comment = comment +class SiteExtensionInfoCollection(msrest.serialization.Model): + """Collection of Kudu site extension information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteExtensionInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteExtensionInfo"], + **kwargs + ): + super(SiteExtensionInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteInstance(ProxyOnlyResource): """Instance of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9758,12 +12295,17 @@ class SiteInstance(ProxyOnlyResource): 'site_instance_name': {'key': 'properties.siteInstanceName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SiteInstance, self).__init__(kind=kind, **kwargs) self.site_instance_name = None -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -9780,7 +12322,14 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: + def __init__( + self, + *, + max_percentage_cpu: Optional[float] = None, + max_memory_in_mb: Optional[int] = None, + max_disk_size_in_mb: Optional[int] = None, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = max_percentage_cpu self.max_memory_in_mb = max_memory_in_mb @@ -9790,8 +12339,7 @@ def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None class SiteLogsConfig(ProxyOnlyResource): """Configuration of App Service site logs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9802,16 +12350,13 @@ class SiteLogsConfig(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param application_logs: Application logs configuration. - :type application_logs: - ~azure.mgmt.web.v2018_02_01.models.ApplicationLogsConfig + :type application_logs: ~azure.mgmt.web.v2018_02_01.models.ApplicationLogsConfig :param http_logs: HTTP logs configuration. :type http_logs: ~azure.mgmt.web.v2018_02_01.models.HttpLogsConfig :param failed_requests_tracing: Failed requests tracing configuration. - :type failed_requests_tracing: - ~azure.mgmt.web.v2018_02_01.models.EnabledConfig + :type failed_requests_tracing: ~azure.mgmt.web.v2018_02_01.models.EnabledConfig :param detailed_error_messages: Detailed error messages configuration. - :type detailed_error_messages: - ~azure.mgmt.web.v2018_02_01.models.EnabledConfig + :type detailed_error_messages: ~azure.mgmt.web.v2018_02_01.models.EnabledConfig """ _validation = { @@ -9831,7 +12376,16 @@ class SiteLogsConfig(ProxyOnlyResource): 'detailed_error_messages': {'key': 'properties.detailedErrorMessages', 'type': 'EnabledConfig'}, } - def __init__(self, *, kind: str=None, application_logs=None, http_logs=None, failed_requests_tracing=None, detailed_error_messages=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + application_logs: Optional["ApplicationLogsConfig"] = None, + http_logs: Optional["HttpLogsConfig"] = None, + failed_requests_tracing: Optional["EnabledConfig"] = None, + detailed_error_messages: Optional["EnabledConfig"] = None, + **kwargs + ): super(SiteLogsConfig, self).__init__(kind=kind, **kwargs) self.application_logs = application_logs self.http_logs = http_logs @@ -9839,7 +12393,7 @@ def __init__(self, *, kind: str=None, application_logs=None, http_logs=None, fai self.detailed_error_messages = detailed_error_messages -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -9859,7 +12413,15 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + validation: Optional[str] = None, + validation_key: Optional[str] = None, + decryption: Optional[str] = None, + decryption_key: Optional[str] = None, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = validation self.validation_key = validation_key @@ -9870,8 +12432,7 @@ def __init__(self, *, validation: str=None, validation_key: str=None, decryption class SitePatchResource(ProxyOnlyResource): """ARM resource for a site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9881,128 +12442,108 @@ class SitePatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2018_02_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2018_02_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2018_02_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants. Read-only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2018_02_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2018_02_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2018_02_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2018_02_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param geo_distributions: GeoDistributions for this site - :type geo_distributions: - list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] - :param identity: - :type identity: ~azure.mgmt.web.v2018_02_01.models.ManagedServiceIdentity + :param geo_distributions: GeoDistributions for this site. + :type geo_distributions: list[~azure.mgmt.web.v2018_02_01.models.GeoDistribution] """ _validation = { @@ -10034,13 +12575,14 @@ class SitePatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -10068,14 +12610,39 @@ class SitePatchResource(ProxyOnlyResource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, 'geo_distributions': {'key': 'properties.geoDistributions', 'type': '[GeoDistribution]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, kind: str=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, client_cert_exclusion_paths: str=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, https_only: bool=None, redundancy_mode=None, geo_distributions=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + client_cert_exclusion_paths: Optional[str] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + https_only: Optional[bool] = None, + redundancy_mode: Optional[Union[str, "RedundancyMode"]] = None, + geo_distributions: Optional[List["GeoDistribution"]] = None, + **kwargs + ): super(SitePatchResource, self).__init__(kind=kind, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -10113,14 +12680,12 @@ def __init__(self, *, kind: str=None, enabled: bool=None, host_name_ssl_states=N self.redundancy_mode = redundancy_mode self.in_progress_operation_id = None self.geo_distributions = geo_distributions - self.identity = identity class SitePhpErrorLogFlag(ProxyOnlyResource): """Used for getting PHP error logging flag. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10157,7 +12722,16 @@ class SitePhpErrorLogFlag(ProxyOnlyResource): 'master_log_errors_max_length': {'key': 'properties.masterLogErrorsMaxLength', 'type': 'str'}, } - def __init__(self, *, kind: str=None, local_log_errors: str=None, master_log_errors: str=None, local_log_errors_max_length: str=None, master_log_errors_max_length: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + local_log_errors: Optional[str] = None, + master_log_errors: Optional[str] = None, + local_log_errors_max_length: Optional[str] = None, + master_log_errors_max_length: Optional[str] = None, + **kwargs + ): super(SitePhpErrorLogFlag, self).__init__(kind=kind, **kwargs) self.local_log_errors = local_log_errors self.master_log_errors = master_log_errors @@ -10165,12 +12739,12 @@ def __init__(self, *, kind: str=None, local_log_errors: str=None, master_log_err self.master_log_errors_max_length = master_log_errors_max_length -class SiteSeal(Model): +class SiteSeal(msrest.serialization.Model): """Site seal. All required parameters must be populated in order to send to Azure. - :param html: Required. HTML snippet + :param html: Required. HTML snippet. :type html: str """ @@ -10182,16 +12756,21 @@ class SiteSeal(Model): 'html': {'key': 'html', 'type': 'str'}, } - def __init__(self, *, html: str, **kwargs) -> None: + def __init__( + self, + *, + html: str, + **kwargs + ): super(SiteSeal, self).__init__(**kwargs) self.html = html -class SiteSealRequest(Model): +class SiteSealRequest(msrest.serialization.Model): """Site seal request. - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. + :param light_theme: If :code:`true` use the light color theme for site seal; + otherwise, use the default color theme. :type light_theme: bool :param locale: Locale of site seal. :type locale: str @@ -10202,7 +12781,13 @@ class SiteSealRequest(Model): 'locale': {'key': 'locale', 'type': 'str'}, } - def __init__(self, *, light_theme: bool=None, locale: str=None, **kwargs) -> None: + def __init__( + self, + *, + light_theme: Optional[bool] = None, + locale: Optional[str] = None, + **kwargs + ): super(SiteSealRequest, self).__init__(**kwargs) self.light_theme = light_theme self.locale = locale @@ -10211,8 +12796,7 @@ def __init__(self, *, light_theme: bool=None, locale: str=None, **kwargs) -> Non class SiteSourceControl(ProxyOnlyResource): """Source control configuration for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10226,15 +12810,15 @@ class SiteSourceControl(ProxyOnlyResource): :type repo_url: str :param branch: Name of branch to use for deployment. :type branch: str - :param is_manual_integration: true to limit to manual - integration; false to enable continuous integration (which - configures webhooks into online repos like GitHub). + :param is_manual_integration: :code:`true` to limit to manual integration; + :code:`false` to enable continuous integration (which configures webhooks into + online repos like GitHub). :type is_manual_integration: bool - :param deployment_rollback_enabled: true to enable deployment - rollback; otherwise, false. + :param deployment_rollback_enabled: :code:`true` to enable deployment rollback; + otherwise, :code:`false`. :type deployment_rollback_enabled: bool - :param is_mercurial: true for a Mercurial repository; - false for a Git repository. + :param is_mercurial: :code:`true` for a Mercurial repository; + :code:`false` for a Git repository. :type is_mercurial: bool """ @@ -10256,7 +12840,17 @@ class SiteSourceControl(ProxyOnlyResource): 'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_manual_integration: bool=None, deployment_rollback_enabled: bool=None, is_mercurial: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + is_manual_integration: Optional[bool] = None, + deployment_rollback_enabled: Optional[bool] = None, + is_mercurial: Optional[bool] = None, + **kwargs + ): super(SiteSourceControl, self).__init__(kind=kind, **kwargs) self.repo_url = repo_url self.branch = branch @@ -10265,7 +12859,7 @@ def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_m self.is_mercurial = is_mercurial -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -10285,7 +12879,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[str] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -10293,7 +12895,7 @@ def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, s self.scale_type = scale_type -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -10310,8 +12912,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2018_02_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2018_02_01.models.Capability] """ @@ -10326,7 +12927,19 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + sku_capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -10338,7 +12951,7 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class SkuInfo(Model): +class SkuInfo(msrest.serialization.Model): """SKU discovery information. :param resource_type: Resource type that this SKU applies to. @@ -10355,21 +12968,61 @@ class SkuInfo(Model): 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, } - def __init__(self, *, resource_type: str=None, sku=None, capacity=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional["SkuDescription"] = None, + capacity: Optional["SkuCapacity"] = None, + **kwargs + ): super(SkuInfo, self).__init__(**kwargs) self.resource_type = resource_type self.sku = sku self.capacity = capacity -class SkuInfos(Model): +class SkuInfoCollection(msrest.serialization.Model): + """Collection of SKU information. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SkuInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SkuInfo"], + **kwargs + ): + super(SkuInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SkuInfos(msrest.serialization.Model): """Collection of SKU information. :param resource_type: Resource type that this SKU applies to. :type resource_type: str :param skus: List of SKUs the subscription is able to use. - :type skus: - list[~azure.mgmt.web.v2018_02_01.models.GlobalCsmSkuDescription] + :type skus: list[~azure.mgmt.web.v2018_02_01.models.GlobalCsmSkuDescription] """ _attribute_map = { @@ -10377,7 +13030,13 @@ class SkuInfos(Model): 'skus': {'key': 'skus', 'type': '[GlobalCsmSkuDescription]'}, } - def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + skus: Optional[List["GlobalCsmSkuDescription"]] = None, + **kwargs + ): super(SkuInfos, self).__init__(**kwargs) self.resource_type = resource_type self.skus = skus @@ -10386,8 +13045,7 @@ def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: class SlotConfigNamesResource(ProxyOnlyResource): """Slot Config names azure resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10401,8 +13059,7 @@ class SlotConfigNamesResource(ProxyOnlyResource): :type connection_string_names: list[str] :param app_setting_names: List of application settings names. :type app_setting_names: list[str] - :param azure_storage_config_names: List of external Azure storage account - identifiers. + :param azure_storage_config_names: List of external Azure storage account identifiers. :type azure_storage_config_names: list[str] """ @@ -10422,7 +13079,15 @@ class SlotConfigNamesResource(ProxyOnlyResource): 'azure_storage_config_names': {'key': 'properties.azureStorageConfigNames', 'type': '[str]'}, } - def __init__(self, *, kind: str=None, connection_string_names=None, app_setting_names=None, azure_storage_config_names=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + connection_string_names: Optional[List[str]] = None, + app_setting_names: Optional[List[str]] = None, + azure_storage_config_names: Optional[List[str]] = None, + **kwargs + ): super(SlotConfigNamesResource, self).__init__(kind=kind, **kwargs) self.connection_string_names = connection_string_names self.app_setting_names = app_setting_names @@ -10432,8 +13097,7 @@ def __init__(self, *, kind: str=None, connection_string_names=None, app_setting_ class SlotDifference(ProxyOnlyResource): """A setting difference between two deployment slots of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10445,11 +13109,9 @@ class SlotDifference(ProxyOnlyResource): :vartype type: str :ivar level: Level of the difference: Information, Warning or Error. :vartype level: str - :ivar setting_type: The type of the setting: General, AppSetting or - ConnectionString. + :ivar setting_type: The type of the setting: General, AppSetting or ConnectionString. :vartype setting_type: str - :ivar diff_rule: Rule that describes how to process the setting difference - during a slot swap. + :ivar diff_rule: Rule that describes how to process the setting difference during a slot swap. :vartype diff_rule: str :ivar setting_name: Name of the setting. :vartype setting_name: str @@ -10488,7 +13150,12 @@ class SlotDifference(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SlotDifference, self).__init__(kind=kind, **kwargs) self.level = None self.setting_type = None @@ -10499,18 +13166,50 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.description = None -class SlotSwapStatus(Model): +class SlotDifferenceCollection(msrest.serialization.Model): + """Collection of slot differences. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SlotDifference] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SlotDifference]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SlotDifference"], + **kwargs + ): + super(SlotDifferenceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -10526,14 +13225,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -10550,7 +13252,14 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_taken: Optional[str] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = time_taken self.count = count @@ -10560,8 +13269,7 @@ def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str= class Snapshot(ProxyOnlyResource): """A snapshot of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10576,35 +13284,74 @@ class Snapshot(ProxyOnlyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'time': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'time': {'key': 'properties.time', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): + super(Snapshot, self).__init__(kind=kind, **kwargs) + self.time = None + + +class SnapshotCollection(msrest.serialization.Model): + """Collection of snapshots which can be used to revert an app to a previous time. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Snapshot] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'time': {'key': 'properties.time', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(Snapshot, self).__init__(kind=kind, **kwargs) - self.time = None + def __init__( + self, + *, + value: List["Snapshot"], + **kwargs + ): + super(SnapshotCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class SnapshotRecoverySource(Model): +class SnapshotRecoverySource(msrest.serialization.Model): """Specifies the web app that snapshot contents will be retrieved from. - :param location: Geographical location of the source web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the source web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the source app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -10614,7 +13361,13 @@ class SnapshotRecoverySource(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): super(SnapshotRecoverySource, self).__init__(**kwargs) self.location = location self.id = id @@ -10623,10 +13376,7 @@ def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: class SnapshotRestoreRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10636,26 +13386,24 @@ class SnapshotRestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app restore should be - done, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app restore should be done, formatted as a + DateTime string. :type snapshot_time: str - :param recovery_source: Optional. Specifies the web app that snapshot - contents will be retrieved from. + :param recovery_source: Optional. Specifies the web app that snapshot contents will be + retrieved from. If empty, the targeted web app will be used as the source. - :type recovery_source: - ~azure.mgmt.web.v2018_02_01.models.SnapshotRecoverySource - :param overwrite: Required. If true the restore operation can - overwrite source app; otherwise, false. + :type recovery_source: ~azure.mgmt.web.v2018_02_01.models.SnapshotRecoverySource + :param overwrite: If :code:`true` the restore operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -10663,7 +13411,6 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -10679,7 +13426,18 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_source=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, use_dr_secondary: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + snapshot_time: Optional[str] = None, + recovery_source: Optional["SnapshotRecoverySource"] = None, + overwrite: Optional[bool] = None, + recover_configuration: Optional[bool] = None, + ignore_conflicting_host_names: Optional[bool] = None, + use_dr_secondary: Optional[bool] = None, + **kwargs + ): super(SnapshotRestoreRequest, self).__init__(kind=kind, **kwargs) self.snapshot_time = snapshot_time self.recovery_source = recovery_source @@ -10689,25 +13447,24 @@ def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, self.use_dr_secondary = use_dr_secondary -class Solution(Model): +class Solution(msrest.serialization.Model): """Class Representing Solution for problems detected. :param id: Solution Id. :type id: float - :param display_name: Display Name of the solution + :param display_name: Display Name of the solution. :type display_name: str :param order: Order of the solution. :type order: float - :param description: Description of the solution + :param description: Description of the solution. :type description: str - :param type: Type of Solution. Possible values include: 'QuickSolution', - 'DeepInvestigation', 'BestPractices' + :param type: Type of Solution. Possible values include: "QuickSolution", "DeepInvestigation", + "BestPractices". :type type: str or ~azure.mgmt.web.v2018_02_01.models.SolutionType :param data: Solution Data. :type data: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] :param metadata: Solution Metadata. - :type metadata: - list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] + :type metadata: list[list[~azure.mgmt.web.v2018_02_01.models.NameValuePair]] """ _attribute_map = { @@ -10715,12 +13472,23 @@ class Solution(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'float'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'SolutionType'}, + 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'data', 'type': '[[NameValuePair]]'}, 'metadata': {'key': 'metadata', 'type': '[[NameValuePair]]'}, } - def __init__(self, *, id: float=None, display_name: str=None, order: float=None, description: str=None, type=None, data=None, metadata=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[float] = None, + display_name: Optional[str] = None, + order: Optional[float] = None, + description: Optional[str] = None, + type: Optional[Union[str, "SolutionType"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + metadata: Optional[List[List["NameValuePair"]]] = None, + **kwargs + ): super(Solution, self).__init__(**kwargs) self.id = id self.display_name = display_name @@ -10734,8 +13502,7 @@ def __init__(self, *, id: float=None, display_name: str=None, order: float=None, class SourceControl(ProxyOnlyResource): """The source control OAuth token. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10752,7 +13519,7 @@ class SourceControl(ProxyOnlyResource): :param refresh_token: OAuth refresh token. :type refresh_token: str :param expiration_time: OAuth token expiration. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime """ _validation = { @@ -10772,7 +13539,16 @@ class SourceControl(ProxyOnlyResource): 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, token: str=None, token_secret: str=None, refresh_token: str=None, expiration_time=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + token: Optional[str] = None, + token_secret: Optional[str] = None, + refresh_token: Optional[str] = None, + expiration_time: Optional[datetime.datetime] = None, + **kwargs + ): super(SourceControl, self).__init__(kind=kind, **kwargs) self.token = token self.token_secret = token_secret @@ -10780,21 +13556,54 @@ def __init__(self, *, kind: str=None, token: str=None, token_secret: str=None, r self.expiration_time = expiration_time -class StackMajorVersion(Model): +class SourceControlCollection(msrest.serialization.Model): + """Collection of source controls. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SourceControl"], + **kwargs + ): + super(SourceControlCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StackMajorVersion(msrest.serialization.Model): """Application stack major version. :param display_version: Application stack major version (display only). :type display_version: str :param runtime_version: Application stack major version (runtime only). :type runtime_version: str - :param is_default: true if this is the default major version; - otherwise, false. + :param is_default: :code:`true` if this is the default major version; otherwise, + :code:`false`. :type is_default: bool :param minor_versions: Minor versions associated with the major version. - :type minor_versions: - list[~azure.mgmt.web.v2018_02_01.models.StackMinorVersion] - :param application_insights: true if this supports - Application Insights; otherwise, false. + :type minor_versions: list[~azure.mgmt.web.v2018_02_01.models.StackMinorVersion] + :param application_insights: :code:`true` if this supports Application Insights; + otherwise, :code:`false`. :type application_insights: bool """ @@ -10806,7 +13615,16 @@ class StackMajorVersion(Model): 'application_insights': {'key': 'applicationInsights', 'type': 'bool'}, } - def __init__(self, *, display_version: str=None, runtime_version: str=None, is_default: bool=None, minor_versions=None, application_insights: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_version: Optional[str] = None, + runtime_version: Optional[str] = None, + is_default: Optional[bool] = None, + minor_versions: Optional[List["StackMinorVersion"]] = None, + application_insights: Optional[bool] = None, + **kwargs + ): super(StackMajorVersion, self).__init__(**kwargs) self.display_version = display_version self.runtime_version = runtime_version @@ -10815,18 +13633,18 @@ def __init__(self, *, display_version: str=None, runtime_version: str=None, is_d self.application_insights = application_insights -class StackMinorVersion(Model): +class StackMinorVersion(msrest.serialization.Model): """Application stack minor version. :param display_version: Application stack minor version (display only). :type display_version: str :param runtime_version: Application stack minor version (runtime only). :type runtime_version: str - :param is_default: true if this is the default minor version; - otherwise, false. + :param is_default: :code:`true` if this is the default minor version; otherwise, + :code:`false`. :type is_default: bool - :param is_remote_debugging_enabled: true if this supports - Remote Debugging, otherwise false. + :param is_remote_debugging_enabled: :code:`true` if this supports Remote + Debugging, otherwise :code:`false`. :type is_remote_debugging_enabled: bool """ @@ -10837,7 +13655,15 @@ class StackMinorVersion(Model): 'is_remote_debugging_enabled': {'key': 'isRemoteDebuggingEnabled', 'type': 'bool'}, } - def __init__(self, *, display_version: str=None, runtime_version: str=None, is_default: bool=None, is_remote_debugging_enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_version: Optional[str] = None, + runtime_version: Optional[str] = None, + is_default: Optional[bool] = None, + is_remote_debugging_enabled: Optional[bool] = None, + **kwargs + ): super(StackMinorVersion, self).__init__(**kwargs) self.display_version = display_version self.runtime_version = runtime_version @@ -10845,42 +13671,37 @@ def __init__(self, *, display_version: str=None, runtime_version: str=None, is_d self.is_remote_debugging_enabled = is_remote_debugging_enabled -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3', 'Default' - :type worker_size: str or - ~azure.mgmt.web.v2018_02_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Small", "Medium", "Large", + "D1", "D2", "D3", "Default". + :type worker_size: str or ~azure.mgmt.web.v2018_02_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str - :param is_linux: Is this a linux stamp capacity + :param is_linux: Is this a linux stamp capacity. :type is_linux: bool """ @@ -10889,8 +13710,8 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, @@ -10898,7 +13719,22 @@ class StampCapacity(Model): 'is_linux': {'key': 'isLinux', 'type': 'bool'}, } - def __init__(self, *, name: str=None, available_capacity: int=None, total_capacity: int=None, unit: str=None, compute_mode=None, worker_size=None, worker_size_id: int=None, exclude_from_capacity_allocation: bool=None, is_applicable_for_all_compute_modes: bool=None, site_mode: str=None, is_linux: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available_capacity: Optional[int] = None, + total_capacity: Optional[int] = None, + unit: Optional[str] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[Union[str, "WorkerSizeOptions"]] = None, + worker_size_id: Optional[int] = None, + exclude_from_capacity_allocation: Optional[bool] = None, + is_applicable_for_all_compute_modes: Optional[bool] = None, + site_mode: Optional[str] = None, + is_linux: Optional[bool] = None, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = name self.available_capacity = available_capacity @@ -10913,7 +13749,41 @@ def __init__(self, *, name: str=None, available_capacity: int=None, total_capaci self.is_linux = is_linux -class StatusCodesBasedTrigger(Model): +class StampCapacityCollection(msrest.serialization.Model): + """Collection of stamp capacities. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.StampCapacity] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StampCapacity]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StampCapacity"], + **kwargs + ): + super(StampCapacityCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -10936,7 +13806,16 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[int] = None, + sub_status: Optional[int] = None, + win32_status: Optional[int] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = status self.sub_status = sub_status @@ -10948,10 +13827,7 @@ def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int= class StorageMigrationOptions(ProxyOnlyResource): """Options for app content migration. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10961,17 +13837,15 @@ class StorageMigrationOptions(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param azurefiles_connection_string: Required. AzureFiles connection - string. + :param azurefiles_connection_string: AzureFiles connection string. :type azurefiles_connection_string: str - :param azurefiles_share: Required. AzureFiles share. + :param azurefiles_share: AzureFiles share. :type azurefiles_share: str - :param switch_site_after_migration: trueif the app should be - switched over; otherwise, false. Default value: False . + :param switch_site_after_migration: :code:`true`if the app should be switched + over; otherwise, :code:`false`. :type switch_site_after_migration: bool - :param block_write_access_to_site: true if the app should be - read only during copy operation; otherwise, false. Default - value: False . + :param block_write_access_to_site: :code:`true` if the app should be read only + during copy operation; otherwise, :code:`false`. :type block_write_access_to_site: bool """ @@ -10979,8 +13853,6 @@ class StorageMigrationOptions(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'azurefiles_connection_string': {'required': True}, - 'azurefiles_share': {'required': True}, } _attribute_map = { @@ -10994,7 +13866,16 @@ class StorageMigrationOptions(ProxyOnlyResource): 'block_write_access_to_site': {'key': 'properties.blockWriteAccessToSite', 'type': 'bool'}, } - def __init__(self, *, azurefiles_connection_string: str, azurefiles_share: str, kind: str=None, switch_site_after_migration: bool=False, block_write_access_to_site: bool=False, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + azurefiles_connection_string: Optional[str] = None, + azurefiles_share: Optional[str] = None, + switch_site_after_migration: Optional[bool] = False, + block_write_access_to_site: Optional[bool] = False, + **kwargs + ): super(StorageMigrationOptions, self).__init__(kind=kind, **kwargs) self.azurefiles_connection_string = azurefiles_connection_string self.azurefiles_share = azurefiles_share @@ -11005,8 +13886,7 @@ def __init__(self, *, azurefiles_connection_string: str, azurefiles_share: str, class StorageMigrationResponse(ProxyOnlyResource): """Response for a migration of app content request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11016,8 +13896,8 @@ class StorageMigrationResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the migration process, it will - return an operation ID identifying that particular migration operation. + :ivar operation_id: When server starts the migration process, it will return an operation ID + identifying that particular migration operation. :vartype operation_id: str """ @@ -11036,7 +13916,12 @@ class StorageMigrationResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(StorageMigrationResponse, self).__init__(kind=kind, **kwargs) self.operation_id = None @@ -11044,8 +13929,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class StringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11073,17 +13957,21 @@ class StringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): super(StringDictionary, self).__init__(kind=kind, **kwargs) self.properties = properties class SwiftVirtualNetwork(ProxyOnlyResource): - """Swift Virtual Network Contract. This is used to enable the new Swift way of - doing virtual network integration. + """Swift Virtual Network Contract. This is used to enable the new Swift way of doing virtual network integration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11093,12 +13981,12 @@ class SwiftVirtualNetwork(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param subnet_resource_id: The Virtual Network subnet's resource ID. This - is the subnet that this Web App will join. This subnet must have a - delegation to Microsoft.Web/serverFarms defined first. + :param subnet_resource_id: The Virtual Network subnet's resource ID. This is the subnet that + this Web App will join. This subnet must have a delegation to Microsoft.Web/serverFarms defined + first. :type subnet_resource_id: str - :param swift_supported: A flag that specifies if the scale unit this Web - App is on supports Swift integration. + :param swift_supported: A flag that specifies if the scale unit this Web App is on supports + Swift integration. :type swift_supported: bool """ @@ -11117,13 +14005,20 @@ class SwiftVirtualNetwork(ProxyOnlyResource): 'swift_supported': {'key': 'properties.swiftSupported', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, subnet_resource_id: str=None, swift_supported: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + subnet_resource_id: Optional[str] = None, + swift_supported: Optional[bool] = None, + **kwargs + ): super(SwiftVirtualNetwork, self).__init__(kind=kind, **kwargs) self.subnet_resource_id = subnet_resource_id self.swift_supported = swift_supported -class TldLegalAgreement(Model): +class TldLegalAgreement(msrest.serialization.Model): """Legal agreement for a top level domain. All required parameters must be populated in order to send to Azure. @@ -11151,7 +14046,15 @@ class TldLegalAgreement(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, agreement_key: str, title: str, content: str, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + agreement_key: str, + title: str, + content: str, + url: Optional[str] = None, + **kwargs + ): super(TldLegalAgreement, self).__init__(**kwargs) self.agreement_key = agreement_key self.title = title @@ -11159,11 +14062,44 @@ def __init__(self, *, agreement_key: str, title: str, content: str, url: str=Non self.url = url +class TldLegalAgreementCollection(msrest.serialization.Model): + """Collection of top-level domain legal agreements. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TldLegalAgreement] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TldLegalAgreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TldLegalAgreement"], + **kwargs + ): + super(TldLegalAgreementCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TopLevelDomain(ProxyOnlyResource): """A top level domain object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11173,8 +14109,8 @@ class TopLevelDomain(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param privacy: If true, then the top level domain supports - domain privacy; otherwise, false. + :param privacy: If :code:`true`, then the top level domain supports domain + privacy; otherwise, :code:`false`. :type privacy: bool """ @@ -11192,21 +14128,25 @@ class TopLevelDomain(ProxyOnlyResource): 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, privacy: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + privacy: Optional[bool] = None, + **kwargs + ): super(TopLevelDomain, self).__init__(kind=kind, **kwargs) self.privacy = privacy -class TopLevelDomainAgreementOption(Model): +class TopLevelDomainAgreementOption(msrest.serialization.Model): """Options for retrieving the list of top level domain legal agreements. - :param include_privacy: If true, then the list of agreements - will include agreements for domain privacy as well; otherwise, - false. + :param include_privacy: If :code:`true`, then the list of agreements will include + agreements for domain privacy as well; otherwise, :code:`false`. :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. + :param for_transfer: If :code:`true`, then the list of agreements will include + agreements for domain transfer as well; otherwise, :code:`false`. :type for_transfer: bool """ @@ -11215,18 +14155,56 @@ class TopLevelDomainAgreementOption(Model): 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, } - def __init__(self, *, include_privacy: bool=None, for_transfer: bool=None, **kwargs) -> None: + def __init__( + self, + *, + include_privacy: Optional[bool] = None, + for_transfer: Optional[bool] = None, + **kwargs + ): super(TopLevelDomainAgreementOption, self).__init__(**kwargs) self.include_privacy = include_privacy self.for_transfer = for_transfer +class TopLevelDomainCollection(msrest.serialization.Model): + """Collection of Top-level domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TopLevelDomain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopLevelDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TopLevelDomain"], + **kwargs + ): + super(TopLevelDomainCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TriggeredJobHistory(ProxyOnlyResource): - """Triggered Web Job History. List of Triggered Web Job Run Information - elements. + """Triggered Web Job History. List of Triggered Web Job Run Information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11254,16 +14232,55 @@ class TriggeredJobHistory(ProxyOnlyResource): 'runs': {'key': 'properties.runs', 'type': '[TriggeredJobRun]'}, } - def __init__(self, *, kind: str=None, runs=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + runs: Optional[List["TriggeredJobRun"]] = None, + **kwargs + ): super(TriggeredJobHistory, self).__init__(kind=kind, **kwargs) self.runs = runs +class TriggeredJobHistoryCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredJobHistory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TriggeredJobHistory"], + **kwargs + ): + super(TriggeredJobHistoryCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TriggeredJobRun(ProxyOnlyResource): """Triggered Web Job Run Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11277,14 +14294,12 @@ class TriggeredJobRun(ProxyOnlyResource): :type web_job_id: str :param web_job_name: Job name. :type web_job_name: str - :param status: Job status. Possible values include: 'Success', 'Failed', - 'Error' - :type status: str or - ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobStatus + :param status: Job status. Possible values include: "Success", "Failed", "Error". + :type status: str or ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobStatus :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime + :type end_time: ~datetime.datetime :param duration: Job duration. :type duration: str :param output_url: Output URL. @@ -11312,7 +14327,7 @@ class TriggeredJobRun(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'web_job_id': {'key': 'properties.web_job_id', 'type': 'str'}, 'web_job_name': {'key': 'properties.web_job_name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TriggeredWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'start_time': {'key': 'properties.start_time', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.end_time', 'type': 'iso-8601'}, 'duration': {'key': 'properties.duration', 'type': 'str'}, @@ -11323,7 +14338,23 @@ class TriggeredJobRun(ProxyOnlyResource): 'trigger': {'key': 'properties.trigger', 'type': 'str'}, } - def __init__(self, *, kind: str=None, web_job_id: str=None, web_job_name: str=None, status=None, start_time=None, end_time=None, duration: str=None, output_url: str=None, error_url: str=None, url: str=None, job_name: str=None, trigger: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + web_job_id: Optional[str] = None, + web_job_name: Optional[str] = None, + status: Optional[Union[str, "TriggeredWebJobStatus"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + duration: Optional[str] = None, + output_url: Optional[str] = None, + error_url: Optional[str] = None, + url: Optional[str] = None, + job_name: Optional[str] = None, + trigger: Optional[str] = None, + **kwargs + ): super(TriggeredJobRun, self).__init__(kind=kind, **kwargs) self.web_job_id = web_job_id self.web_job_name = web_job_name @@ -11341,8 +14372,7 @@ def __init__(self, *, kind: str=None, web_job_id: str=None, web_job_name: str=No class TriggeredWebJob(ProxyOnlyResource): """Triggered Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11364,12 +14394,11 @@ class TriggeredWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2018_02_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -11392,13 +14421,28 @@ class TriggeredWebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, latest_run=None, history_url: str=None, scheduler_logs_url: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, web_job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + latest_run: Optional["TriggeredJobRun"] = None, + history_url: Optional[str] = None, + scheduler_logs_url: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + web_job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(TriggeredWebJob, self).__init__(kind=kind, **kwargs) self.latest_run = latest_run self.history_url = history_url @@ -11412,11 +14456,44 @@ def __init__(self, *, kind: str=None, latest_run=None, history_url: str=None, sc self.settings = settings +class TriggeredWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TriggeredWebJob"], + **kwargs + ): + super(TriggeredWebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class Usage(ProxyOnlyResource): """Usage of the quota resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11437,11 +14514,10 @@ class Usage(ProxyOnlyResource): :ivar limit: The resource limit. :vartype limit: long :ivar next_reset_time: Next reset time for the resource counter. - :vartype next_reset_time: datetime - :ivar compute_mode: Compute mode used for this usage. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :vartype compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :vartype next_reset_time: ~datetime.datetime + :ivar compute_mode: Compute mode used for this usage. Possible values include: "Shared", + "Dedicated", "Dynamic". + :vartype compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions :ivar site_mode: Site mode used for this usage. :vartype site_mode: str """ @@ -11471,11 +14547,16 @@ class Usage(ProxyOnlyResource): 'current_value': {'key': 'properties.currentValue', 'type': 'long'}, 'limit': {'key': 'properties.limit', 'type': 'long'}, 'next_reset_time': {'key': 'properties.nextResetTime', 'type': 'iso-8601'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'site_mode': {'key': 'properties.siteMode', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(Usage, self).__init__(kind=kind, **kwargs) self.display_name = None self.resource_name = None @@ -11487,14 +14568,45 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.site_mode = None -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class UsageCollection(msrest.serialization.Model): + """Collection of usages. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.Usage] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Usage"], + **kwargs + ): + super(UsageCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class User(ProxyOnlyResource): + """User credentials used for publishing activity. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -11503,14 +14615,13 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str :param scm_uri: Url of SCM site. :type scm_uri: str @@ -11520,7 +14631,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -11535,7 +14645,17 @@ class User(ProxyOnlyResource): 'scm_uri': {'key': 'properties.scmUri', 'type': 'str'}, } - def __init__(self, *, publishing_user_name: str, kind: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, scm_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + publishing_user_name: Optional[str] = None, + publishing_password: Optional[str] = None, + publishing_password_hash: Optional[str] = None, + publishing_password_hash_salt: Optional[str] = None, + scm_uri: Optional[str] = None, + **kwargs + ): super(User, self).__init__(kind=kind, **kwargs) self.publishing_user_name = publishing_user_name self.publishing_password = publishing_password @@ -11544,20 +14664,20 @@ def __init__(self, *, publishing_user_name: str, kind: str=None, publishing_pass self.scm_uri = scm_uri -class ValidateContainerSettingsRequest(Model): +class ValidateContainerSettingsRequest(msrest.serialization.Model): """Container settings validation request context. - :param base_url: Base URL of the container registry + :param base_url: Base URL of the container registry. :type base_url: str - :param username: Username for to access the container registry + :param username: Username for to access the container registry. :type username: str - :param password: Password for to access the container registry + :param password: Password for to access the container registry. :type password: str - :param repository: Repository name (image name) + :param repository: Repository name (image name). :type repository: str - :param tag: Image tag + :param tag: Image tag. :type tag: str - :param platform: Platform (windows or linux) + :param platform: Platform (windows or linux). :type platform: str """ @@ -11570,7 +14690,17 @@ class ValidateContainerSettingsRequest(Model): 'platform': {'key': 'platform', 'type': 'str'}, } - def __init__(self, *, base_url: str=None, username: str=None, password: str=None, repository: str=None, tag: str=None, platform: str=None, **kwargs) -> None: + def __init__( + self, + *, + base_url: Optional[str] = None, + username: Optional[str] = None, + password: Optional[str] = None, + repository: Optional[str] = None, + tag: Optional[str] = None, + platform: Optional[str] = None, + **kwargs + ): super(ValidateContainerSettingsRequest, self).__init__(**kwargs) self.base_url = base_url self.username = username @@ -11580,37 +14710,35 @@ def __init__(self, *, base_url: str=None, username: str=None, password: str=None self.platform = platform -class ValidateRequest(Model): +class ValidateRequest(msrest.serialization.Model): """Resource validation request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'ServerFarm', 'Site' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.ValidateResourceTypes + :param type: Required. Resource type used for verification. Possible values include: + "ServerFarm", "Site". + :type type: str or ~azure.mgmt.web.v2018_02_01.models.ValidateResourceTypes :param location: Required. Expected location of the resource. :type location: str - :param server_farm_id: ARM resource ID of an App Service plan that would - host the app. + :param server_farm_id: ARM resource ID of an App Service plan that would host the app. :type server_farm_id: str :param sku_name: Name of the target SKU for the App Service plan. :type sku_name: str - :param need_linux_workers: true if App Service plan is for - Linux workers; otherwise, false. + :param need_linux_workers: :code:`true` if App Service plan is for Linux workers; + otherwise, :code:`false`. :type need_linux_workers: bool - :param is_spot: true if App Service plan is for Spot - instances; otherwise, false. + :param is_spot: :code:`true` if App Service plan is for Spot instances; otherwise, + :code:`false`. :type is_spot: bool :param capacity: Target capacity of the App Service plan (number of VMs). :type capacity: int - :param hosting_environment: Name of App Service Environment where app or - App Service plan should be created. + :param hosting_environment: Name of App Service Environment where app or App Service plan + should be created. :type hosting_environment: str - :param is_xenon: true if App Service plan is running as a - windows container + :param is_xenon: :code:`true` if App Service plan is running as a windows + container. :type is_xenon: bool """ @@ -11634,7 +14762,21 @@ class ValidateRequest(Model): 'is_xenon': {'key': 'properties.isXenon', 'type': 'bool'}, } - def __init__(self, *, name: str, type, location: str, server_farm_id: str=None, sku_name: str=None, need_linux_workers: bool=None, is_spot: bool=None, capacity: int=None, hosting_environment: str=None, is_xenon: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + type: Union[str, "ValidateResourceTypes"], + location: str, + server_farm_id: Optional[str] = None, + sku_name: Optional[str] = None, + need_linux_workers: Optional[bool] = None, + is_spot: Optional[bool] = None, + capacity: Optional[int] = None, + hosting_environment: Optional[str] = None, + is_xenon: Optional[bool] = None, + **kwargs + ): super(ValidateRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -11648,7 +14790,7 @@ def __init__(self, *, name: str, type, location: str, server_farm_id: str=None, self.is_xenon = is_xenon -class ValidateResponse(Model): +class ValidateResponse(msrest.serialization.Model): """Describes the result of resource validation. :param status: Result of validation. @@ -11662,13 +14804,19 @@ class ValidateResponse(Model): 'error': {'key': 'error', 'type': 'ValidateResponseError'}, } - def __init__(self, *, status: str=None, error=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ValidateResponseError"] = None, + **kwargs + ): super(ValidateResponse, self).__init__(**kwargs) self.status = status self.error = error -class ValidateResponseError(Model): +class ValidateResponseError(msrest.serialization.Model): """Error details for when validation fails. :param code: Validation error code. @@ -11682,25 +14830,30 @@ class ValidateResponseError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ValidateResponseError, self).__init__(**kwargs) self.code = code self.message = message -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2018_02_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2018_02_01.models.VirtualDirectory] """ _attribute_map = { @@ -11710,7 +14863,15 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + preload_enabled: Optional[bool] = None, + virtual_directories: Optional[List["VirtualDirectory"]] = None, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path @@ -11718,7 +14879,7 @@ def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_e self.virtual_directories = virtual_directories -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -11732,13 +14893,19 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -11758,7 +14925,15 @@ class VirtualIPMapping(Model): 'in_use': {'key': 'inUse', 'type': 'bool'}, } - def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, internal_https_port: int=None, in_use: bool=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_ip: Optional[str] = None, + internal_http_port: Optional[int] = None, + internal_https_port: Optional[int] = None, + in_use: Optional[bool] = None, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = virtual_ip self.internal_http_port = internal_http_port @@ -11766,11 +14941,10 @@ def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, intern self.in_use = in_use -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -11794,7 +14968,13 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + subnet: Optional[str] = None, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = id self.name = None @@ -11803,13 +14983,9 @@ def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11821,8 +14997,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -11830,7 +15005,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -11842,7 +15016,14 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_name: Optional[str] = None, + vpn_package_uri: Optional[str] = None, + **kwargs + ): super(VnetGateway, self).__init__(kind=kind, **kwargs) self.vnet_name = vnet_name self.vpn_package_uri = vpn_package_uri @@ -11851,8 +15032,7 @@ def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11866,19 +15046,19 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: str :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str - :param is_swift: Flag that is used to denote if this is VNET injection + :param is_swift: Flag that is used to denote if this is VNET injection. :type is_swift: bool """ @@ -11905,7 +15085,16 @@ class VnetInfo(ProxyOnlyResource): 'is_swift': {'key': 'properties.isSwift', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: str=None, dns_servers: str=None, is_swift: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_id: Optional[str] = None, + cert_blob: Optional[str] = None, + dns_servers: Optional[str] = None, + is_swift: Optional[bool] = None, + **kwargs + ): super(VnetInfo, self).__init__(kind=kind, **kwargs) self.vnet_resource_id = vnet_resource_id self.cert_thumbprint = None @@ -11919,8 +15108,7 @@ def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: str class VnetParameters(ProxyOnlyResource): """The required set of inputs to validate a VNET. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11930,11 +15118,11 @@ class VnetParameters(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_resource_group: The Resource Group of the VNET to be validated + :param vnet_resource_group: The Resource Group of the VNET to be validated. :type vnet_resource_group: str - :param vnet_name: The name of the VNET to be validated + :param vnet_name: The name of the VNET to be validated. :type vnet_name: str - :param vnet_subnet_name: The subnet name to be validated + :param vnet_subnet_name: The subnet name to be validated. :type vnet_subnet_name: str """ @@ -11954,7 +15142,15 @@ class VnetParameters(ProxyOnlyResource): 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_resource_group: str=None, vnet_name: str=None, vnet_subnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_group: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + **kwargs + ): super(VnetParameters, self).__init__(kind=kind, **kwargs) self.vnet_resource_group = vnet_resource_group self.vnet_name = vnet_name @@ -11962,11 +15158,9 @@ def __init__(self, *, kind: str=None, vnet_resource_group: str=None, vnet_name: class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11976,20 +15170,19 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2018_02_01.models.RouteType """ @@ -12009,7 +15202,15 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_address: Optional[str] = None, + end_address: Optional[str] = None, + route_type: Optional[Union[str, "RouteType"]] = None, + **kwargs + ): super(VnetRoute, self).__init__(kind=kind, **kwargs) self.start_address = start_address self.end_address = end_address @@ -12019,8 +15220,7 @@ def __init__(self, *, kind: str=None, start_address: str=None, end_address: str= class VnetValidationFailureDetails(ProxyOnlyResource): """A class that describes the reason for a validation failure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12033,8 +15233,7 @@ class VnetValidationFailureDetails(ProxyOnlyResource): :param failed: A flag describing whether or not validation failed. :type failed: bool :param failed_tests: A list of tests that failed in the validation. - :type failed_tests: - list[~azure.mgmt.web.v2018_02_01.models.VnetValidationTestFailure] + :type failed_tests: list[~azure.mgmt.web.v2018_02_01.models.VnetValidationTestFailure] """ _validation = { @@ -12052,7 +15251,14 @@ class VnetValidationFailureDetails(ProxyOnlyResource): 'failed_tests': {'key': 'properties.failedTests', 'type': '[VnetValidationTestFailure]'}, } - def __init__(self, *, kind: str=None, failed: bool=None, failed_tests=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + failed: Optional[bool] = None, + failed_tests: Optional[List["VnetValidationTestFailure"]] = None, + **kwargs + ): super(VnetValidationFailureDetails, self).__init__(kind=kind, **kwargs) self.failed = failed self.failed_tests = failed_tests @@ -12061,8 +15267,7 @@ def __init__(self, *, kind: str=None, failed: bool=None, failed_tests=None, **kw class VnetValidationTestFailure(ProxyOnlyResource): """A class that describes a test that failed during NSG and UDR validation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12074,8 +15279,7 @@ class VnetValidationTestFailure(ProxyOnlyResource): :vartype type: str :param test_name: The name of the test that failed. :type test_name: str - :param details: The details of what caused the failure, e.g. the blocking - rule name, etc. + :param details: The details of what caused the failure, e.g. the blocking rule name, etc. :type details: str """ @@ -12094,17 +15298,23 @@ class VnetValidationTestFailure(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, *, kind: str=None, test_name: str=None, details: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + test_name: Optional[str] = None, + details: Optional[str] = None, + **kwargs + ): super(VnetValidationTestFailure, self).__init__(kind=kind, **kwargs) self.test_name = test_name self.details = details -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -12124,17 +15334,55 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["Site"], + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) self.value = value self.next_link = None +class WebAppInstanceCollection(msrest.serialization.Model): + """Collection of app instances. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.SiteInstance] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteInstance"], + **kwargs + ): + super(WebAppInstanceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WebJob(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12150,12 +15398,11 @@ class WebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2018_02_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -12175,13 +15422,25 @@ class WebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, web_job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + web_job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(WebJob, self).__init__(kind=kind, **kwargs) self.run_command = run_command self.url = url @@ -12192,24 +15451,55 @@ def __init__(self, *, kind: str=None, run_command: str=None, url: str=None, extr self.settings = settings -class WorkerPool(Model): +class WebJobCollection(msrest.serialization.Model): + """Collection of Kudu web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.WebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["WebJob"], + **kwargs + ): + super(WebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -12219,13 +15509,21 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = worker_size_id self.compute_mode = compute_mode @@ -12234,11 +15532,44 @@ def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: self.instance_names = None +class WorkerPoolCollection(msrest.serialization.Model): + """Collection of worker pools. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkerPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["WorkerPoolResource"], + **kwargs + ): + super(WorkerPoolCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WorkerPoolResource(ProxyOnlyResource): """Worker pool of an App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12248,21 +15579,19 @@ class WorkerPoolResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2018_02_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] - :param sku: - :type sku: ~azure.mgmt.web.v2018_02_01.models.SkuDescription """ _validation = { @@ -12277,19 +15606,29 @@ class WorkerPoolResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_size_id': {'key': 'properties.workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'worker_size': {'key': 'properties.workerSize', 'type': 'str'}, 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, 'instance_names': {'key': 'properties.instanceNames', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, *, kind: str=None, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional["SkuDescription"] = None, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPoolResource, self).__init__(kind=kind, **kwargs) + self.sku = sku self.worker_size_id = worker_size_id self.compute_mode = compute_mode self.worker_size = worker_size self.worker_count = worker_count self.instance_names = None - self.sku = sku diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_web_site_management_client_enums.py index a4db9855c59f..656e23af4e9b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_web_site_management_client_enums.py @@ -1,559 +1,690 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class KeyVaultSecretStatus(str, Enum): - - initialized = "Initialized" - waiting_on_certificate_order = "WaitingOnCertificateOrder" - succeeded = "Succeeded" - certificate_order_failed = "CertificateOrderFailed" - operation_not_permitted_on_key_vault = "OperationNotPermittedOnKeyVault" - azure_service_unauthorized_to_access_key_vault = "AzureServiceUnauthorizedToAccessKeyVault" - key_vault_does_not_exist = "KeyVaultDoesNotExist" - key_vault_secret_does_not_exist = "KeyVaultSecretDoesNotExist" - unknown_error = "UnknownError" - external_private_key = "ExternalPrivateKey" - unknown = "Unknown" - - -class CertificateProductType(str, Enum): - - standard_domain_validated_ssl = "StandardDomainValidatedSsl" - standard_domain_validated_wild_card_ssl = "StandardDomainValidatedWildCardSsl" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" - - -class CertificateOrderStatus(str, Enum): - - pendingissuance = "Pendingissuance" - issued = "Issued" - revoked = "Revoked" - canceled = "Canceled" - denied = "Denied" - pendingrevocation = "Pendingrevocation" - pending_rekey = "PendingRekey" - unused = "Unused" - expired = "Expired" - not_submitted = "NotSubmitted" - - -class CertificateOrderActionType(str, Enum): - - certificate_issued = "CertificateIssued" - certificate_order_canceled = "CertificateOrderCanceled" - certificate_order_created = "CertificateOrderCreated" - certificate_revoked = "CertificateRevoked" - domain_validation_complete = "DomainValidationComplete" - fraud_detected = "FraudDetected" - org_name_change = "OrgNameChange" - org_validation_complete = "OrgValidationComplete" - san_drop = "SanDrop" - fraud_cleared = "FraudCleared" - certificate_expired = "CertificateExpired" - certificate_expiration_warning = "CertificateExpirationWarning" - fraud_documentation_required = "FraudDocumentationRequired" - unknown = "Unknown" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned, UserAssigned" - none = "None" - - -class IpFilterTag(str, Enum): - - default = "Default" - xff_proxy = "XffProxy" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class AzureStorageType(str, Enum): - - azure_files = "AzureFiles" - azure_blob = "AzureBlob" - - -class AzureStorageState(str, Enum): - - ok = "Ok" - invalid_credentials = "InvalidCredentials" - invalid_share = "InvalidShare" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class FtpsState(str, Enum): - - all_allowed = "AllAllowed" - ftps_only = "FtpsOnly" - disabled = "Disabled" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class RedundancyMode(str, Enum): - - none = "None" - manual = "Manual" - failover = "Failover" - active_active = "ActiveActive" - geo_redundant = "GeoRedundant" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" - - -class DomainStatus(str, Enum): - - active = "Active" - awaiting = "Awaiting" - cancelled = "Cancelled" - confiscated = "Confiscated" - disabled = "Disabled" - excluded = "Excluded" - expired = "Expired" - failed = "Failed" - held = "Held" - locked = "Locked" - parked = "Parked" - pending = "Pending" - reserved = "Reserved" - reverted = "Reverted" - suspended = "Suspended" - transferred = "Transferred" - unknown = "Unknown" - unlocked = "Unlocked" - unparked = "Unparked" - updated = "Updated" - json_converter_failed = "JsonConverterFailed" - - -class AzureResourceType(str, Enum): - - website = "Website" - traffic_manager = "TrafficManager" - - -class CustomHostNameDnsRecordType(str, Enum): - - cname = "CName" - a = "A" - - -class HostNameType(str, Enum): - - verified = "Verified" - managed = "Managed" - - -class DnsType(str, Enum): - - azure_dns = "AzureDns" - default_domain_registrar_dns = "DefaultDomainRegistrarDns" - - -class DomainType(str, Enum): - - regular = "Regular" - soft_deleted = "SoftDeleted" - - -class HostingEnvironmentStatus(str, Enum): - - preparing = "Preparing" - ready = "Ready" - scaling = "Scaling" - deleting = "Deleting" - - -class InternalLoadBalancingMode(str, Enum): - - none = "None" - web = "Web" - publishing = "Publishing" - - -class ComputeModeOptions(str, Enum): - - shared = "Shared" - dedicated = "Dedicated" - dynamic = "Dynamic" - - -class WorkerSizeOptions(str, Enum): - - small = "Small" - medium = "Medium" - large = "Large" - d1 = "D1" - d2 = "D2" - d3 = "D3" - default = "Default" - - -class AccessControlEntryAction(str, Enum): - - permit = "Permit" - deny = "Deny" - - -class OperationStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - - -class IssueType(str, Enum): - - service_incident = "ServiceIncident" - app_deployment = "AppDeployment" - app_crash = "AppCrash" - runtime_issue_detected = "RuntimeIssueDetected" - ase_deployment = "AseDeployment" - user_issue = "UserIssue" - platform_issue = "PlatformIssue" - other = "Other" - - -class SolutionType(str, Enum): - - quick_solution = "QuickSolution" - deep_investigation = "DeepInvestigation" - best_practices = "BestPractices" - - -class RenderingType(str, Enum): - - no_graph = "NoGraph" - table = "Table" - time_series = "TimeSeries" - time_series_per_instance = "TimeSeriesPerInstance" - - -class ResourceScopeType(str, Enum): - - server_farm = "ServerFarm" - subscription = "Subscription" - web_site = "WebSite" - - -class NotificationLevel(str, Enum): - - critical = "Critical" - warning = "Warning" - information = "Information" - non_urgent_suggestion = "NonUrgentSuggestion" - - -class Channels(str, Enum): - - notification = "Notification" - api = "Api" - email = "Email" - webhook = "Webhook" - all = "All" - - -class AppServicePlanRestrictions(str, Enum): - - none = "None" - free = "Free" - shared = "Shared" - basic = "Basic" - standard = "Standard" - premium = "Premium" - - -class InAvailabilityReasonType(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" - - -class CheckNameResourceTypes(str, Enum): - - site = "Site" - slot = "Slot" - hosting_environment = "HostingEnvironment" - publishing_user = "PublishingUser" - microsoft_websites = "Microsoft.Web/sites" - microsoft_websitesslots = "Microsoft.Web/sites/slots" - microsoft_webhosting_environments = "Microsoft.Web/hostingEnvironments" - microsoft_webpublishing_users = "Microsoft.Web/publishingUsers" - - -class ValidateResourceTypes(str, Enum): - - server_farm = "ServerFarm" - site = "Site" - - -class LogLevel(str, Enum): - - off = "Off" - verbose = "Verbose" - information = "Information" - warning = "Warning" - error = "Error" - - -class BackupItemStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - skipped = "Skipped" - partially_succeeded = "PartiallySucceeded" - delete_in_progress = "DeleteInProgress" - delete_failed = "DeleteFailed" - deleted = "Deleted" - - -class DatabaseType(str, Enum): - - sql_azure = "SqlAzure" - my_sql = "MySql" - local_my_sql = "LocalMySql" - postgre_sql = "PostgreSql" - - -class FrequencyUnit(str, Enum): - - day = "Day" - hour = "Hour" - - -class ContinuousWebJobStatus(str, Enum): - - initializing = "Initializing" - starting = "Starting" - running = "Running" - pending_restart = "PendingRestart" - stopped = "Stopped" - - -class WebJobType(str, Enum): - - continuous = "Continuous" - triggered = "Triggered" - - -class PublishingProfileFormat(str, Enum): - - file_zilla3 = "FileZilla3" - web_deploy = "WebDeploy" - ftp = "Ftp" - - -class DnsVerificationTestResult(str, Enum): - - passed = "Passed" - failed = "Failed" - skipped = "Skipped" - - -class MSDeployLogEntryType(str, Enum): - - message = "Message" - warning = "Warning" - error = "Error" - - -class MSDeployProvisioningState(str, Enum): - - accepted = "accepted" - running = "running" - succeeded = "succeeded" - failed = "failed" - canceled = "canceled" - - -class MySqlMigrationType(str, Enum): - - local_to_remote = "LocalToRemote" - remote_to_local = "RemoteToLocal" - - -class PublicCertificateLocation(str, Enum): - - current_user_my = "CurrentUserMy" - local_machine_my = "LocalMachineMy" - unknown = "Unknown" - - -class BackupRestoreOperationType(str, Enum): - - default = "Default" - clone = "Clone" - relocation = "Relocation" - snapshot = "Snapshot" - cloud_fs = "CloudFS" - - -class UnauthenticatedClientAction(str, Enum): - - redirect_to_login_page = "RedirectToLoginPage" - allow_anonymous = "AllowAnonymous" - - -class BuiltInAuthenticationProvider(str, Enum): - - azure_active_directory = "AzureActiveDirectory" - facebook = "Facebook" - google = "Google" - microsoft_account = "MicrosoftAccount" - twitter = "Twitter" - - -class CloneAbilityResult(str, Enum): - - cloneable = "Cloneable" - partially_cloneable = "PartiallyCloneable" - not_cloneable = "NotCloneable" - - -class SiteExtensionType(str, Enum): - - gallery = "Gallery" - web_root = "WebRoot" - - -class TriggeredWebJobStatus(str, Enum): - - success = "Success" - failed = "Failed" - error = "Error" - - -class SkuName(str, Enum): - - free = "Free" - shared = "Shared" - basic = "Basic" - standard = "Standard" - premium = "Premium" - dynamic = "Dynamic" - isolated = "Isolated" - premium_v2 = "PremiumV2" - elastic_premium = "ElasticPremium" - elastic_isolated = "ElasticIsolated" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AccessControlEntryAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action object. + """ + + PERMIT = "Permit" + DENY = "Deny" + +class AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class AppServicePlanRestrictions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plans this offer is restricted to. + """ + + NONE = "None" + FREE = "Free" + SHARED = "Shared" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class AutoHealActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Predefined action to be taken. + """ + + RECYCLE = "Recycle" + LOG_EVENT = "LogEvent" + CUSTOM_ACTION = "CustomAction" + +class AzureResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Azure resource the hostname is assigned to. + """ + + WEBSITE = "Website" + TRAFFIC_MANAGER = "TrafficManager" + +class AzureStorageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the storage account. + """ + + OK = "Ok" + INVALID_CREDENTIALS = "InvalidCredentials" + INVALID_SHARE = "InvalidShare" + +class AzureStorageType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of storage. + """ + + AZURE_FILES = "AzureFiles" + AZURE_BLOB = "AzureBlob" + +class BackupItemStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Backup status. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + SKIPPED = "Skipped" + PARTIALLY_SUCCEEDED = "PartiallySucceeded" + DELETE_IN_PROGRESS = "DeleteInProgress" + DELETE_FAILED = "DeleteFailed" + DELETED = "Deleted" + +class BackupRestoreOperationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operation type. + """ + + DEFAULT = "Default" + CLONE = "Clone" + RELOCATION = "Relocation" + SNAPSHOT = "Snapshot" + CLOUD_FS = "CloudFS" + +class BuiltInAuthenticationProvider(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The default authentication provider to use when multiple providers are configured. + This setting is only needed if multiple providers are configured and the unauthenticated client + action is set to "RedirectToLoginPage". + """ + + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + FACEBOOK = "Facebook" + GOOGLE = "Google" + MICROSOFT_ACCOUNT = "MicrosoftAccount" + TWITTER = "Twitter" + +class CertificateOrderActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action type. + """ + + CERTIFICATE_ISSUED = "CertificateIssued" + CERTIFICATE_ORDER_CANCELED = "CertificateOrderCanceled" + CERTIFICATE_ORDER_CREATED = "CertificateOrderCreated" + CERTIFICATE_REVOKED = "CertificateRevoked" + DOMAIN_VALIDATION_COMPLETE = "DomainValidationComplete" + FRAUD_DETECTED = "FraudDetected" + ORG_NAME_CHANGE = "OrgNameChange" + ORG_VALIDATION_COMPLETE = "OrgValidationComplete" + SAN_DROP = "SanDrop" + FRAUD_CLEARED = "FraudCleared" + CERTIFICATE_EXPIRED = "CertificateExpired" + CERTIFICATE_EXPIRATION_WARNING = "CertificateExpirationWarning" + FRAUD_DOCUMENTATION_REQUIRED = "FraudDocumentationRequired" + UNKNOWN = "Unknown" + +class CertificateOrderStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current order status. + """ + + PENDINGISSUANCE = "Pendingissuance" + ISSUED = "Issued" + REVOKED = "Revoked" + CANCELED = "Canceled" + DENIED = "Denied" + PENDINGREVOCATION = "Pendingrevocation" + PENDING_REKEY = "PendingRekey" + UNUSED = "Unused" + EXPIRED = "Expired" + NOT_SUBMITTED = "NotSubmitted" + +class CertificateProductType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Certificate product type. + """ + + STANDARD_DOMAIN_VALIDATED_SSL = "StandardDomainValidatedSsl" + STANDARD_DOMAIN_VALIDATED_WILD_CARD_SSL = "StandardDomainValidatedWildCardSsl" + +class Channels(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """List of channels that this recommendation can apply. + """ + + NOTIFICATION = "Notification" + API = "Api" + EMAIL = "Email" + WEBHOOK = "Webhook" + ALL = "All" + +class CheckNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource type used for verification. + """ + + SITE = "Site" + SLOT = "Slot" + HOSTING_ENVIRONMENT = "HostingEnvironment" + PUBLISHING_USER = "PublishingUser" + MICROSOFT_WEB_SITES = "Microsoft.Web/sites" + MICROSOFT_WEB_SITES_SLOTS = "Microsoft.Web/sites/slots" + MICROSOFT_WEB_HOSTING_ENVIRONMENTS = "Microsoft.Web/hostingEnvironments" + MICROSOFT_WEB_PUBLISHING_USERS = "Microsoft.Web/publishingUsers" + +class CloneAbilityResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of app. + """ + + CLONEABLE = "Cloneable" + PARTIALLY_CLONEABLE = "PartiallyCloneable" + NOT_CLONEABLE = "NotCloneable" + +class ComputeModeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Shared/dedicated workers. + """ + + SHARED = "Shared" + DEDICATED = "Dedicated" + DYNAMIC = "Dynamic" + +class ConnectionStringType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of database. + """ + + MY_SQL = "MySql" + SQL_SERVER = "SQLServer" + SQL_AZURE = "SQLAzure" + CUSTOM = "Custom" + NOTIFICATION_HUB = "NotificationHub" + SERVICE_BUS = "ServiceBus" + EVENT_HUB = "EventHub" + API_HUB = "ApiHub" + DOC_DB = "DocDb" + REDIS_CACHE = "RedisCache" + POSTGRE_SQL = "PostgreSQL" + +class ContinuousWebJobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job status. + """ + + INITIALIZING = "Initializing" + STARTING = "Starting" + RUNNING = "Running" + PENDING_RESTART = "PendingRestart" + STOPPED = "Stopped" + +class CustomHostNameDnsRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the DNS record. + """ + + C_NAME = "CName" + A = "A" + +class DatabaseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Database type (e.g. SqlAzure / MySql). + """ + + SQL_AZURE = "SqlAzure" + MY_SQL = "MySql" + LOCAL_MY_SQL = "LocalMySql" + POSTGRE_SQL = "PostgreSql" + +class DnsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current DNS type + """ + + AZURE_DNS = "AzureDns" + DEFAULT_DOMAIN_REGISTRAR_DNS = "DefaultDomainRegistrarDns" + +class DnsVerificationTestResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """DNS verification test result. + """ + + PASSED = "Passed" + FAILED = "Failed" + SKIPPED = "Skipped" + +class DomainPatchResourcePropertiesDomainNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class DomainPropertiesDomainNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class DomainStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Domain registration status. + """ + + ACTIVE = "Active" + AWAITING = "Awaiting" + CANCELLED = "Cancelled" + CONFISCATED = "Confiscated" + DISABLED = "Disabled" + EXCLUDED = "Excluded" + EXPIRED = "Expired" + FAILED = "Failed" + HELD = "Held" + LOCKED = "Locked" + PARKED = "Parked" + PENDING = "Pending" + RESERVED = "Reserved" + REVERTED = "Reverted" + SUSPENDED = "Suspended" + TRANSFERRED = "Transferred" + UNKNOWN = "Unknown" + UNLOCKED = "Unlocked" + UNPARKED = "Unparked" + UPDATED = "Updated" + JSON_CONVERTER_FAILED = "JsonConverterFailed" + +class DomainType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Valid values are Regular domain: Azure will charge the full price of domain registration, + SoftDeleted: Purchasing this domain will simply restore it and this operation will not cost + anything. + """ + + REGULAR = "Regular" + SOFT_DELETED = "SoftDeleted" + +class Enum4(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + WINDOWS_FUNCTIONS = "WindowsFunctions" + LINUX_FUNCTIONS = "LinuxFunctions" + +class Enum5(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + WINDOWS_FUNCTIONS = "WindowsFunctions" + LINUX_FUNCTIONS = "LinuxFunctions" + +class FrequencyUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of time for how often the backup should be executed (e.g. for weekly backup, this + should be set to Day and FrequencyInterval should be set to 7) + """ + + DAY = "Day" + HOUR = "Hour" + +class FtpsState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of FTP / FTPS service + """ + + ALL_ALLOWED = "AllAllowed" + FTPS_ONLY = "FtpsOnly" + DISABLED = "Disabled" + +class HostingEnvironmentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the App Service Environment. + """ + + PREPARING = "Preparing" + READY = "Ready" + SCALING = "Scaling" + DELETING = "Deleting" + +class HostNameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the hostname. + """ + + VERIFIED = "Verified" + MANAGED = "Managed" + +class HostType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether the hostname is a standard or repository hostname. + """ + + STANDARD = "Standard" + REPOSITORY = "Repository" + +class InAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """:code:`Invalid` indicates the name provided does not match Azure App Service + naming requirements. :code:`AlreadyExists` indicates that the name is already in + use and is therefore unavailable. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class InternalLoadBalancingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies which endpoints to serve internally in the Virtual Network for the App Service + Environment. + """ + + NONE = "None" + WEB = "Web" + PUBLISHING = "Publishing" + +class IpFilterTag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Defines what this IP filter will be used for. This is to support IP filtering on proxies. + """ + + DEFAULT = "Default" + XFF_PROXY = "XffProxy" + +class IssueType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Represents the type of the Detector + """ + + SERVICE_INCIDENT = "ServiceIncident" + APP_DEPLOYMENT = "AppDeployment" + APP_CRASH = "AppCrash" + RUNTIME_ISSUE_DETECTED = "RuntimeIssueDetected" + ASE_DEPLOYMENT = "AseDeployment" + USER_ISSUE = "UserIssue" + PLATFORM_ISSUE = "PlatformIssue" + OTHER = "Other" + +class KeyVaultSecretStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Key Vault secret. + """ + + INITIALIZED = "Initialized" + WAITING_ON_CERTIFICATE_ORDER = "WaitingOnCertificateOrder" + SUCCEEDED = "Succeeded" + CERTIFICATE_ORDER_FAILED = "CertificateOrderFailed" + OPERATION_NOT_PERMITTED_ON_KEY_VAULT = "OperationNotPermittedOnKeyVault" + AZURE_SERVICE_UNAUTHORIZED_TO_ACCESS_KEY_VAULT = "AzureServiceUnauthorizedToAccessKeyVault" + KEY_VAULT_DOES_NOT_EXIST = "KeyVaultDoesNotExist" + KEY_VAULT_SECRET_DOES_NOT_EXIST = "KeyVaultSecretDoesNotExist" + UNKNOWN_ERROR = "UnknownError" + EXTERNAL_PRIVATE_KEY = "ExternalPrivateKey" + UNKNOWN = "Unknown" + +class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Log level. + """ + + OFF = "Off" + VERBOSE = "Verbose" + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + +class ManagedPipelineMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Managed pipeline mode. + """ + + INTEGRATED = "Integrated" + CLASSIC = "Classic" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class MSDeployLogEntryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Log entry type + """ + + MESSAGE = "Message" + WARNING = "Warning" + ERROR = "Error" + +class MSDeployProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state + """ + + ACCEPTED = "accepted" + RUNNING = "running" + SUCCEEDED = "succeeded" + FAILED = "failed" + CANCELED = "canceled" + +class MySqlMigrationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of migration operation to be done + """ + + LOCAL_TO_REMOTE = "LocalToRemote" + REMOTE_TO_LOCAL = "RemoteToLocal" + +class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Level indicating how critical this recommendation can impact. + """ + + CRITICAL = "Critical" + WARNING = "Warning" + INFORMATION = "Information" + NON_URGENT_SUGGESTION = "NonUrgentSuggestion" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the operation. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of certificate order. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" + +class PublicCertificateLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Public Certificate Location + """ + + CURRENT_USER_MY = "CurrentUserMy" + LOCAL_MACHINE_MY = "LocalMachineMy" + UNKNOWN = "Unknown" + +class PublishingProfileFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of the format. Valid values are: + FileZilla3 + WebDeploy -- default + Ftp + """ + + FILE_ZILLA3 = "FileZilla3" + WEB_DEPLOY = "WebDeploy" + FTP = "Ftp" + +class RedundancyMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site redundancy mode + """ + + NONE = "None" + MANUAL = "Manual" + FAILOVER = "Failover" + ACTIVE_ACTIVE = "ActiveActive" + GEO_REDUNDANT = "GeoRedundant" + +class RenderingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rendering Type + """ + + NO_GRAPH = "NoGraph" + TABLE = "Table" + TIME_SERIES = "TimeSeries" + TIME_SERIES_PER_INSTANCE = "TimeSeriesPerInstance" + +class ResourceScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of a resource type this recommendation applies, e.g. Subscription, ServerFarm, Site. + """ + + SERVER_FARM = "ServerFarm" + SUBSCRIPTION = "Subscription" + WEB_SITE = "WebSite" + +class RouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of route this is: + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 + INHERITED - Routes inherited from the real Virtual Network routes + STATIC - Static route set on the app only + + These values will be used for syncing an app's routes with those from a Virtual Network. + """ + + DEFAULT = "DEFAULT" + INHERITED = "INHERITED" + STATIC = "STATIC" + +class ScmType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SCM type. + """ + + NONE = "None" + DROPBOX = "Dropbox" + TFS = "Tfs" + LOCAL_GIT = "LocalGit" + GIT_HUB = "GitHub" + CODE_PLEX_GIT = "CodePlexGit" + CODE_PLEX_HG = "CodePlexHg" + BITBUCKET_GIT = "BitbucketGit" + BITBUCKET_HG = "BitbucketHg" + EXTERNAL_GIT = "ExternalGit" + EXTERNAL_HG = "ExternalHg" + ONE_DRIVE = "OneDrive" + VSO = "VSO" + +class SiteAvailabilityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Management information availability state for the app. + """ + + NORMAL = "Normal" + LIMITED = "Limited" + DISASTER_RECOVERY_MODE = "DisasterRecoveryMode" + +class SiteExtensionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site extension type. + """ + + GALLERY = "Gallery" + WEB_ROOT = "WebRoot" + +class SiteLoadBalancing(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site load balancing. + """ + + WEIGHTED_ROUND_ROBIN = "WeightedRoundRobin" + LEAST_REQUESTS = "LeastRequests" + LEAST_RESPONSE_TIME = "LeastResponseTime" + WEIGHTED_TOTAL_TRAFFIC = "WeightedTotalTraffic" + REQUEST_HASH = "RequestHash" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + FREE = "Free" + SHARED = "Shared" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + DYNAMIC = "Dynamic" + ISOLATED = "Isolated" + PREMIUM_V2 = "PremiumV2" + ELASTIC_PREMIUM = "ElasticPremium" + ELASTIC_ISOLATED = "ElasticIsolated" + +class SolutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of Solution + """ + + QUICK_SOLUTION = "QuickSolution" + DEEP_INVESTIGATION = "DeepInvestigation" + BEST_PRACTICES = "BestPractices" + +class SslState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SSL type. + """ + + DISABLED = "Disabled" + SNI_ENABLED = "SniEnabled" + IP_BASED_ENABLED = "IpBasedEnabled" + +class StatusOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plan status. + """ + + READY = "Ready" + PENDING = "Pending" + CREATING = "Creating" + +class SupportedTlsVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """MinTlsVersion: configures the minimum version of TLS required for SSL requests + """ + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" + +class TriggeredWebJobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job status. + """ + + SUCCESS = "Success" + FAILED = "Failed" + ERROR = "Error" + +class UnauthenticatedClientAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The action to take when an unauthenticated client attempts to access the app. + """ + + REDIRECT_TO_LOGIN_PAGE = "RedirectToLoginPage" + ALLOW_ANONYMOUS = "AllowAnonymous" + +class UsageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State indicating whether the app has exceeded its quota usage. Read-only. + """ + + NORMAL = "Normal" + EXCEEDED = "Exceeded" + +class ValidateResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource type used for verification. + """ + + SERVER_FARM = "ServerFarm" + SITE = "Site" + +class WebJobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job type. + """ + + CONTINUOUS = "Continuous" + TRIGGERED = "Triggered" + +class WorkerSizeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Size of the machines. + """ + + SMALL = "Small" + MEDIUM = "Medium" + LARGE = "Large" + D1 = "D1" + D2 = "D2" + D3 = "D3" + DEFAULT = "Default" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/__init__.py index b77b412497f0..abb596e5aa8b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._app_service_certificate_orders_operations import AppServiceCertificateOrdersOperations @@ -19,11 +16,11 @@ from ._diagnostics_operations import DiagnosticsOperations from ._provider_operations import ProviderOperations from ._recommendations_operations import RecommendationsOperations +from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin from ._web_apps_operations import WebAppsOperations from ._app_service_environments_operations import AppServiceEnvironmentsOperations from ._app_service_plans_operations import AppServicePlansOperations from ._resource_health_metadata_operations import ResourceHealthMetadataOperations -from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin __all__ = [ 'AppServiceCertificateOrdersOperations', @@ -36,9 +33,9 @@ 'DiagnosticsOperations', 'ProviderOperations', 'RecommendationsOperations', + 'WebSiteManagementClientOperationsMixin', 'WebAppsOperations', 'AppServiceEnvironmentsOperations', 'AppServicePlansOperations', 'ResourceHealthMetadataOperations', - 'WebSiteManagementClientOperationsMixin', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py index 8e37127a7cb8..5a98edb7c3f3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py @@ -1,1427 +1,1437 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServiceCertificateOrdersOperations(object): """AppServiceCertificateOrdersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateOrderCollection"] """List all certificate orders in a subscription. List all certificate orders in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateOrder - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrderCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateOrderPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore def validate_purchase_information( - self, app_service_certificate_order, custom_headers=None, raw=False, **operation_config): + self, + app_service_certificate_order, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> None """Validate information for a certificate order. Validate information for a certificate order. - :param app_service_certificate_order: Information for a certificate - order. - :type app_service_certificate_order: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param app_service_certificate_order: Information for a certificate order. + :type app_service_certificate_order: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate_purchase_information.metadata['url'] + url = self.validate_purchase_information.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} + if cls: + return cls(pipeline_response, None, {}) + + validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateOrderCollection"] """Get certificate orders in a resource group. Get certificate orders in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateOrder - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrderCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateOrderPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore def get( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" """Get a certificate order. Get a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order.. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateOrder or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceCertificateOrder"] """Create or update a certificate purchase order. Create or update a certificate purchase order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param certificate_distinguished_name: Distinguished name to use for - the certificate order. - :type certificate_distinguished_name: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceCertificateOrder or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceCertificateOrder or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - certificate_order_name=certificate_order_name, - certificate_distinguished_name=certificate_distinguished_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceCertificateOrder', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + certificate_order_name=certificate_order_name, + certificate_distinguished_name=certificate_distinguished_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + 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 + ) + 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.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def delete( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an existing certificate order. Delete an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def update( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrderPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" """Create or update a certificate purchase order. Create or update a certificate purchase order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param certificate_distinguished_name: Distinguished name to use for - the certificate order. - :type certificate_distinguished_name: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateOrder or ClientRawResponse if raw=true + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrderPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateOrder - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def list_certificates( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateCollection"] """List all certificates associated with a certificate order. List all certificates associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResourcePaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_certificates.metadata['url'] + url = self.list_certificates.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} # type: ignore def get_certificate( - self, resource_group_name, certificate_order_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" """Get the certificate associated with a certificate order. Get the certificate associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} - + get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def _create_or_update_certificate_initial( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_certificate.metadata['url'] + url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_certificate( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + def begin_create_or_update_certificate( + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceCertificateResource"] """Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str :param key_vault_certificate: Key vault certificate resource Id. - :type key_vault_certificate: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type key_vault_certificate: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceCertificateResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceCertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_certificate_initial( - resource_group_name=resource_group_name, - certificate_order_name=certificate_order_name, - name=name, - key_vault_certificate=key_vault_certificate, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceCertificateResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_certificate_initial( + resource_group_name=resource_group_name, + certificate_order_name=certificate_order_name, + name=name, + key_vault_certificate=key_vault_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def delete_certificate( - self, resource_group_name, certificate_order_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete the certificate associated with a certificate order. Delete the certificate associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def update_certificate( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" """Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str :param key_vault_certificate: Key vault certificate resource Id. - :type key_vault_certificate: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type key_vault_certificate: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def reissue( - self, resource_group_name, certificate_order_name, reissue_certificate_order_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + reissue_certificate_order_request, # type: "models.ReissueCertificateOrderRequest" + **kwargs # type: Any + ): + # type: (...) -> None """Reissue an existing certificate order. Reissue an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param reissue_certificate_order_request: Parameters for the reissue. - :type reissue_certificate_order_request: - ~azure.mgmt.web.v2018_02_01.models.ReissueCertificateOrderRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type reissue_certificate_order_request: ~azure.mgmt.web.v2018_02_01.models.ReissueCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.reissue.metadata['url'] + url = self.reissue.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} + if cls: + return cls(pipeline_response, None, {}) + + reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} # type: ignore def renew( - self, resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + renew_certificate_order_request, # type: "models.RenewCertificateOrderRequest" + **kwargs # type: Any + ): + # type: (...) -> None """Renew an existing certificate order. Renew an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param renew_certificate_order_request: Renew parameters - :type renew_certificate_order_request: - ~azure.mgmt.web.v2018_02_01.models.RenewCertificateOrderRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param renew_certificate_order_request: Renew parameters. + :type renew_certificate_order_request: ~azure.mgmt.web.v2018_02_01.models.RenewCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.renew.metadata['url'] + url = self.renew.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} + if cls: + return cls(pipeline_response, None, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} # type: ignore def resend_email( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Resend certificate email. Resend certificate email. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.resend_email.metadata['url'] + url = self.resend_email.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} + if cls: + return cls(pipeline_response, None, {}) + + resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} # type: ignore def resend_request_emails( - self, resource_group_name, certificate_order_name, name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> None """Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param name_identifier: Email address. + :type name_identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier + :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 """ - name_identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.resend_request_emails.metadata['url'] + url = self.resend_request_emails.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} + if cls: + return cls(pipeline_response, None, {}) + + resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} # type: ignore def retrieve_site_seal( - self, resource_group_name, certificate_order_name, light_theme=None, locale=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + site_seal_request, # type: "models.SiteSealRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSeal" """Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. - :type light_theme: bool - :param locale: Locale of site seal. - :type locale: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSeal or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSeal or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_seal_request: Site seal request. + :type site_seal_request: ~azure.mgmt.web.v2018_02_01.models.SiteSealRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSeal, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSeal + :raises: ~azure.core.exceptions.HttpResponseError """ - site_seal_request = models.SiteSealRequest(light_theme=light_theme, locale=locale) + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.retrieve_site_seal.metadata['url'] + url = self.retrieve_site_seal.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteSeal', response) + deserialized = self._deserialize('SiteSeal', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} + retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} # type: ignore def verify_domain_ownership( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.verify_domain_ownership.metadata['url'] + url = self.verify_domain_ownership.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} + verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} # type: ignore def retrieve_certificate_actions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.CertificateOrderAction"] """Retrieve the list of certificate actions. Retrieve the list of certificate actions. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate order. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.mgmt.web.v2018_02_01.models.CertificateOrderAction] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateOrderAction, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.CertificateOrderAction] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.retrieve_certificate_actions.metadata['url'] + url = self.retrieve_certificate_actions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[CertificateOrderAction]', response) + deserialized = self._deserialize('[CertificateOrderAction]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} + retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} # type: ignore def retrieve_certificate_email_history( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.CertificateEmail"] """Retrieve email history. Retrieve email history. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate order. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.CertificateEmail] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateEmail, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.CertificateEmail] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.retrieve_certificate_email_history.metadata['url'] + url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[CertificateEmail]', response) + deserialized = self._deserialize('[CertificateEmail]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} + retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py index 016b079e600f..8ec9049f500a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py @@ -1,1691 +1,1810 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServiceEnvironmentsOperations(object): """AppServiceEnvironmentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceEnvironmentCollection"] """Get all App Service Environments for a subscription. Get all App Service Environments for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceEnvironmentResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResourcePaged[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceEnvironmentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceEnvironmentCollection"] """Get all App Service Environments in a resource group. Get all App Service Environments in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceEnvironmentResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResourcePaged[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceEnvironmentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceEnvironmentResource" """Get the properties of an App Service Environment. Get the properties of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceEnvironmentResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServiceEnvironmentResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceEnvironmentResource"] """Create or update an App Service Environment. Create or update an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param hosting_environment_envelope: Configuration details of the App - Service Environment. - :type hosting_environment_envelope: - ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceEnvironmentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceEnvironmentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - hosting_environment_envelope=hosting_environment_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceEnvironmentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + hosting_environment_envelope=hosting_environment_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} - + 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 + ) + 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.Web/hostingEnvironments/{name}'} # type: ignore def _delete_initial( - self, resource_group_name, name, force_delete=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + force_delete=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if force_delete is not None: query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, name, force_delete=None, custom_headers=None, raw=False, polling=True, **operation_config): + 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.Web/hostingEnvironments/{name}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + name, # type: str + force_delete=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete an App Service Environment. Delete an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param force_delete: Specify true to force the deletion - even if the App Service Environment contains resources. The default is - false. + :param force_delete: Specify :code:`true` to force the deletion even if the App + Service Environment contains resources. The default is :code:`false`. :type force_delete: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - name=name, - force_delete=force_delete, - custom_headers=custom_headers, - raw=True, - **operation_config + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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, + name=name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def update( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentPatchResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServiceEnvironmentResource"] """Create or update an App Service Environment. Create or update an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param hosting_environment_envelope: Configuration details of the App - Service Environment. - :type hosting_environment_envelope: - ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceEnvironmentResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServiceEnvironmentResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def list_capacities( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the used, available, and total worker capacity an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StampCapacityCollection"] + """Get the used, available, and total worker capacity an App Service Environment. - Get the used, available, and total worker capacity an App Service - Environment. + Get the used, available, and total worker capacity an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StampCapacity - :rtype: - ~azure.mgmt.web.v2018_02_01.models.StampCapacityPaged[~azure.mgmt.web.v2018_02_01.models.StampCapacity] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StampCapacityCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.StampCapacityCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_capacities.metadata['url'] + url = self.list_capacities.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StampCapacityCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StampCapacityPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} + return ItemPaged( + get_next, extract_data + ) + list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} # type: ignore def list_vips( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AddressResponse" """Get IP addresses assigned to an App Service Environment. Get IP addresses assigned to an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AddressResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.AddressResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AddressResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_vips.metadata['url'] + url = self.list_vips.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AddressResponse', response) + deserialized = self._deserialize('AddressResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} - + list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} # type: ignore def _change_vnet_initial( - self, resource_group_name, name, id=None, subnet=None, custom_headers=None, raw=False, **operation_config): - vnet_info = models.VirtualNetworkProfile(id=id, subnet=subnet) + self, + resource_group_name, # type: str + name, # type: str + vnet_info, # type: "models.VirtualNetworkProfile" + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.change_vnet.metadata['url'] + url = self._change_vnet_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def change_vnet( - self, resource_group_name, name, id=None, subnet=None, custom_headers=None, raw=False, polling=True, **operation_config): + _change_vnet_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore + + def begin_change_vnet( + self, + resource_group_name, # type: str + name, # type: str + vnet_info, # type: "models.VirtualNetworkProfile" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Move an App Service Environment to a different VNET. Move an App Service Environment to a different VNET. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param id: Resource id of the Virtual Network. - :type id: str - :param subnet: Subnet within the Virtual Network. - :type subnet: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param vnet_info: Details for the new virtual network. + :type vnet_info: ~azure.mgmt.web.v2018_02_01.models.VirtualNetworkProfile + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._change_vnet_initial( - resource_group_name=resource_group_name, - name=name, - id=id, - subnet=subnet, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.change_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - return deserialized + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._change_vnet_initial( + resource_group_name=resource_group_name, + name=name, + vnet_info=vnet_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - change_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_change_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore def list_diagnostics( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.HostingEnvironmentDiagnostics"] """Get diagnostic information for an App Service Environment. Get diagnostic information for an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDiagnostics] - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDiagnostics] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_diagnostics.metadata['url'] + url = self.list_diagnostics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', response) + deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} + list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} # type: ignore def get_diagnostics_item( - self, resource_group_name, name, diagnostics_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + diagnostics_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostingEnvironmentDiagnostics" """Get a diagnostics item for an App Service Environment. Get a diagnostics item for an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param diagnostics_name: Name of the diagnostics item. :type diagnostics_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostingEnvironmentDiagnostics or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDiagnostics or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostingEnvironmentDiagnostics + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_diagnostics_item.metadata['url'] + url = self.get_diagnostics_item.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostingEnvironmentDiagnostics', response) + deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} + get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} # type: ignore def get_inbound_network_dependencies_endpoints( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the network endpoints of all inbound dependencies of an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.InboundEnvironmentEndpointCollection"] + """Get the network endpoints of all inbound dependencies of an App Service Environment. - Get the network endpoints of all inbound dependencies of an App Service - Environment. + Get the network endpoints of all inbound dependencies of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of InboundEnvironmentEndpoint - :rtype: - ~azure.mgmt.web.v2018_02_01.models.InboundEnvironmentEndpointPaged[~azure.mgmt.web.v2018_02_01.models.InboundEnvironmentEndpoint] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.InboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_inbound_network_dependencies_endpoints.metadata['url'] + url = self.get_inbound_network_dependencies_endpoints.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('InboundEnvironmentEndpointCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.InboundEnvironmentEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - get_inbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints'} + return ItemPaged( + get_next, extract_data + ) + get_inbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints'} # type: ignore def list_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MetricDefinition" """Get global metric definitions of an App Service Environment. Get global metric definitions of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MetricDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MetricDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetricDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MetricDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_metric_definitions.metadata['url'] + url = self.list_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MetricDefinition', response) + deserialized = self._deserialize('MetricDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'} + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'} # type: ignore def list_metrics( - self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Get global metrics of an App Service Environment. Get global metrics of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics.metadata['url'] + url = self.list_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'} # type: ignore def list_multi_role_pools( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkerPoolCollection"] """Get all multi-role pools. Get all multi-role pools. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WorkerPoolResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResourcePaged[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pools.metadata['url'] + url = self.list_multi_role_pools.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkerPoolCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkerPoolResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} # type: ignore def get_multi_role_pool( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Get properties of a multi-role pool. Get properties of a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_multi_role_pool.metadata['url'] + url = self.get_multi_role_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} - + get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def _create_or_update_multi_role_pool_initial( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_multi_role_pool.metadata['url'] + url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_multi_role_pool( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + def begin_create_or_update_multi_role_pool( + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WorkerPoolResource"] """Create or update a multi-role pool. Create or update a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param multi_role_pool_envelope: Properties of the multi-role pool. - :type multi_role_pool_envelope: - ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type multi_role_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkerPoolResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_multi_role_pool_initial( - resource_group_name=resource_group_name, - name=name, - multi_role_pool_envelope=multi_role_pool_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkerPoolResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_multi_role_pool_initial( + resource_group_name=resource_group_name, + name=name, + multi_role_pool_envelope=multi_role_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def update_multi_role_pool( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] """Create or update a multi-role pool. Create or update a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param multi_role_pool_envelope: Properties of the multi-role pool. - :type multi_role_pool_envelope: - ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type multi_role_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_multi_role_pool.metadata['url'] + url = self.update_multi_role_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} + update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def list_multi_role_pool_instance_metric_definitions( - self, resource_group_name, name, instance, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a specific instance of a multi-role pool of - an App Service Environment. - - Get metric definitions for a specific instance of a multi-role pool of - an App Service Environment. + self, + resource_group_name, # type: str + name, # type: str + instance, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + + Get metric definitions for a specific instance of a multi-role pool of an App Service + Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param instance: Name of the instance in the multi-role pool. :type instance: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] + url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} # type: ignore def list_multi_role_pool_instance_metrics( - self, resource_group_name, name, instance, details=None, custom_headers=None, raw=False, **operation_config): - """Get metrics for a specific instance of a multi-role pool of an App - Service Environment. - - Get metrics for a specific instance of a multi-role pool of an App - Service Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + instance, # type: str + details=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] + """Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + Get metrics for a specific instance of a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param instance: Name of the instance in the multi-role pool. :type instance: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_instance_metrics.metadata['url'] + url = self.list_multi_role_pool_instance_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'} # type: ignore def list_multi_role_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a multi-role pool of an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a multi-role pool of an App Service Environment. - Get metric definitions for a multi-role pool of an App Service - Environment. + Get metric definitions for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_metric_definitions.metadata['url'] + url = self.list_multi_role_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} # type: ignore def list_multi_role_metrics( - self, resource_group_name, name, start_time=None, end_time=None, time_grain=None, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + start_time=None, # type: Optional[str] + end_time=None, # type: Optional[str] + time_grain=None, # type: Optional[str] + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Get metrics for a multi-role pool of an App Service Environment. Get metrics for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -1695,39 +1814,40 @@ def list_multi_role_metrics( :type end_time: str :param time_grain: Time granularity of the metrics query. :type time_grain: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_metrics.metadata['url'] + url = self.list_multi_role_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') if end_time is not None: @@ -1738,1153 +1858,1307 @@ def prepare_request(next_link=None): query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'} # type: ignore def list_multi_role_pool_skus( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SkuInfoCollection"] """Get available SKUs for scaling a multi-role pool. Get available SKUs for scaling a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SkuInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SkuInfoPaged[~azure.mgmt.web.v2018_02_01.models.SkuInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_skus.metadata['url'] + url = self.list_multi_role_pool_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SkuInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} # type: ignore def list_multi_role_usages( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UsageCollection"] """Get usage metrics for a multi-role pool of an App Service Environment. Get usage metrics for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Usage - :rtype: - ~azure.mgmt.web.v2018_02_01.models.UsagePaged[~azure.mgmt.web.v2018_02_01.models.Usage] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_usages.metadata['url'] + url = self.list_multi_role_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} # type: ignore def list_operations( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.Operation"] """List all currently running operations on the App Service Environment. List all currently running operations on the App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.Operation] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Operation, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.Operation] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_operations.metadata['url'] + url = self.list_operations.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[Operation]', response) + deserialized = self._deserialize('[Operation]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} + list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} # type: ignore def get_outbound_network_dependencies_endpoints( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the network endpoints of all outbound dependencies of an App - Service Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OutboundEnvironmentEndpointCollection"] + """Get the network endpoints of all outbound dependencies of an App Service Environment. - Get the network endpoints of all outbound dependencies of an App - Service Environment. + Get the network endpoints of all outbound dependencies of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OutboundEnvironmentEndpoint - :rtype: - ~azure.mgmt.web.v2018_02_01.models.OutboundEnvironmentEndpointPaged[~azure.mgmt.web.v2018_02_01.models.OutboundEnvironmentEndpoint] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.OutboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_outbound_network_dependencies_endpoints.metadata['url'] + url = self.get_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OutboundEnvironmentEndpointCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OutboundEnvironmentEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints'} + return ItemPaged( + get_next, extract_data + ) + get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints'} # type: ignore def reboot( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reboot all machines in an App Service Environment. Reboot all machines in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reboot.metadata['url'] + url = self.reboot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} + if cls: + return cls(pipeline_response, None, {}) + reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} # type: ignore def _resume_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.resume.metadata['url'] + url = self._resume_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def resume( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + def begin_resume( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Resume an App Service Environment. Resume an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._resume_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if not next_link: + # Construct URL + url = self.resume.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - return deserialized + request = self._client.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._resume_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore def list_app_service_plans( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans in an App Service Environment. Get all App Service plans in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServicePlanPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_app_service_plans.metadata['url'] + url = self.list_app_service_plans.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} # type: ignore def list_web_apps( - self, resource_group_name, name, properties_to_include=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + properties_to_include=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps in an App Service Environment. Get all apps in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param properties_to_include: Comma separated list of app properties - to include. + :param properties_to_include: Comma separated list of app properties to include. :type properties_to_include: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SitePaged[~azure.mgmt.web.v2018_02_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps.metadata['url'] + url = self.list_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if properties_to_include is not None: query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized - list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} # type: ignore def _suspend_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.suspend.metadata['url'] + url = self._suspend_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def suspend( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + def begin_suspend( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Suspend an App Service Environment. Suspend an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._suspend_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if not next_link: + # Construct URL + url = self.suspend.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - return deserialized + request = self._client.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._suspend_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] """Get global usage metrics of an App Service Environment. Get global usage metrics of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} # type: ignore def list_worker_pools( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkerPoolCollection"] """Get all worker pools of an App Service Environment. Get all worker pools of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WorkerPoolResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResourcePaged[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pools.metadata['url'] + url = self.list_worker_pools.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkerPoolCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkerPoolResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} # type: ignore def get_worker_pool( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Get properties of a worker pool. Get properties of a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_worker_pool.metadata['url'] + url = self.get_worker_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} - + get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def _create_or_update_worker_pool_initial( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_worker_pool.metadata['url'] + url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_worker_pool( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + def begin_create_or_update_worker_pool( + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WorkerPoolResource"] """Create or update a worker pool. Create or update a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str :param worker_pool_envelope: Properties of the worker pool. - :type worker_pool_envelope: - ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type worker_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkerPoolResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_worker_pool_initial( - resource_group_name=resource_group_name, - name=name, - worker_pool_name=worker_pool_name, - worker_pool_envelope=worker_pool_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkerPoolResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_worker_pool_initial( + resource_group_name=resource_group_name, + name=name, + worker_pool_name=worker_pool_name, + worker_pool_envelope=worker_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def update_worker_pool( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WorkerPoolResource"] """Create or update a worker pool. Create or update a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str :param worker_pool_envelope: Properties of the worker pool. - :type worker_pool_envelope: - ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type worker_pool_envelope: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WorkerPoolResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_worker_pool.metadata['url'] + url = self.update_worker_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} + update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def list_worker_pool_instance_metric_definitions( - self, resource_group_name, name, worker_pool_name, instance, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a specific instance of a worker pool of an - App Service Environment. - - Get metric definitions for a specific instance of a worker pool of an - App Service Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + instance, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -2892,81 +3166,84 @@ def list_worker_pool_instance_metric_definitions( :type worker_pool_name: str :param instance: Name of the instance in the worker pool. :type instance: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_instance_metric_definitions.metadata['url'] + url = self.list_worker_pool_instance_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} # type: ignore def list_worker_pool_instance_metrics( - self, resource_group_name, name, worker_pool_name, instance, details=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get metrics for a specific instance of a worker pool of an App Service - Environment. - - Get metrics for a specific instance of a worker pool of an App Service - Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + instance, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] + """Get metrics for a specific instance of a worker pool of an App Service Environment. + + Get metrics for a specific instance of a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -2974,403 +3251,406 @@ def list_worker_pool_instance_metrics( :type worker_pool_name: str :param instance: Name of the instance in the worker pool. :type instance: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_instance_metrics.metadata['url'] + url = self.list_worker_pool_instance_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'} # type: ignore def list_web_worker_metric_definitions( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] """Get metric definitions for a worker pool of an App Service Environment. Get metric definitions for a worker pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_metric_definitions.metadata['url'] + url = self.list_web_worker_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} # type: ignore def list_web_worker_metrics( - self, resource_group_name, name, worker_pool_name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get metrics for a worker pool of a AppServiceEnvironment (App Service - Environment). - - Get metrics for a worker pool of a AppServiceEnvironment (App Service - Environment). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] + """Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param worker_pool_name: Name of worker pool + :param worker_pool_name: Name of worker pool. :type worker_pool_name: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_metrics.metadata['url'] + url = self.list_web_worker_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'} # type: ignore def list_worker_pool_skus( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SkuInfoCollection"] """Get available SKUs for scaling a worker pool. Get available SKUs for scaling a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SkuInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SkuInfoPaged[~azure.mgmt.web.v2018_02_01.models.SkuInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_skus.metadata['url'] + url = self.list_worker_pool_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SkuInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} # type: ignore def list_web_worker_usages( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UsageCollection"] """Get usage metrics for a worker pool of an App Service Environment. Get usage metrics for a worker pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Usage - :rtype: - ~azure.mgmt.web.v2018_02_01.models.UsagePaged[~azure.mgmt.web.v2018_02_01.models.Usage] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_usages.metadata['url'] + url = self.list_web_worker_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py index f61257bf7660..b6009a1e08d1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py @@ -1,561 +1,584 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServicePlansOperations(object): """AppServicePlansOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, detailed=None, custom_headers=None, raw=False, **operation_config): + self, + detailed=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans for a subscription. Get all App Service plans for a subscription. - :param detailed: Specify true to return all App Service - plan properties. The default is false, which returns a - subset of the properties. - Retrieval of all properties may increase the API latency. + :param detailed: Specify :code:`true` to return all App Service plan properties. + The default is :code:`false`, which returns a subset of the properties. + Retrieval of all properties may increase the API latency. :type detailed: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServicePlanPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if detailed is not None: query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans in a resource group. Get all App Service plans in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AppServicePlanPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServicePlan"] """Get an App Service plan. Get an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServicePlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlan" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServicePlan" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlan" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServicePlan"] """Creates or updates an App Service Plan. Creates or updates an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param app_service_plan: Details of the App Service plan. - :type app_service_plan: - ~azure.mgmt.web.v2018_02_01.models.AppServicePlan - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type app_service_plan: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns AppServicePlan or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.AppServicePlan]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServicePlan or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.AppServicePlan] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - app_service_plan=app_service_plan, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServicePlan', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + app_service_plan=app_service_plan, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + 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 + ) + 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.Web/serverfarms/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an App Service plan. Delete an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def update( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlanPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServicePlan" """Creates or updates an App Service Plan. Creates or updates an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param app_service_plan: Details of the App Service plan. - :type app_service_plan: - ~azure.mgmt.web.v2018_02_01.models.AppServicePlanPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServicePlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type app_service_plan: ~azure.mgmt.web.v2018_02_01.models.AppServicePlanPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AppServicePlan + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def list_capabilities( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.Capability"] """List all capabilities of an App Service plan. List all capabilities of an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.Capability] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Capability, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.Capability] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_capabilities.metadata['url'] + url = self.list_capabilities.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[Capability]', response) + deserialized = self._deserialize('[Capability]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} + list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} # type: ignore def get_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieve a Hybrid Connection in use in an App Service plan. Retrieve a Hybrid Connection in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -563,68 +586,66 @@ def get_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_hybrid_connection.metadata['url'] + url = self.get_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Hybrid Connection in use in an App Service plan. Delete a Hybrid Connection in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -632,61 +653,61 @@ def delete_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_hybrid_connection.metadata['url'] + url = self.delete_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Get the send key name and value of a Hybrid Connection. Get the send key name and value of a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -694,68 +715,66 @@ def list_hybrid_connection_keys( :type namespace_name: str :param relay_name: The name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_hybrid_connection_keys.metadata['url'] + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_web_apps_by_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceCollection"] """Get all apps that use a Hybrid Connection in an App Service Plan. Get all apps that use a Hybrid Connection in an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -763,1020 +782,1003 @@ def list_web_apps_by_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Hybrid Connection relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of str - :rtype: ~azure.mgmt.web.v2018_02_01.models.StrPaged[str] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps_by_hybrid_connection.metadata['url'] + url = self.list_web_apps_by_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StrPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} + return ItemPaged( + get_next, extract_data + ) + list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} # type: ignore def get_hybrid_connection_plan_limit( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the maximum number of Hybrid Connections allowed in an App Service - plan. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionLimits" + """Get the maximum number of Hybrid Connections allowed in an App Service plan. - Get the maximum number of Hybrid Connections allowed in an App Service - plan. + Get the maximum number of Hybrid Connections allowed in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionLimits or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionLimits or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionLimits, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionLimits + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_hybrid_connection_plan_limit.metadata['url'] + url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnectionLimits', response) + deserialized = self._deserialize('HybridConnectionLimits', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} + get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} # type: ignore def list_hybrid_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HybridConnectionCollection"] """Retrieve all Hybrid Connections in use in an App Service plan. Retrieve all Hybrid Connections in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HybridConnection - :rtype: - ~azure.mgmt.web.v2018_02_01.models.HybridConnectionPaged[~azure.mgmt.web.v2018_02_01.models.HybridConnection] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridConnectionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.HybridConnectionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_hybrid_connections.metadata['url'] + url = self.list_hybrid_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HybridConnectionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} + return ItemPaged( + get_next, extract_data + ) + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} # type: ignore def list_metric_defintions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get metrics that can be queried for an App Service plan, and their - definitions. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metrics that can be queried for an App Service plan, and their definitions. - Get metrics that can be queried for an App Service plan, and their - definitions. + Get metrics that can be queried for an App Service plan, and their definitions. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metric_defintions.metadata['url'] + url = self.list_metric_defintions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'} # type: ignore def list_metrics( - self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Get metrics for an App Service plan. Get metrics for an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param details: Specify true to include instance details. - The default is false. + :param details: Specify :code:`true` to include instance details. The default is + :code:`false`. :type details: bool - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics.metadata['url'] + url = self.list_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'} # type: ignore def restart_web_apps( - self, resource_group_name, name, soft_restart=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + soft_restart=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restart all apps in an App Service plan. Restart all apps in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param soft_restart: Specify true to perform a soft - restart, applies the configuration settings and restarts the apps if - necessary. The default is false, which always restarts - and reprovisions the apps + :param soft_restart: Specify :code:`true` to perform a soft restart, applies the + configuration settings and restarts the apps if necessary. The default is + :code:`false`, which always restarts and reprovisions the apps. :type soft_restart: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.restart_web_apps.metadata['url'] + url = self.restart_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} + restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} # type: ignore def list_web_apps( - self, resource_group_name, name, skip_token=None, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + top=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps associated with an App Service plan. Get all apps associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param skip_token: Skip to a web app in the list of webapps associated - with app service plan. If specified, the resulting list will contain - web apps starting from (including) the skipToken. Otherwise, the - resulting list contains web apps from the start of the list + :param skip_token: Skip to a web app in the list of webapps associated with app service plan. + If specified, the resulting list will contain web apps starting from (including) the skipToken. + Otherwise, the resulting list contains web apps from the start of the list. :type skip_token: str - :param filter: Supported filter: $filter=state eq running. Returns - only web apps that are currently running + :param filter: Supported filter: $filter=state eq running. Returns only web apps that are + currently running. :type filter: str :param top: List page size. If specified, results are paged. :type top: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SitePaged[~azure.mgmt.web.v2018_02_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps.metadata['url'] + url = self.list_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} + return ItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} # type: ignore def get_server_farm_skus( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> object """Gets all selectable SKUs for a given App Service Plan. Gets all selectable SKUs for a given App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of App Service Plan + :param name: Name of App Service Plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_server_farm_skus.metadata['url'] + url = self.get_server_farm_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} + get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] """Gets server farm usage information. Gets server farm usage information. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of App Service Plan + :param name: Name of App Service Plan. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2'). + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} # type: ignore def list_vnets( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Get all Virtual Networks associated with an App Service plan. Get all Virtual Networks associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_vnets.metadata['url'] + url = self.list_vnets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} + list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} # type: ignore def get_vnet_from_server_farm( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetInfo"] """Get a Virtual Network associated with an App Service plan. Get a Virtual Network associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_vnet_from_server_farm.metadata['url'] + url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} + get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_gateway( - self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" """Get a Virtual Network gateway. Get a Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Only the 'primary' gateway - is supported. + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. :type gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_vnet_gateway.metadata['url'] + url = self.get_vnet_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" """Update a Virtual Network gateway. Update a Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Only the 'primary' gateway - is supported. + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. :type gateway_name: str :param connection_envelope: Definition of the gateway. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_gateway.metadata['url'] + url = self.update_vnet_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_routes_for_vnet( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Get all routes that are associated with a Virtual Network in an App - Service plan. - - Get all routes that are associated with a Virtual Network in an App - Service plan. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetRoute"] + """Get all routes that are associated with a Virtual Network in an App Service plan. + + Get all routes that are associated with a Virtual Network in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_routes_for_vnet.metadata['url'] + url = self.list_routes_for_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetRoute]', response) + deserialized = self._deserialize('[VnetRoute]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} + list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} # type: ignore def get_route_for_vnet( - self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[List["models.VnetRoute"]] """Get a Virtual Network route in an App Service plan. Get a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1784,69 +1786,68 @@ def get_route_for_vnet( :type vnet_name: str :param route_name: Name of the Virtual Network route. :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetRoute] or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_route_for_vnet.metadata['url'] + url = self.get_route_for_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('[VnetRoute]', response) + deserialized = self._deserialize('[VnetRoute]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def create_or_update_vnet_route( - self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + route, # type: "models.VnetRoute" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetRoute"] """Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1856,73 +1857,73 @@ def create_or_update_vnet_route( :type route_name: str :param route: Definition of the Virtual Network route. :type route: ~azure.mgmt.web.v2018_02_01.models.VnetRoute - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetRoute or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetRoute or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_route.metadata['url'] + url = self.create_or_update_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 400, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetRoute', response) + deserialized = self._deserialize('VnetRoute', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def delete_vnet_route( - self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Virtual Network route in an App Service plan. Delete a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1930,61 +1931,62 @@ def delete_vnet_route( :type vnet_name: str :param route_name: Name of the Virtual Network route. :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_vnet_route.metadata['url'] + url = self.delete_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def update_vnet_route( - self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + route, # type: "models.VnetRoute" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetRoute"] """Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1994,121 +1996,113 @@ def update_vnet_route( :type route_name: str :param route: Definition of the Virtual Network route. :type route: ~azure.mgmt.web.v2018_02_01.models.VnetRoute - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetRoute or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetRoute or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_route.metadata['url'] + url = self.update_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 400, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetRoute', response) + deserialized = self._deserialize('VnetRoute', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def reboot_worker( - self, resource_group_name, name, worker_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reboot a worker machine in an App Service plan. Reboot a worker machine in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param worker_name: Name of worker machine, which typically starts - with RD. + :param worker_name: Name of worker machine, which typically starts with RD. :type worker_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reboot_worker.metadata['url'] + url = self.reboot_worker.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerName': self._serialize.url("worker_name", worker_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} + 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, {}) + + reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py index a8a23e8917ba..9eb5daaa1ed8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py @@ -1,104 +1,110 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificateRegistrationProviderOperations(object): """CertificateRegistrationProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationDescription] - :raises: - :class:`DefaultErrorResponseException` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py index 1c2850cb0613..2ac5ccb1879e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py @@ -1,439 +1,433 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates for a subscription. Get all certificates for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CertificatePaged[~azure.mgmt.web.v2018_02_01.models.Certificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates in a resource group. Get all certificates in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CertificatePaged[~azure.mgmt.web.v2018_02_01.models.Certificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Get a certificate. Get a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def create_or_update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.Certificate" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2018_02_01.models.Certificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_02_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a certificate. Delete a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.CertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2018_02_01.models.CertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_02_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py index 97e5c74c82bf..a7f8120d9fdc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py @@ -1,238 +1,243 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DeletedWebAppsOperations(object): """DeletedWebAppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedWebAppCollection"] """Get all deleted apps for a subscription. Get all deleted apps for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedSite - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DeletedSitePaged[~azure.mgmt.web.v2018_02_01.models.DeletedSite] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedWebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedSitePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} # type: ignore def list_by_location( - self, location, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedWebAppCollection"] """Get all deleted apps for a subscription at location. Get all deleted apps for a subscription at location. :param location: :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedSite - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DeletedSitePaged[~azure.mgmt.web.v2018_02_01.models.DeletedSite] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_location.metadata['url'] + url = self.list_by_location.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedWebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedSitePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites'} + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites'} # type: ignore def get_deleted_web_app_by_location( - self, location, deleted_site_id, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + deleted_site_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSite" """Get deleted app for a subscription at location. Get deleted app for a subscription at location. :param location: :type location: str - :param deleted_site_id: The numeric ID of the deleted app, e.g. 12345 + :param deleted_site_id: The numeric ID of the deleted app, e.g. 12345. :type deleted_site_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeletedSite or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DeletedSite or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSite, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DeletedSite + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_deleted_web_app_by_location.metadata['url'] + url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), 'deletedSiteId': self._serialize.url("deleted_site_id", deleted_site_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSite', response) + deserialized = self._deserialize('DeletedSite', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_web_app_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}'} + get_deleted_web_app_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py index e2c0bb8cde9d..0940da3c4f69 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py @@ -1,1735 +1,1766 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DiagnosticsOperations(object): """DiagnosticsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list_hosting_environment_detector_responses( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Hosting Environment Detector Responses. List Hosting Environment Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Site Name + :param name: Site Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorResponsePaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_hosting_environment_detector_responses.metadata['url'] + url = self.list_hosting_environment_detector_responses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} # type: ignore def get_hosting_environment_detector_response( - self, resource_group_name, name, detector_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + detector_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get Hosting Environment Detector Response. Get Hosting Environment Detector Response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: App Service Environment Name + :param name: App Service Environment Name. :type name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_hosting_environment_detector_response.metadata['url'] + url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} + get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} # type: ignore def list_site_detector_responses( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Site Detector Responses. List Site Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorResponsePaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detector_responses.metadata['url'] + url = self.list_site_detector_responses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} # type: ignore def get_site_detector_response( - self, resource_group_name, site_name, detector_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get site detector response. Get site detector response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_detector_response.metadata['url'] + url = self.get_site_detector_response.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} + get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} # type: ignore def list_site_diagnostic_categories( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticCategoryCollection"] """Get Diagnostics Categories. Get Diagnostics Categories. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DiagnosticCategory - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategoryPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_diagnostic_categories.metadata['url'] + url = self.list_site_diagnostic_categories.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticCategoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiagnosticCategoryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} + return ItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} # type: ignore def get_site_diagnostic_category( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticCategory" """Get Diagnostics Category. Get Diagnostics Category. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticCategory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_diagnostic_category.metadata['url'] + url = self.get_site_diagnostic_category.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticCategory', response) + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} + get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} # type: ignore def list_site_analyses( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticAnalysisCollection"] """Get Site Analyses. Get Site Analyses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AnalysisDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AnalysisDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.AnalysisDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_analyses.metadata['url'] + url = self.list_site_analyses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticAnalysisCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AnalysisDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} + return ItemPaged( + get_next, extract_data + ) + list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore def get_site_analysis( - self, resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Get Site Analysis. Get Site Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param analysis_name: Analysis Name + :param analysis_name: Analysis Name. :type analysis_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_analysis.metadata['url'] + url = self.get_site_analysis.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} + get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore def execute_site_analysis( - self, resource_group_name, site_name, diagnostic_category, analysis_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Execute Analysis. Execute Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param analysis_name: Analysis Resource Name + :param analysis_name: Analysis Resource Name. :type analysis_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.execute_site_analysis.metadata['url'] + url = self.execute_site_analysis.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} + execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore def list_site_detectors( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detectors. Get Detectors. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detectors.metadata['url'] + url = self.list_site_detectors.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore def get_site_detector( - self, resource_group_name, site_name, diagnostic_category, detector_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + detector_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detector. Get Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param detector_name: Detector Name + :param detector_name: Detector Name. :type detector_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_site_detector.metadata['url'] + url = self.get_site_detector.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} + return ItemPaged( + get_next, extract_data + ) + get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore def execute_site_detector( - self, resource_group_name, site_name, detector_name, diagnostic_category, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + diagnostic_category, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticDetectorResponse" """Execute Detector. Execute Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticDetectorResponse or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorResponse - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.execute_site_detector.metadata['url'] + url = self.execute_site_detector.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticDetectorResponse', response) + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} + execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore def list_site_detector_responses_slot( - self, resource_group_name, site_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Site Detector Responses. List Site Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorResponsePaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detector_responses_slot.metadata['url'] + url = self.list_site_detector_responses_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} # type: ignore def get_site_detector_response_slot( - self, resource_group_name, site_name, detector_name, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get site detector response. Get site detector response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_detector_response_slot.metadata['url'] + url = self.get_site_detector_response_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} + get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} # type: ignore def list_site_diagnostic_categories_slot( - self, resource_group_name, site_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticCategoryCollection"] """Get Diagnostics Categories. Get Diagnostics Categories. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DiagnosticCategory - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategoryPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_diagnostic_categories_slot.metadata['url'] + url = self.list_site_diagnostic_categories_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticCategoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiagnosticCategoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} + return ItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} # type: ignore def get_site_diagnostic_category_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticCategory" """Get Diagnostics Category. Get Diagnostics Category. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticCategory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_diagnostic_category_slot.metadata['url'] + url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticCategory', response) + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} + get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} # type: ignore def list_site_analyses_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticAnalysisCollection"] """Get Site Analyses. Get Site Analyses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AnalysisDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AnalysisDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.AnalysisDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_analyses_slot.metadata['url'] + url = self.list_site_analyses_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticAnalysisCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AnalysisDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} + return ItemPaged( + get_next, extract_data + ) + list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore def get_site_analysis_slot( - self, resource_group_name, site_name, diagnostic_category, analysis_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Get Site Analysis. Get Site Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param analysis_name: Analysis Name + :param analysis_name: Analysis Name. :type analysis_name: str - :param slot: Slot - optional + :param slot: Slot - optional. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_analysis_slot.metadata['url'] + url = self.get_site_analysis_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} + get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore def execute_site_analysis_slot( - self, resource_group_name, site_name, diagnostic_category, analysis_name, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Execute Analysis. Execute Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param analysis_name: Analysis Resource Name + :param analysis_name: Analysis Resource Name. :type analysis_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.execute_site_analysis_slot.metadata['url'] + url = self.execute_site_analysis_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} + execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore def list_site_detectors_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detectors. Get Detectors. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detectors_slot.metadata['url'] + url = self.list_site_detectors_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore def get_site_detector_slot( - self, resource_group_name, site_name, diagnostic_category, detector_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + detector_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detector. Get Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param detector_name: Detector Name + :param detector_name: Detector Name. :type detector_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.DetectorDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_site_detector_slot.metadata['url'] + url = self.get_site_detector_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} + return ItemPaged( + get_next, extract_data + ) + get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore def execute_site_detector_slot( - self, resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + diagnostic_category, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticDetectorResponse" """Execute Detector. Execute Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticDetectorResponse or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.DiagnosticDetectorResponse - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.execute_site_detector_slot.metadata['url'] + url = self.execute_site_detector_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticDetectorResponse', response) + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} + execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py index 1bc59d425876..0038e92379d8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py @@ -1,104 +1,110 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DomainRegistrationProviderOperations(object): """DomainRegistrationProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationDescription] - :raises: - :class:`DefaultErrorResponseException` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Implements Csm operations Api to exposes the list of available Csm Apis under the resource + provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py index 3dcb3a8654df..d92cf92d2e7f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py @@ -1,1093 +1,1089 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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]] class DomainsOperations(object): """DomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def check_availability( - self, name=None, custom_headers=None, raw=False, **operation_config): + self, + identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainAvailablilityCheckResult" """Check if a domain is available for registration. Check if a domain is available for registration. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainAvailablilityCheckResult or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DomainAvailablilityCheckResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param identifier: Name of the domain. + :type identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainAvailablilityCheckResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainAvailablilityCheckResult + :raises: ~azure.core.exceptions.HttpResponseError """ - identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_availability.metadata['url'] + url = self.check_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainAvailablilityCheckResult', response) + deserialized = self._deserialize('DomainAvailablilityCheckResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} # type: ignore def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainCollection"] """Get all domains in a subscription. Get all domains in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DomainPaged[~azure.mgmt.web.v2018_02_01.models.Domain] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} # type: ignore def get_control_center_sso_request( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DomainControlCenterSsoRequest" """Generate a single sign-on request for the domain management portal. Generate a single sign-on request for the domain management portal. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainControlCenterSsoRequest or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DomainControlCenterSsoRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainControlCenterSsoRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainControlCenterSsoRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_control_center_sso_request.metadata['url'] + url = self.get_control_center_sso_request.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainControlCenterSsoRequest', response) + deserialized = self._deserialize('DomainControlCenterSsoRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} + get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} # type: ignore def list_recommendations( - self, keywords=None, max_domain_recommendations=None, custom_headers=None, raw=False, **operation_config): + self, + parameters, # type: "models.DomainRecommendationSearchParameters" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.NameIdentifierCollection"] """Get domain name recommendations based on keywords. Get domain name recommendations based on keywords. - :param keywords: Keywords to be used for generating domain - recommendations. - :type keywords: str - :param max_domain_recommendations: Maximum number of recommendations. - :type max_domain_recommendations: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of NameIdentifier - :rtype: - ~azure.mgmt.web.v2018_02_01.models.NameIdentifierPaged[~azure.mgmt.web.v2018_02_01.models.NameIdentifier] - :raises: - :class:`DefaultErrorResponseException` + :param parameters: Search parameters for domain name recommendations. + :type parameters: ~azure.mgmt.web.v2018_02_01.models.DomainRecommendationSearchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NameIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.NameIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.DomainRecommendationSearchParameters(keywords=keywords, max_domain_recommendations=max_domain_recommendations) + cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommendations.metadata['url'] + url = self.list_recommendations.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('NameIdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.NameIdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainCollection"] """Get all domains in a resource group. Get all domains in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DomainPaged[~azure.mgmt.web.v2018_02_01.models.Domain] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} # type: ignore def get( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Get a domain. Get a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Domain"] """Creates or updates a domain. Creates or updates a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain: Domain registration information. :type domain: ~azure.mgmt.web.v2018_02_01.models.Domain - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Domain or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.Domain] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.Domain]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain=domain, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Domain', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + domain_name=domain_name, + domain=domain, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + 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 + ) + 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.DomainRegistration/domains/{domainName}'} # type: ignore def delete( - self, resource_group_name, domain_name, force_hard_delete_domain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + force_hard_delete_domain=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Delete a domain. Delete a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param force_hard_delete_domain: Specify true to delete - the domain immediately. The default is false which - deletes the domain after 24 hours. + :param force_hard_delete_domain: Specify :code:`true` to delete the domain + immediately. The default is :code:`false` which deletes the domain after 24 hours. :type force_hard_delete_domain: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if force_hard_delete_domain is not None: query_parameters['forceHardDeleteDomain'] = self._serialize.query("force_hard_delete_domain", force_hard_delete_domain, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def update( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.DomainPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Creates or updates a domain. Creates or updates a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain: Domain registration information. :type domain: ~azure.mgmt.web.v2018_02_01.models.DomainPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def list_ownership_identifiers( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainOwnershipIdentifierCollection"] """Lists domain ownership identifiers. Lists domain ownership identifiers. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DomainOwnershipIdentifier - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifierPaged[~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainOwnershipIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_ownership_identifiers.metadata['url'] + url = self.list_ownership_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainOwnershipIdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainOwnershipIdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} # type: ignore def get_ownership_identifier( - self, resource_group_name, domain_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" """Get ownership identifier for domain. Get ownership identifier for domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_ownership_identifier.metadata['url'] + url = self.get_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def create_or_update_ownership_identifier( - self, resource_group_name, domain_name, name, kind=None, ownership_id=None, custom_headers=None, raw=False, **operation_config): - """Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + domain_ownership_identifier, # type: "models.DomainOwnershipIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param kind: Kind of resource. - :type kind: str - :param ownership_id: Ownership Id. - :type ownership_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.DomainOwnershipIdentifier(kind=kind, ownership_id=ownership_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_ownership_identifier.metadata['url'] + url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def delete_ownership_identifier( - self, resource_group_name, domain_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete ownership identifier for domain. Delete ownership identifier for domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_ownership_identifier.metadata['url'] + url = self.delete_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def update_ownership_identifier( - self, resource_group_name, domain_name, name, kind=None, ownership_id=None, custom_headers=None, raw=False, **operation_config): - """Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. + if cls: + return cls(pipeline_response, None, {}) - Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. + delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def update_ownership_identifier( + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + domain_ownership_identifier, # type: "models.DomainOwnershipIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Creates an ownership identifier for a domain or updates identifier details for an existing + identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param kind: Kind of resource. - :type kind: str - :param ownership_id: Ownership Id. - :type ownership_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.DomainOwnershipIdentifier(kind=kind, ownership_id=ownership_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_ownership_identifier.metadata['url'] + url = self.update_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def renew( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Renew a domain. Renew a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.renew.metadata['url'] + url = self.renew.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 400, 500]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} + 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, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py index 28477ed78d41..13af311d060d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py @@ -1,244 +1,250 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class ProviderOperations(object): """ProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def get_available_stacks( - self, os_type_selected=None, custom_headers=None, raw=False, **operation_config): + self, + os_type_selected=None, # type: Optional[Union[str, "models.Enum4"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ApplicationStackCollection"] """Get available application frameworks and their versions. Get available application frameworks and their versions. - :param os_type_selected: Possible values include: 'Windows', 'Linux', - 'WindowsFunctions', 'LinuxFunctions' - :type os_type_selected: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ApplicationStack - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ApplicationStackPaged[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] - :raises: - :class:`DefaultErrorResponseException` + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2018_02_01.models.Enum4 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_available_stacks.metadata['url'] - + url = self.get_available_stacks.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] if os_type_selected is not None: query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ApplicationStackPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} + return ItemPaged( + get_next, extract_data + ) + get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} # type: ignore def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Gets all available operations for the Microsoft.Web resource provider. - Also exposes resource metric definitions. - - Gets all available operations for the Microsoft.Web resource provider. - Also exposes resource metric definitions. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationDescription] - :raises: - :class:`DefaultErrorResponseException` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions. + + Gets all available operations for the Microsoft.Web resource provider. Also exposes resource + metric definitions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} # type: ignore def get_available_stacks_on_prem( - self, os_type_selected=None, custom_headers=None, raw=False, **operation_config): + self, + os_type_selected=None, # type: Optional[Union[str, "models.Enum5"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ApplicationStackCollection"] """Get available application frameworks and their versions. Get available application frameworks and their versions. - :param os_type_selected: Possible values include: 'Windows', 'Linux', - 'WindowsFunctions', 'LinuxFunctions' - :type os_type_selected: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ApplicationStack - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ApplicationStackPaged[~azure.mgmt.web.v2018_02_01.models.ApplicationStack] - :raises: - :class:`DefaultErrorResponseException` + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2018_02_01.models.Enum5 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_available_stacks_on_prem.metadata['url'] + url = self.get_available_stacks_on_prem.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if os_type_selected is not None: query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ApplicationStackPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} + return ItemPaged( + get_next, extract_data + ) + get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py index 65038b41936b..7cc571d49b3a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py @@ -1,1078 +1,1066 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class RecommendationsOperations(object): """RecommendationsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """List all recommendations for a subscription. List all recommendations for a subscription. - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RecommendationPaged[~azure.mgmt.web.v2018_02_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} # type: ignore def reset_all_filters( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for a subscription. Reset all recommendation opt-out settings for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reset_all_filters.metadata['url'] + url = self.reset_all_filters.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} + reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} # type: ignore def disable_recommendation_for_subscription( - self, name, custom_headers=None, raw=False, **operation_config): - """Disables the specified rule so it will not apply to a subscription in - the future. + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Disables the specified rule so it will not apply to a subscription in the future. - Disables the specified rule so it will not apply to a subscription in - the future. + Disables the specified rule so it will not apply to a subscription in the future. - :param name: Rule name + :param name: Rule name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.disable_recommendation_for_subscription.metadata['url'] + url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def list_history_for_hosting_environment( - self, resource_group_name, hosting_environment_name, expired_only=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get past recommendations for an app, optionally specified by the time - range. + if cls: + return cls(pipeline_response, None, {}) - Get past recommendations for an app, optionally specified by the time - range. + disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_history_for_hosting_environment( + self, + resource_group_name, # type: str + hosting_environment_name, # type: str + expired_only=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] + """Get past recommendations for an app, optionally specified by the time range. + + Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param hosting_environment_name: Name of the hosting environment. :type hosting_environment_name: str - :param expired_only: Specify false to return all - recommendations. The default is true, which returns only - expired recommendations. + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. :type expired_only: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RecommendationPaged[~azure.mgmt.web.v2018_02_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_history_for_hosting_environment.metadata['url'] + url = self.list_history_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if expired_only is not None: query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_history_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory'} + return ItemPaged( + get_next, extract_data + ) + list_history_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory'} # type: ignore def list_recommended_rules_for_hosting_environment( - self, resource_group_name, hosting_environment_name, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + hosting_environment_name, # type: str + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """Get all recommendations for an app. Get all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param hosting_environment_name: Name of the app. :type hosting_environment_name: str - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Return only channels specified in the filter. Filter is - specified by using OData syntax. Example: $filter=channel eq 'Api' or - channel eq 'Notification' + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RecommendationPaged[~azure.mgmt.web.v2018_02_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommended_rules_for_hosting_environment.metadata['url'] + url = self.list_recommended_rules_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_recommended_rules_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations'} # type: ignore def disable_all_for_hosting_environment( - self, resource_group_name, environment_name, hosting_environment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + environment_name, # type: str + hosting_environment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable all recommendations for an app. Disable all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param environment_name: Name of the app. :type environment_name: str :param hosting_environment_name: :type hosting_environment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.disable_all_for_hosting_environment.metadata['url'] + url = self.disable_all_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_all_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable'} + if cls: + return cls(pipeline_response, None, {}) + + disable_all_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable'} # type: ignore def reset_all_filters_for_hosting_environment( - self, resource_group_name, environment_name, hosting_environment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + environment_name, # type: str + hosting_environment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param environment_name: Name of the app. :type environment_name: str :param hosting_environment_name: :type hosting_environment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reset_all_filters_for_hosting_environment.metadata['url'] + url = self.reset_all_filters_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset'} + if cls: + return cls(pipeline_response, None, {}) + + reset_all_filters_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset'} # type: ignore def get_rule_details_by_hosting_environment( - self, resource_group_name, hosting_environment_name, name, update_seen=None, recommendation_id=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + hosting_environment_name, # type: str + name, # type: str + update_seen=None, # type: Optional[bool] + recommendation_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RecommendationRule" """Get a recommendation rule for an app. Get a recommendation rule for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param hosting_environment_name: Name of the hosting environment. :type hosting_environment_name: str :param name: Name of the recommendation. :type name: str - :param update_seen: Specify true to update the last-seen - timestamp of the recommendation object. + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. :type update_seen: bool - :param recommendation_id: The GUID of the recommendation object if you - query an expired one. You don't need to specify it to query an active - entry. + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. :type recommendation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecommendationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.RecommendationRule or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_rule_details_by_hosting_environment.metadata['url'] + url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if update_seen is not None: query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') if recommendation_id is not None: query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RecommendationRule', response) + deserialized = self._deserialize('RecommendationRule', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_rule_details_by_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}'} + get_rule_details_by_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}'} # type: ignore def disable_recommendation_for_hosting_environment( - self, resource_group_name, environment_name, name, hosting_environment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + environment_name, # type: str + name, # type: str + hosting_environment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disables the specific rule for a web site permanently. Disables the specific rule for a web site permanently. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param environment_name: Site name + :param environment_name: Site name. :type environment_name: str - :param name: Rule name + :param name: Rule name. :type name: str :param hosting_environment_name: :type hosting_environment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.disable_recommendation_for_hosting_environment.metadata['url'] + url = self.disable_recommendation_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def list_history_for_web_app( - self, resource_group_name, site_name, expired_only=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get past recommendations for an app, optionally specified by the time - range. + if cls: + return cls(pipeline_response, None, {}) - Get past recommendations for an app, optionally specified by the time - range. + disable_recommendation_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_history_for_web_app( + self, + resource_group_name, # type: str + site_name, # type: str + expired_only=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] + """Get past recommendations for an app, optionally specified by the time range. + + Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param expired_only: Specify false to return all - recommendations. The default is true, which returns only - expired recommendations. + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. :type expired_only: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RecommendationPaged[~azure.mgmt.web.v2018_02_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_history_for_web_app.metadata['url'] + url = self.list_history_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if expired_only is not None: query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} + return ItemPaged( + get_next, extract_data + ) + list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} # type: ignore def list_recommended_rules_for_web_app( - self, resource_group_name, site_name, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """Get all recommendations for an app. Get all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Return only channels specified in the filter. Filter is - specified by using OData syntax. Example: $filter=channel eq 'Api' or - channel eq 'Notification' + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RecommendationPaged[~azure.mgmt.web.v2018_02_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommended_rules_for_web_app.metadata['url'] + url = self.list_recommended_rules_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} # type: ignore def disable_all_for_web_app( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable all recommendations for an app. Disable all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.disable_all_for_web_app.metadata['url'] + url = self.disable_all_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} + disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} # type: ignore def reset_all_filters_for_web_app( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reset_all_filters_for_web_app.metadata['url'] + url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} + reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} # type: ignore def get_rule_details_by_web_app( - self, resource_group_name, site_name, name, update_seen=None, recommendation_id=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + name, # type: str + update_seen=None, # type: Optional[bool] + recommendation_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RecommendationRule" """Get a recommendation rule for an app. Get a recommendation rule for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str :param name: Name of the recommendation. :type name: str - :param update_seen: Specify true to update the last-seen - timestamp of the recommendation object. + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. :type update_seen: bool - :param recommendation_id: The GUID of the recommendation object if you - query an expired one. You don't need to specify it to query an active - entry. + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. :type recommendation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecommendationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.RecommendationRule or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_rule_details_by_web_app.metadata['url'] + url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if update_seen is not None: query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') if recommendation_id is not None: query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RecommendationRule', response) + deserialized = self._deserialize('RecommendationRule', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} + get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} # type: ignore def disable_recommendation_for_site( - self, resource_group_name, site_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disables the specific rule for a web site permanently. Disables the specific rule for a web site permanently. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site name + :param site_name: Site name. :type site_name: str - :param name: Rule name + :param name: Rule name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.disable_recommendation_for_site.metadata['url'] + url = self.disable_recommendation_for_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} + 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_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py index 2923705786ac..1419faa873c7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py @@ -1,465 +1,460 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class ResourceHealthMetadataOperations(object): """ResourceHealthMetadataOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] """List all ResourceHealthMetadata for all sites in the subscription. List all ResourceHealthMetadata for all sites in the subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """List all ResourceHealthMetadata for all sites in the resource group in - the subscription. + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """List all ResourceHealthMetadata for all sites in the resource group in the subscription. - List all ResourceHealthMetadata for all sites in the resource group in - the subscription. + List all ResourceHealthMetadata for all sites in the resource group in the subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore def list_by_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the category of ResourceHealthMetadata to use for the given site - as a collection. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. - Gets the category of ResourceHealthMetadata to use for the given site - as a collection. + Gets the category of ResourceHealthMetadata to use for the given site as a collection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_site.metadata['url'] + url = self.list_by_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} # type: ignore def get_by_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceHealthMetadata" """Gets the category of ResourceHealthMetadata to use for the given site. Gets the category of ResourceHealthMetadata to use for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of web app + :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceHealthMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_by_site.metadata['url'] + url = self.get_by_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceHealthMetadata', response) + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} + get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} # type: ignore def list_by_site_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets the category of ResourceHealthMetadata to use for the given site - as a collection. - - Gets the category of ResourceHealthMetadata to use for the given site - as a collection. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_site_slot.metadata['url'] + url = self.list_by_site_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} # type: ignore def get_by_site_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceHealthMetadata" """Gets the category of ResourceHealthMetadata to use for the given site. Gets the category of ResourceHealthMetadata to use for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of web app + :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceHealthMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_by_site_slot.metadata['url'] + url = self.get_by_site_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceHealthMetadata', response) + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} + get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py index e930abcb7317..465a5ae885a0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py @@ -1,251 +1,252 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class TopLevelDomainsOperations(object): """TopLevelDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TopLevelDomainCollection"] """Get all top-level domains supported for registration. Get all top-level domains supported for registration. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TopLevelDomain - :rtype: - ~azure.mgmt.web.v2018_02_01.models.TopLevelDomainPaged[~azure.mgmt.web.v2018_02_01.models.TopLevelDomain] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopLevelDomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.TopLevelDomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TopLevelDomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TopLevelDomainPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} # type: ignore def get( - self, name, custom_headers=None, raw=False, **operation_config): + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TopLevelDomain" """Get details of a top-level domain. Get details of a top-level domain. :param name: Name of the top-level domain. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TopLevelDomain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.TopLevelDomain or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopLevelDomain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TopLevelDomain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TopLevelDomain', response) + deserialized = self._deserialize('TopLevelDomain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} # type: ignore def list_agreements( - self, name, include_privacy=None, for_transfer=None, custom_headers=None, raw=False, **operation_config): - """Gets all legal agreements that user needs to accept before purchasing a - domain. + self, + name, # type: str + agreement_option, # type: "models.TopLevelDomainAgreementOption" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TldLegalAgreementCollection"] + """Gets all legal agreements that user needs to accept before purchasing a domain. - Gets all legal agreements that user needs to accept before purchasing a - domain. + Gets all legal agreements that user needs to accept before purchasing a domain. :param name: Name of the top-level domain. :type name: str - :param include_privacy: If true, then the list of - agreements will include agreements for domain privacy as well; - otherwise, false. - :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. - :type for_transfer: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TldLegalAgreement - :rtype: - ~azure.mgmt.web.v2018_02_01.models.TldLegalAgreementPaged[~azure.mgmt.web.v2018_02_01.models.TldLegalAgreement] - :raises: - :class:`DefaultErrorResponseException` + :param agreement_option: Domain agreement options. + :type agreement_option: ~azure.mgmt.web.v2018_02_01.models.TopLevelDomainAgreementOption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TldLegalAgreementCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.TldLegalAgreementCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - agreement_option = models.TopLevelDomainAgreementOption(include_privacy=include_privacy, for_transfer=for_transfer) + cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_agreements.metadata['url'] + url = self.list_agreements.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TldLegalAgreementCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TldLegalAgreementPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} + return ItemPaged( + get_next, extract_data + ) + list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py index 0e61cb62ca70..01e4b045f646 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py @@ -1,923 +1,930 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class WebAppsOperations(object): """WebAppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_02_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. - :ivar api_version: API Version. Constant value: "2018-02-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps for a subscription. Get all apps for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SitePaged[~azure.mgmt.web.v2018_02_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} # type: ignore def list_by_resource_group( - self, resource_group_name, include_slots=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + include_slots=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Gets all web, mobile, and API apps in the specified resource group. Gets all web, mobile, and API apps in the specified resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param include_slots: Specify true to include - deployment slots in results. The default is false, which only gives - you the production slot of all apps. + :param include_slots: Specify :code:`true` to include deployment slots in + results. The default is false, which only gives you the production slot of all apps. :type include_slots: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SitePaged[~azure.mgmt.web.v2018_02_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if include_slots is not None: query_parameters['includeSlots'] = self._serialize.query("include_slots", include_slots, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Site"] """Gets the details of a web, mobile, or API app. Gets the details of a web, mobile, or API app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore - def create_or_update( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Site"] + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. + :param site_envelope: A JSON representation of the app properties. See example. :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.Site - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Site or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.Site] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.Site]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - site_envelope=site_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Site', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + 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 + ) + 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.Web/sites/{name}'} # type: ignore def delete( - self, resource_group_name, name, delete_metrics=None, delete_empty_server_farm=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + delete_metrics=None, # type: Optional[bool] + delete_empty_server_farm=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a web, mobile, or API app, or one of the deployment slots. Deletes a web, mobile, or API app, or one of the deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app to delete. :type name: str :param delete_metrics: If true, web app metrics are also deleted. :type delete_metrics: bool - :param delete_empty_server_farm: Specify false if you want to keep - empty App Service plan. By default, empty App Service plan is deleted. + :param delete_empty_server_farm: Specify false if you want to keep empty App Service plan. By + default, empty App Service plan is deleted. :type delete_empty_server_farm: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if delete_metrics is not None: query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') if delete_empty_server_farm is not None: query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + if cls: + return cls(pipeline_response, None, {}) - def update( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def update( + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.SitePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: - ~azure.mgmt.web.v2018_02_01.models.SitePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def analyze_custom_hostname( - self, resource_group_name, name, host_name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomHostnameAnalysisResult" """Analyze a custom hostname. Analyze a custom hostname. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param host_name: Custom hostname. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomHostnameAnalysisResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CustomHostnameAnalysisResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.analyze_custom_hostname.metadata['url'] + url = self.analyze_custom_hostname.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if host_name is not None: query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomHostnameAnalysisResult', response) + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} + analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} # type: ignore def apply_slot_config_to_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - """Applies the configuration settings from the target slot onto the - current slot. + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + """Applies the configuration settings from the target slot onto the current slot. - Applies the configuration settings from the target slot onto the - current slot. + Applies the configuration settings from the target slot onto the current slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :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 """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.apply_slot_config_to_production.metadata['url'] + url = self.apply_slot_config_to_production.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} + apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} # type: ignore def backup( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Creates a backup of an app. Creates a backup of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: Backup configuration. You can use the JSON response - from the POST action as input here. + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.backup.metadata['url'] + url = self.backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} + backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} # type: ignore def list_backups( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2018_02_01.models.BackupItemPaged[~azure.mgmt.web.v2018_02_01.models.BackupItem] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_backups.metadata['url'] + url = self.list_backups.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} + return ItemPaged( + get_next, extract_data + ) + list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} # type: ignore def get_backup_status( - self, resource_group_name, name, backup_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Gets a backup of an app by its ID. Gets a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_backup_status.metadata['url'] + url = self.get_backup_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} + get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore def delete_backup( - self, resource_group_name, name, backup_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a backup of an app by its ID. Deletes a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_backup.metadata['url'] + url = self.delete_backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def list_backup_status_secrets( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, **operation_config): - """Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + if cls: + return cls(pipeline_response, None, {}) - Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_backup_status_secrets( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str @@ -925,116 +932,121 @@ def list_backup_status_secrets( :type backup_id: str :param request: Information on backup request. :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.list_backup_status_secrets.metadata['url'] + url = self.list_backup_status_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} - + list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} # type: ignore def _restore_initial( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore.metadata['url'] + url = self._restore_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def restore( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, polling=True, **operation_config): - """Restores a specific backup to another app (or deployment slot, if - specified). + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore - Restores a specific backup to another app (or deployment slot, if - specified). + def begin_restore( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restores a specific backup to another app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str @@ -1042,2495 +1054,2416 @@ def restore( :type backup_id: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_initial( - resource_group_name=resource_group_name, - name=name, - backup_id=backup_id, - request=request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore def list_configurations( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigResourceCollection"] """List the configurations of an app. List the configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigResourcePaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configurations.metadata['url'] + url = self.list_configurations.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} + return ItemPaged( + get_next, extract_data + ) + list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} # type: ignore def update_application_settings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the application settings of an app. Replaces the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_application_settings.metadata['url'] + url = self.update_application_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} + update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} # type: ignore def list_application_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of an app. Gets the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_application_settings.metadata['url'] + url = self.list_application_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} + list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} # type: ignore def update_auth_settings( - self, resource_group_name, name, site_auth_settings, custom_headers=None, raw=False, **operation_config): - """Updates the Authentication / Authorization settings associated with web - app. + self, + resource_group_name, # type: str + name, # type: str + site_auth_settings, # type: "models.SiteAuthSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" + """Updates the Authentication / Authorization settings associated with web app. - Updates the Authentication / Authorization settings associated with web - app. + Updates the Authentication / Authorization settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param site_auth_settings: Auth settings associated with web app. - :type site_auth_settings: - ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type site_auth_settings: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_auth_settings.metadata['url'] + url = self.update_auth_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} + update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} # type: ignore def get_auth_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" """Gets the Authentication/Authorization settings of an app. Gets the Authentication/Authorization settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_auth_settings.metadata['url'] + url = self.get_auth_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} + get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} # type: ignore def update_azure_storage_accounts( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + azure_storage_accounts, # type: "models.AzureStoragePropertyDictionaryResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Updates the Azure storage account configurations of an app. Updates the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ - azure_storage_accounts = models.AzureStoragePropertyDictionaryResource(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_azure_storage_accounts.metadata['url'] + url = self.update_azure_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts'} + update_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts'} # type: ignore def list_azure_storage_accounts( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Gets the Azure storage account configurations of an app. Gets the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_azure_storage_accounts.metadata['url'] + url = self.list_azure_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list'} + list_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list'} # type: ignore def update_backup_configuration( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Updates the backup configuration of an app. Updates the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param request: Edited backup configuration. :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_backup_configuration.metadata['url'] + url = self.update_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} + update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore def delete_backup_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the backup configuration of an app. Deletes the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_backup_configuration.metadata['url'] + url = self.delete_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} + if cls: + return cls(pipeline_response, None, {}) + + delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore def get_backup_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Gets the backup configuration of an app. Gets the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_backup_configuration.metadata['url'] + url = self.get_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} + get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} # type: ignore def update_connection_strings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + connection_strings, # type: "models.ConnectionStringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Replaces the connection strings of an app. Replaces the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.ConnStringValueTypePair] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - connection_strings = models.ConnectionStringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_connection_strings.metadata['url'] + url = self.update_connection_strings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} + update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} # type: ignore def list_connection_strings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Gets the connection strings of an app. Gets the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_connection_strings.metadata['url'] + url = self.list_connection_strings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} # type: ignore def get_diagnostic_logs_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Gets the logging configuration of an app. Gets the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_diagnostic_logs_configuration.metadata['url'] + url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} + get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore def update_diagnostic_logs_config( - self, resource_group_name, name, site_logs_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_logs_config, # type: "models.SiteLogsConfig" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Updates the logging configuration of an app. Updates the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_logs_config: A SiteLogsConfig JSON object that contains - the logging configuration to change in the "properties" property. - :type site_logs_config: - ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_diagnostic_logs_config.metadata['url'] + url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} + update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore def update_metadata( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + metadata, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the metadata of an app. Replaces the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_metadata.metadata['url'] + url = self.update_metadata.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} + update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} # type: ignore def list_metadata( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the metadata of an app. Gets the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_metadata.metadata['url'] + url = self.list_metadata.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} - + list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} # type: ignore def _list_publishing_credentials_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.User" + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_publishing_credentials.metadata['url'] + url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _list_publishing_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore - def list_publishing_credentials( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_list_publishing_credentials( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.User"] """Gets the Git/FTP publishing credentials of an app. Gets the Git/FTP publishing credentials of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns User or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.User] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.User]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._list_publishing_credentials_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('User', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._list_publishing_credentials_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore def update_site_push_settings( - self, resource_group_name, name, push_settings, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + push_settings, # type: "models.PushSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Updates the Push settings associated with web app. Updates the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param push_settings: Push settings associated with web app. :type push_settings: ~azure.mgmt.web.v2018_02_01.models.PushSettings - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_site_push_settings.metadata['url'] + url = self.update_site_push_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} + update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} # type: ignore def list_site_push_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Gets the Push settings associated with web app. Gets the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_site_push_settings.metadata['url'] + url = self.list_site_push_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} + list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} # type: ignore def list_slot_configuration_names( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the names of app settings and connection strings that stick to the - slot (not swapped). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SlotConfigNamesResource" + """Gets the names of app settings and connection strings that stick to the slot (not swapped). - Gets the names of app settings and connection strings that stick to the - slot (not swapped). + Gets the names of app settings and connection strings that stick to the slot (not swapped). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SlotConfigNamesResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_slot_configuration_names.metadata['url'] + url = self.list_slot_configuration_names.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SlotConfigNamesResource', response) + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} + list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore def update_slot_configuration_names( - self, resource_group_name, name, slot_config_names, custom_headers=None, raw=False, **operation_config): - """Updates the names of application settings and connection string that - remain with the slot during swap operation. + self, + resource_group_name, # type: str + name, # type: str + slot_config_names, # type: "models.SlotConfigNamesResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SlotConfigNamesResource" + """Updates the names of application settings and connection string that remain with the slot during swap operation. - Updates the names of application settings and connection string that - remain with the slot during swap operation. + Updates the names of application settings and connection string that remain with the slot + during swap operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot_config_names: Names of application settings and connection - strings. See example. - :type slot_config_names: - ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SlotConfigNamesResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param slot_config_names: Names of application settings and connection strings. See example. + :type slot_config_names: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_slot_configuration_names.metadata['url'] + url = self.update_slot_configuration_names.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SlotConfigNamesResource', response) + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} + update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore def get_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. - Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_configuration.metadata['url'] + url = self.get_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def create_or_update_configuration( - self, resource_group_name, name, site_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_configuration.metadata['url'] + url = self.create_or_update_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def update_configuration( - self, resource_group_name, name, site_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_configuration.metadata['url'] + url = self.update_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def list_configuration_snapshot_info( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigurationSnapshotInfoCollection"] + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. - Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigurationSnapshotInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfoPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configuration_snapshot_info.metadata['url'] + url = self.list_configuration_snapshot_info.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigurationSnapshotInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigurationSnapshotInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} # type: ignore def get_configuration_snapshot( - self, resource_group_name, name, snapshot_id, custom_headers=None, raw=False, **operation_config): - """Gets a snapshot of the configuration of an app at a previous point in - time. + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets a snapshot of the configuration of an app at a previous point in time. - Gets a snapshot of the configuration of an app at a previous point in - time. + Gets a snapshot of the configuration of an app at a previous point in time. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_configuration_snapshot.metadata['url'] + url = self.get_configuration_snapshot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} + get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} # type: ignore def recover_site_configuration_snapshot( - self, resource_group_name, name, snapshot_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reverts the configuration of an app to a previous snapshot. Reverts the configuration of an app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.recover_site_configuration_snapshot.metadata['url'] + url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} + recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} # type: ignore def get_web_site_container_logs( - self, resource_group_name, name, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the last lines of docker logs for the given site. Gets the last lines of docker logs for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_web_site_container_logs.metadata['url'] + url = self.get_web_site_container_logs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/octet-stream' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} + get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} # type: ignore def get_container_logs_zip( - self, resource_group_name, name, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the ZIP archived docker log files for the given site. Gets the ZIP archived docker log files for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_container_logs_zip.metadata['url'] + url = self.get_container_logs_zip.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/zip' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} + get_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} # type: ignore def list_continuous_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ContinuousWebJobCollection"] """List continuous web jobs for an app, or a deployment slot. List continuous web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContinuousWebJob - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobPaged[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_continuous_web_jobs.metadata['url'] + url = self.list_continuous_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContinuousWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContinuousWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} # type: ignore def get_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ContinuousWebJob"] """Gets a continuous web job by its ID for an app, or a deployment slot. Gets a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContinuousWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_continuous_web_job.metadata['url'] + url = self.get_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ContinuousWebJob', response) + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} + get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore def delete_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a continuous web job by its ID for an app, or a deployment slot. Delete a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_continuous_web_job.metadata['url'] + url = self.delete_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} + delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore def start_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Start a continuous web job for an app, or a deployment slot. Start a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_continuous_web_job.metadata['url'] + url = self.start_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} + start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} # type: ignore def stop_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop a continuous web job for an app, or a deployment slot. Stop a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_continuous_web_job.metadata['url'] + url = self.stop_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} + stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} # type: ignore def list_deployments( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentCollection"] """List deployments for an app, or a deployment slot. List deployments for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Deployment - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DeploymentPaged[~azure.mgmt.web.v2018_02_01.models.Deployment] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_deployments.metadata['url'] + url = self.list_deployments.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} # type: ignore def get_deployment( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Get a deployment by its ID for an app, or a deployment slot. Get a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_deployment.metadata['url'] + url = self.get_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def create_deployment( - self, resource_group_name, name, id, deployment, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + deployment, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Create a deployment for an app, or a deployment slot. Create a deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str @@ -3538,1233 +3471,1227 @@ def create_deployment( :type id: str :param deployment: Deployment details. :type deployment: ~azure.mgmt.web.v2018_02_01.models.Deployment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_deployment.metadata['url'] + url = self.create_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def delete_deployment( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a deployment by its ID for an app, or a deployment slot. Delete a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_deployment.metadata['url'] + url = self.delete_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def list_deployment_log( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): - """List deployment log for specific deployment for an app, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" + """List deployment log for specific deployment for an app, or a deployment slot. - List deployment log for specific deployment for an app, or a deployment - slot. + List deployment log for specific deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param id: The ID of a specific deployment. This is the value of the - name property in the JSON response from "GET - /api/sites/{siteName}/deployments". + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_deployment_log.metadata['url'] + url = self.list_deployment_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} + list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} # type: ignore def discover_backup( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): - """Discovers an existing app backup that can be restored from a blob in - Azure storage. Use this to get information about the databases stored - in a backup. + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreRequest" + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. - Discovers an existing app backup that can be restored from a blob in - Azure storage. Use this to get information about the databases stored - in a backup. + Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to + get information about the databases stored in a backup. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: A RestoreRequest object that includes Azure storage - URL and blog name for discovery of backup. + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RestoreRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.discover_backup.metadata['url'] + url = self.discover_backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RestoreRequest', response) + deserialized = self._deserialize('RestoreRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - discover_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup'} + discover_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup'} # type: ignore def list_domain_ownership_identifiers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """Lists ownership identifiers for domain associated with web app. Lists ownership identifiers for domain associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2018_02_01.models.IdentifierPaged[~azure.mgmt.web.v2018_02_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_domain_ownership_identifiers.metadata['url'] + url = self.list_domain_ownership_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} # type: ignore def get_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" """Get domain ownership identifier for web app. Get domain ownership identifier for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_domain_ownership_identifier.metadata['url'] + url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def create_or_update_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_domain_ownership_identifier.metadata['url'] + url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def delete_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a domain ownership identifier for a web app. Deletes a domain ownership identifier for a web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_domain_ownership_identifier.metadata['url'] + url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def update_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_domain_ownership_identifier.metadata['url'] + url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def get_ms_deploy_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_ms_deploy_status.metadata['url'] + url = self.get_ms_deploy_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} - + get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore def _create_ms_deploy_operation_initial( - self, resource_group_name, name, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_ms_deploy_operation.metadata['url'] + url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore - def create_ms_deploy_operation( - self, resource_group_name, name, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_ms_deploy_operation( + self, + resource_group_name, # type: str + name, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_ms_deploy_operation_initial( - resource_group_name=resource_group_name, - name=name, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore def get_ms_deploy_log( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_ms_deploy_log.metadata['url'] + url = self.get_ms_deploy_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} + get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} # type: ignore def list_functions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.FunctionEnvelopeCollection"] """List the functions for a web site, or a deployment slot. List the functions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of FunctionEnvelope - :rtype: - ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelopePaged[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_functions.metadata['url'] + url = self.list_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('FunctionEnvelopeCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.FunctionEnvelopePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} # type: ignore def get_functions_admin_token( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Fetch a short lived token that can be exchanged for a master key. Fetch a short lived token that can be exchanged for a master key. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_functions_admin_token.metadata['url'] + url = self.get_functions_admin_token.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} + get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} # type: ignore def get_function( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.FunctionEnvelope"] """Get function information by its ID for web site, or a deployment slot. Get function information by its ID for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionEnvelope or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_function.metadata['url'] + url = self.get_function.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} - + get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def _create_function_initial( - self, resource_group_name, name, function_name, function_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionEnvelope" + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_function.metadata['url'] + url = self._create_function_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_function_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore - def create_function( - self, resource_group_name, name, function_name, function_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_function( + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.FunctionEnvelope"] """Create function for web site, or a deployment slot. Create function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str :param function_envelope: Function details. - :type function_envelope: - ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type function_envelope: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns FunctionEnvelope or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_function_initial( - resource_group_name=resource_group_name, - name=name, - function_name=function_name, - function_envelope=function_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('FunctionEnvelope', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_function_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def delete_function( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function for web site, or a deployment slot. Delete a function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_function.metadata['url'] + url = self.delete_function.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} + delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def create_or_update_function_secret( - self, resource_group_name, name, function_name, key_name, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a function secret. Add or update a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -4772,80 +4699,78 @@ def create_or_update_function_secret( :type function_name: str :param key_name: The name of the key. :type key_name: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_function_secret.metadata['url'] + url = self.create_or_update_function_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} + create_or_update_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore def delete_function_secret( - self, resource_group_name, name, function_name, key_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function secret. Delete a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -4853,369 +4778,356 @@ def delete_function_secret( :type function_name: str :param key_name: The name of the key. :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_function_secret.metadata['url'] + url = self.delete_function_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore def list_function_keys( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Get function keys for a function in a web site, or a deployment slot. Get function keys for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_function_keys.metadata['url'] + url = self.list_function_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys'} + list_function_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys'} # type: ignore def list_function_secrets( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): - """Get function secrets for a function in a web site, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" + """Get function secrets for a function in a web site, or a deployment slot. - Get function secrets for a function in a web site, or a deployment - slot. + Get function secrets for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_function_secrets.metadata['url'] + url = self.list_function_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} + list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} # type: ignore def list_host_keys( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostKeys" """Get host secrets for a function app. Get host secrets for a function app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HostKeys or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_host_keys.metadata['url'] + url = self.list_host_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostKeys', response) + deserialized = self._deserialize('HostKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_host_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys'} + list_host_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys'} # type: ignore def list_sync_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """This is to allow calling via powershell and ARM template. This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_sync_status.metadata['url'] + url = self.list_sync_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - list_sync_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus'} + if cls: + return cls(pipeline_response, None, {}) + + list_sync_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus'} # type: ignore def sync_functions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.sync_functions.metadata['url'] + url = self.sync_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync'} + if cls: + return cls(pipeline_response, None, {}) + + sync_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync'} # type: ignore def create_or_update_host_secret( - self, resource_group_name, name, key_type, key_name, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a host level secret. Add or update a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -5223,80 +5135,78 @@ def create_or_update_host_secret( :type key_type: str :param key_name: The name of the key. :type key_name: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_host_secret.metadata['url'] + url = self.create_or_update_host_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} + create_or_update_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore def delete_host_secret( - self, resource_group_name, name, key_type, key_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a host level secret. Delete a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -5304,337 +5214,331 @@ def delete_host_secret( :type key_type: str :param key_name: The name of the key. :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_host_secret.metadata['url'] + url = self.delete_host_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} + delete_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore def list_host_name_bindings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HostNameBindingCollection"] """Get hostname bindings for an app or a deployment slot. Get hostname bindings for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HostNameBinding - :rtype: - ~azure.mgmt.web.v2018_02_01.models.HostNameBindingPaged[~azure.mgmt.web.v2018_02_01.models.HostNameBinding] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_host_name_bindings.metadata['url'] + url = self.list_host_name_bindings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HostNameBindingCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HostNameBindingPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} + return ItemPaged( + get_next, extract_data + ) + list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} # type: ignore def get_host_name_binding( - self, resource_group_name, name, host_name, custom_headers=None, raw=False, **operation_config): - """Get the named hostname binding for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" + """Get the named hostname binding for an app (or deployment slot, if specified). - Get the named hostname binding for an app (or deployment slot, if - specified). + Get the named hostname binding for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_host_name_binding.metadata['url'] + url = self.get_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def create_or_update_host_name_binding( - self, resource_group_name, name, host_name, host_name_binding, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + host_name_binding, # type: "models.HostNameBinding" + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param host_name_binding: Binding details. This is the JSON - representation of a HostNameBinding object. - :type host_name_binding: - ~azure.mgmt.web.v2018_02_01.models.HostNameBinding - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_host_name_binding.metadata['url'] + url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def delete_host_name_binding( - self, resource_group_name, name, host_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_host_name_binding.metadata['url'] + url = self.delete_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def get_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): - """Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. - Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + Retrieves a specific Service Bus Hybrid Connection used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5642,68 +5546,67 @@ def get_hybrid_connection( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_hybrid_connection.metadata['url'] + url = self.get_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def create_or_update_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5712,74 +5615,73 @@ def create_or_update_hybrid_connection( :param relay_name: The relay name for this hybrid connection. :type relay_name: str :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.HybridConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_hybrid_connection.metadata['url'] + url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Removes a Hybrid Connection from this site. Removes a Hybrid Connection from this site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5787,61 +5689,62 @@ def delete_hybrid_connection( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_hybrid_connection.metadata['url'] + url = self.delete_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def update_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5850,74 +5753,73 @@ def update_hybrid_connection( :param relay_name: The relay name for this hybrid connection. :type relay_name: str :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.HybridConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_hybrid_connection.metadata['url'] + url = self.update_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Gets the send key name and value for a Hybrid Connection. Gets the send key name and value for a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5925,1176 +5827,1146 @@ def list_hybrid_connection_keys( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_hybrid_connection_keys.metadata['url'] + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_hybrid_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieves all Service Bus Hybrid Connections used by this Web App. Retrieves all Service Bus Hybrid Connections used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_hybrid_connections.metadata['url'] + url = self.list_hybrid_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} # type: ignore def list_relay_service_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets hybrid connections configured for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Gets hybrid connections configured for an app (or deployment slot, if specified). - Gets hybrid connections configured for an app (or deployment slot, if - specified). + Gets hybrid connections configured for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_relay_service_connections.metadata['url'] + url = self.list_relay_service_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} + list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} # type: ignore def get_relay_service_connection( - self, resource_group_name, name, entity_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" """Gets a hybrid connection configuration by its name. Gets a hybrid connection configuration by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection. :type entity_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_relay_service_connection.metadata['url'] + url = self.get_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def create_or_update_relay_service_connection( - self, resource_group_name, name, entity_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_relay_service_connection.metadata['url'] + url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def delete_relay_service_connection( - self, resource_group_name, name, entity_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a relay service connection by its name. Deletes a relay service connection by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_relay_service_connection.metadata['url'] + url = self.delete_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def update_relay_service_connection( - self, resource_group_name, name, entity_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_relay_service_connection.metadata['url'] + url = self.update_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def list_instance_identifiers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppInstanceCollection"] """Gets all scale-out instances of an app. Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteInstance - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteInstancePaged[~azure.mgmt.web.v2018_02_01.models.SiteInstance] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_identifiers.metadata['url'] + url = self.list_instance_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppInstanceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} + return ItemPaged( + get_next, extract_data + ) + list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} # type: ignore def get_instance_ms_deploy_status( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_ms_deploy_status.metadata['url'] + url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} - + get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def _create_instance_ms_deploy_operation_initial( - self, resource_group_name, name, instance_id, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_ms_deploy_operation.metadata['url'] + url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_instance_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore - def create_instance_ms_deploy_operation( - self, resource_group_name, name, instance_id, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_instance_ms_deploy_operation( + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_instance_ms_deploy_operation_initial( - resource_group_name=resource_group_name, - name=name, - instance_id=instance_id, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def get_instance_ms_deploy_log( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_ms_deploy_log.metadata['url'] + url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} + get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore def list_instance_processes( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_processes.metadata['url'] + url = self.list_instance_processes.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} # type: ignore def get_instance_process( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process.metadata['url'] + url = self.get_instance_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} + get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore def delete_instance_process( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_instance_process.metadata['url'] + url = self.delete_instance_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore def get_instance_process_dump( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_dump.metadata['url'] + url = self.get_instance_process_dump.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} + get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore def list_instance_process_modules( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. - List module information for a process by its ID for a specific - scaled-out instance in a web site. + List module information for a process by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_modules.metadata['url'] + url = self.list_instance_process_modules.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore def get_instance_process_module( - self, resource_group_name, name, process_id, base_address, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -7102,161 +6974,156 @@ def get_instance_process_module( :type process_id: str :param base_address: Module base address. :type base_address: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_module.metadata['url'] + url = self.get_instance_process_module.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} + get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_instance_process_threads( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_threads.metadata['url'] + url = self.list_instance_process_threads.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore def get_instance_process_thread( - self, resource_group_name, name, process_id, thread_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -7264,1056 +7131,1050 @@ def get_instance_process_thread( :type process_id: str :param thread_id: TID. :type thread_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_thread.metadata['url'] + url = self.get_instance_process_thread.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'threadId': self._serialize.url("thread_id", thread_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} + get_instance_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore def is_cloneable( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Shows whether an app can be cloned to another resource group or - subscription. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteCloneability" + """Shows whether an app can be cloned to another resource group or subscription. - Shows whether an app can be cloned to another resource group or - subscription. + Shows whether an app can be cloned to another resource group or subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteCloneability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteCloneability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.is_cloneable.metadata['url'] + url = self.is_cloneable.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteCloneability', response) + deserialized = self._deserialize('SiteCloneability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} + is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} # type: ignore def list_sync_function_triggers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" """This is to allow calling via powershell and ARM template. This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_sync_function_triggers.metadata['url'] + url = self.list_sync_function_triggers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} + list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} # type: ignore def list_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets all metric definitions of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Gets all metric definitions of an app (or deployment slot, if specified). - Gets all metric definitions of an app (or deployment slot, if - specified). + Gets all metric definitions of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metric_definitions.metadata['url'] + url = self.list_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions'} # type: ignore def list_metrics( - self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Gets performance metrics of an app (or deployment slot, if specified). Gets performance metrics of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param details: Specify "true" to include metric details in the - response. It is "false" by default. + :param details: Specify "true" to include metric details in the response. It is "false" by + default. :type details: bool - :param filter: Return only metrics specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and - endTime eq 2014-12-31T23:59:59Z and timeGrain eq + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics.metadata['url'] + url = self.list_metrics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics'} # type: ignore def _migrate_storage_initial( - self, subscription_name, resource_group_name, name, migration_options, custom_headers=None, raw=False, **operation_config): + self, + subscription_name, # type: str + resource_group_name, # type: str + name, # type: str + migration_options, # type: "models.StorageMigrationOptions" + **kwargs # type: Any + ): + # type: (...) -> "models.StorageMigrationResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.migrate_storage.metadata['url'] + url = self._migrate_storage_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['subscriptionName'] = self._serialize.query("subscription_name", subscription_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('StorageMigrationResponse', response) + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _migrate_storage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore - def migrate_storage( - self, subscription_name, resource_group_name, name, migration_options, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_migrate_storage( + self, + subscription_name, # type: str + resource_group_name, # type: str + name, # type: str + migration_options, # type: "models.StorageMigrationOptions" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.StorageMigrationResponse"] """Restores a web app. Restores a web app. :param subscription_name: Azure subscription. :type subscription_name: str - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param migration_options: Migration migrationOptions. - :type migration_options: - ~azure.mgmt.web.v2018_02_01.models.StorageMigrationOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type migration_options: ~azure.mgmt.web.v2018_02_01.models.StorageMigrationOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - StorageMigrationResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.StorageMigrationResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.StorageMigrationResponse]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._migrate_storage_initial( - subscription_name=subscription_name, - resource_group_name=resource_group_name, - name=name, - migration_options=migration_options, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageMigrationResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.StorageMigrationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('StorageMigrationResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._migrate_storage_initial( + subscription_name=subscription_name, + resource_group_name=resource_group_name, + name=name, + migration_options=migration_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore def _migrate_my_sql_initial( - self, resource_group_name, name, migration_request_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + migration_request_envelope, # type: "models.MigrateMySqlRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.Operation" + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.migrate_my_sql.metadata['url'] + url = self._migrate_my_sql_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('Operation', response) + deserialized = self._deserialize('Operation', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _migrate_my_sql_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore - def migrate_my_sql( - self, resource_group_name, name, migration_request_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_migrate_my_sql( + self, + resource_group_name, # type: str + name, # type: str + migration_request_envelope, # type: "models.MigrateMySqlRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Operation"] """Migrates a local (in-app) MySql database to a remote MySql database. Migrates a local (in-app) MySql database to a remote MySql database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param migration_request_envelope: MySql migration options. - :type migration_request_envelope: - ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type migration_request_envelope: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Operation or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.Operation] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.Operation]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._migrate_my_sql_initial( - resource_group_name=resource_group_name, - name=name, - migration_request_envelope=migration_request_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Operation or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Operation', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._migrate_my_sql_initial( + resource_group_name=resource_group_name, + name=name, + migration_request_envelope=migration_request_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore def get_migrate_my_sql_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MigrateMySqlStatus" + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MigrateMySqlStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_migrate_my_sql_status.metadata['url'] + url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MigrateMySqlStatus', response) + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} + get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} # type: ignore def get_swift_virtual_network_connection( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" """Gets a Swift Virtual Network connection. Gets a Swift Virtual Network connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_swift_virtual_network_connection.metadata['url'] + url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + get_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def create_or_update_swift_virtual_network_connection( - self, resource_group_name, name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_swift_virtual_network_connection.metadata['url'] + url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + create_or_update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def delete_swift_virtual_network( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Deletes a Swift Virtual Network connection from an app (or deployment - slot). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Swift Virtual Network connection from an app (or deployment slot). - Deletes a Swift Virtual Network connection from an app (or deployment - slot). + Deletes a Swift Virtual Network connection from an app (or deployment slot). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_swift_virtual_network.metadata['url'] + url = self.delete_swift_virtual_network.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_swift_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + if cls: + return cls(pipeline_response, None, {}) + + delete_swift_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def update_swift_virtual_network_connection( - self, resource_group_name, name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_swift_virtual_network_connection.metadata['url'] + url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def list_network_features( - self, resource_group_name, name, view, custom_headers=None, raw=False, **operation_config): - """Gets all network features used by the app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + view, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.NetworkFeatures"] + """Gets all network features used by the app (or deployment slot, if specified). - Gets all network features used by the app (or deployment slot, if - specified). + Gets all network features used by the app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param view: The type of view. This can either be "summary" or - "detailed". + :param view: The type of view. This can either be "summary" or "detailed". :type view: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NetworkFeatures or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.NetworkFeatures or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_network_features.metadata['url'] + url = self.list_network_features.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'view': self._serialize.url("view", view, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('NetworkFeatures', response) + deserialized = self._deserialize('NetworkFeatures', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} + list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} # type: ignore def get_network_trace_operation( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_trace_operation.metadata['url'] + url = self.get_network_trace_operation.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}'} + get_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}'} # type: ignore def start_web_site_network_trace( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str """Start capturing network packets for the site (To be deprecated). Start capturing network packets for the site (To be deprecated). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -8323,123 +8184,130 @@ def start_web_site_network_trace( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_web_site_network_trace.metadata['url'] + url = self.start_web_site_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} - + start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} # type: ignore def _start_web_site_network_trace_operation_initial( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_web_site_network_trace_operation.metadata['url'] + url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_web_site_network_trace_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore - def start_web_site_network_trace_operation( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_web_site_network_trace_operation( + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -8449,1352 +8317,1308 @@ def start_web_site_network_trace_operation( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_web_site_network_trace_operation_initial( - resource_group_name=resource_group_name, - name=name, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_web_site_network_trace_operation_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_web_site_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore def stop_web_site_network_trace( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_web_site_network_trace.metadata['url'] + url = self.stop_web_site_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} + stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} # type: ignore def get_network_traces( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_traces.metadata['url'] + url = self.get_network_traces.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}'} + get_network_traces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}'} # type: ignore def get_network_trace_operation_v2( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_trace_operation_v2.metadata['url'] + url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}'} + get_network_trace_operation_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}'} # type: ignore def get_network_traces_v2( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_traces_v2.metadata['url'] + url = self.get_network_traces_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}'} + get_network_traces_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}'} # type: ignore def generate_new_site_publishing_password( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Generates a new publishing password for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Generates a new publishing password for an app (or deployment slot, if specified). - Generates a new publishing password for an app (or deployment slot, if - specified). + Generates a new publishing password for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.generate_new_site_publishing_password.metadata['url'] + url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} + generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} # type: ignore def list_perf_mon_counters( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PerfMonCounterCollection"] """Gets perfmon counters for web app. Gets perfmon counters for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PerfMonResponse - :rtype: - ~azure.mgmt.web.v2018_02_01.models.PerfMonResponsePaged[~azure.mgmt.web.v2018_02_01.models.PerfMonResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_perf_mon_counters.metadata['url'] + url = self.list_perf_mon_counters.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PerfMonResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} + return ItemPaged( + get_next, extract_data + ) + list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} # type: ignore def get_site_php_error_log_flag( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SitePhpErrorLogFlag" """Gets web app's event logs. Gets web app's event logs. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SitePhpErrorLogFlag or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SitePhpErrorLogFlag or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_php_error_log_flag.metadata['url'] + url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SitePhpErrorLogFlag', response) + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} + get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} # type: ignore def list_premier_add_ons( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets the premier add-ons of an app. Gets the premier add-ons of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_premier_add_ons.metadata['url'] + url = self.list_premier_add_ons.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} + list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} # type: ignore def get_premier_add_on( - self, resource_group_name, name, premier_add_on_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets a named add-on of an app. Gets a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_premier_add_on.metadata['url'] + url = self.get_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def add_premier_add_on( - self, resource_group_name, name, premier_add_on_name, premier_add_on, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + premier_add_on, # type: "models.PremierAddOn" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. + :param premier_add_on: A JSON representation of the edited premier add-on. :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.add_premier_add_on.metadata['url'] + url = self.add_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def delete_premier_add_on( - self, resource_group_name, name, premier_add_on_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a premier add-on from an app. Delete a premier add-on from an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_premier_add_on.metadata['url'] + url = self.delete_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def update_premier_add_on( - self, resource_group_name, name, premier_add_on_name, premier_add_on, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + premier_add_on, # type: "models.PremierAddOnPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: - ~azure.mgmt.web.v2018_02_01.models.PremierAddOnPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_premier_add_on.metadata['url'] + url = self.update_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + update_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def get_private_access( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. - Gets data around private site access enablement and authorized Virtual - Networks that can access the site. + Gets data around private site access enablement and authorized Virtual Networks that can access + the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_private_access.metadata['url'] + url = self.get_private_access.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_private_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} + get_private_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore def put_private_access_vnet( - self, resource_group_name, name, access, custom_headers=None, raw=False, **operation_config): - """Sets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + access, # type: "models.PrivateAccess" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. - Sets data around private site access enablement and authorized Virtual - Networks that can access the site. + Sets data around private site access enablement and authorized Virtual Networks that can access + the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param access: The information for the private access + :param access: The information for the private access. :type access: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.put_private_access_vnet.metadata['url'] + url = self.put_private_access_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - put_private_access_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} + put_private_access_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore def list_processes( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_processes.metadata['url'] + url = self.list_processes.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} # type: ignore def get_process( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process.metadata['url'] + url = self.get_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} + get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore def delete_process( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_process.metadata['url'] + url = self.delete_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} + delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore def get_process_dump( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_dump.metadata['url'] + url = self.get_process_dump.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} + get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} # type: ignore def list_process_modules( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. - List module information for a process by its ID for a specific - scaled-out instance in a web site. + List module information for a process by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_modules.metadata['url'] + url = self.list_process_modules.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} # type: ignore def get_process_module( - self, resource_group_name, name, process_id, base_address, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -9802,151 +9626,146 @@ def get_process_module( :type process_id: str :param base_address: Module base address. :type base_address: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_module.metadata['url'] + url = self.get_process_module.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} + get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_process_threads( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_threads.metadata['url'] + url = self.list_process_threads.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} # type: ignore def get_process_thread( - self, resource_group_name, name, process_id, thread_id, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -9954,5649 +9773,5662 @@ def get_process_thread( :type process_id: str :param thread_id: TID. :type thread_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_thread.metadata['url'] + url = self.get_process_thread.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'threadId': self._serialize.url("thread_id", thread_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads/{threadId}'} + get_process_thread.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads/{threadId}'} # type: ignore def list_public_certificates( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PublicCertificateCollection"] """Get public certificates for an app or a deployment slot. Get public certificates for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PublicCertificate - :rtype: - ~azure.mgmt.web.v2018_02_01.models.PublicCertificatePaged[~azure.mgmt.web.v2018_02_01.models.PublicCertificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_public_certificates.metadata['url'] + url = self.list_public_certificates.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PublicCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PublicCertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} + return ItemPaged( + get_next, extract_data + ) + list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} # type: ignore def get_public_certificate( - self, resource_group_name, name, public_certificate_name, custom_headers=None, raw=False, **operation_config): - """Get the named public certificate for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" + """Get the named public certificate for an app (or deployment slot, if specified). - Get the named public certificate for an app (or deployment slot, if - specified). + Get the named public certificate for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_public_certificate.metadata['url'] + url = self.get_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def create_or_update_public_certificate( - self, resource_group_name, name, public_certificate_name, public_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + public_certificate, # type: "models.PublicCertificate" + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param public_certificate: Public certificate details. This is the - JSON representation of a PublicCertificate object. - :type public_certificate: - ~azure.mgmt.web.v2018_02_01.models.PublicCertificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_public_certificate.metadata['url'] + url = self.create_or_update_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def delete_public_certificate( - self, resource_group_name, name, public_certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_public_certificate.metadata['url'] + url = self.delete_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def list_publishing_profile_xml_with_secrets( - self, resource_group_name, name, format=None, include_disaster_recovery_endpoints=None, custom_headers=None, raw=False, callback=None, **operation_config): - """Gets the publishing profile for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + publishing_profile_options, # type: "models.CsmPublishingProfileOptions" + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets the publishing profile for an app (or deployment slot, if specified). - Gets the publishing profile for an app (or deployment slot, if - specified). + Gets the publishing profile for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param format: Name of the format. Valid values are: - FileZilla3 - WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2018_02_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the - DisasterRecover endpoint if true - :type include_disaster_recovery_endpoints: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2018_02_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError """ - publishing_profile_options = models.CsmPublishingProfileOptions(format=format, include_disaster_recovery_endpoints=include_disaster_recovery_endpoints) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.list_publishing_profile_xml_with_secrets.metadata['url'] + url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/xml' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} + list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} # type: ignore def reset_production_slot_config( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. - Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reset_production_slot_config.metadata['url'] + url = self.reset_production_slot_config.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} + if cls: + return cls(pipeline_response, None, {}) + + reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} # type: ignore def restart( - self, resource_group_name, name, soft_restart=None, synchronous=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + soft_restart=None, # type: Optional[bool] + synchronous=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restarts an app (or deployment slot, if specified). Restarts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param soft_restart: Specify true to apply the configuration settings - and restarts the app only if necessary. By default, the API always - restarts and reprovisions the app. + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. :type soft_restart: bool - :param synchronous: Specify true to block until the app is restarted. - By default, it is set to false, and the API responds immediately - (asynchronous). + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). :type synchronous: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.restart.metadata['url'] + url = self.restart.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') if synchronous is not None: query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} + if cls: + return cls(pipeline_response, None, {}) + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} # type: ignore def _restore_from_backup_blob_initial( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_backup_blob.metadata['url'] + url = self._restore_from_backup_blob_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_backup_blob( - self, resource_group_name, name, request, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _restore_from_backup_blob_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore + + def begin_restore_from_backup_blob( + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores an app from a backup blob in Azure Storage. Restores an app from a backup blob in Azure Storage. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_from_backup_blob_initial( - resource_group_name=resource_group_name, - name=name, - request=request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_backup_blob_initial( + resource_group_name=resource_group_name, + name=name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_backup_blob.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore def _restore_from_deleted_app_initial( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_deleted_app.metadata['url'] + url = self._restore_from_deleted_app_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_deleted_app( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _restore_from_deleted_app_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore + + def begin_restore_from_deleted_app( + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a deleted web app to this web app. Restores a deleted web app to this web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param restore_request: Deleted web app restore information. - :type restore_request: - ~azure.mgmt.web.v2018_02_01.models.DeletedAppRestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_from_deleted_app_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_deleted_app_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_deleted_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore def _restore_snapshot_initial( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_snapshot.metadata['url'] + url = self._restore_snapshot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_snapshot( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _restore_snapshot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore + + def begin_restore_snapshot( + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a web app from a snapshot. Restores a web app from a snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param restore_request: Snapshot restore settings. Snapshot - information can be obtained by calling GetDeletedSites or - GetSiteSnapshots API. - :type restore_request: - ~azure.mgmt.web.v2018_02_01.models.SnapshotRestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_snapshot_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_snapshot_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore def list_site_extensions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteExtensionInfoCollection"] """Get list of siteextensions for a web site, or a deployment slot. Get list of siteextensions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteExtensionInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfoPaged[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_extensions.metadata['url'] + url = self.list_site_extensions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteExtensionInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} + return ItemPaged( + get_next, extract_data + ) + list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} # type: ignore def get_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): - """Get site extension information by its ID for a web site, or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + """Get site extension information by its ID for a web site, or a deployment slot. - Get site extension information by its ID for a web site, or a - deployment slot. + Get site extension information by its ID for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteExtensionInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_extension.metadata['url'] + url = self.get_site_extension.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} - + get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def _install_site_extension_initial( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.install_site_extension.metadata['url'] + url = self._install_site_extension_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _install_site_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore - def install_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_install_site_extension( + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteExtensionInfo"] """Install site extension on a web site, or a deployment slot. Install site extension on a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteExtensionInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo]] - :raises: :class:`CloudError` - """ - raw_result = self._install_site_extension_initial( - resource_group_name=resource_group_name, - name=name, - site_extension_id=site_extension_id, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - def get_long_running_output(response): - deserialized = self._deserialize('SiteExtensionInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def delete_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Remove a site extension from a web site, or a deployment slot. Remove a site extension from a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_site_extension.metadata['url'] + url = self.delete_site_extension.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def list_slots( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Gets an app's deployment slots. Gets an app's deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SitePaged[~azure.mgmt.web.v2018_02_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slots.metadata['url'] + url = self.list_slots.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} + return ItemPaged( + get_next, extract_data + ) + list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} # type: ignore def get_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Site"] """Gets the details of a web, mobile, or API app. Gets the details of a web, mobile, or API app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. By default, this API returns - the production slot. + :param slot: Name of the deployment slot. By default, this API returns the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_slot.metadata['url'] + url = self.get_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} - + get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def _create_or_update_slot_initial( - self, resource_group_name, name, site_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_slot.metadata['url'] + url = self._create_or_update_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore - def create_or_update_slot( - self, resource_group_name, name, site_envelope, slot, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def begin_create_or_update_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Site"] + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.Site - :param slot: Name of the deployment slot to create or update. By - default, this API attempts to create or modify the production slot. + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Site or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.Site] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.Site]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_envelope=site_envelope, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Site', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def delete_slot( - self, resource_group_name, name, slot, delete_metrics=None, delete_empty_server_farm=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + delete_metrics=None, # type: Optional[bool] + delete_empty_server_farm=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a web, mobile, or API app, or one of the deployment slots. Deletes a web, mobile, or API app, or one of the deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app to delete. :type name: str - :param slot: Name of the deployment slot to delete. By default, the - API deletes the production slot. + :param slot: Name of the deployment slot to delete. By default, the API deletes the production + slot. :type slot: str :param delete_metrics: If true, web app metrics are also deleted. :type delete_metrics: bool - :param delete_empty_server_farm: Specify true if the App Service plan - will be empty after app deletion and you want to delete the empty App - Service plan. By default, the empty App Service plan is not deleted. + :param delete_empty_server_farm: Specify true if the App Service plan will be empty after app + deletion and you want to delete the empty App Service plan. By default, the empty App Service + plan is not deleted. :type delete_empty_server_farm: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_slot.metadata['url'] + url = self.delete_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if delete_metrics is not None: query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') if delete_empty_server_farm is not None: query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + if cls: + return cls(pipeline_response, None, {}) - def update_slot( - self, resource_group_name, name, site_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore - Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def update_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.SitePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Creates a new web, mobile, or API app in an existing resource group, or updates an existing + app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: - ~azure.mgmt.web.v2018_02_01.models.SitePatchResource - :param slot: Name of the deployment slot to create or update. By - default, this API attempts to create or modify the production slot. + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2018_02_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_slot.metadata['url'] + url = self.update_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def analyze_custom_hostname_slot( - self, resource_group_name, name, slot, host_name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomHostnameAnalysisResult" """Analyze a custom hostname. Analyze a custom hostname. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param host_name: Custom hostname. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomHostnameAnalysisResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CustomHostnameAnalysisResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.analyze_custom_hostname_slot.metadata['url'] + url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if host_name is not None: query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomHostnameAnalysisResult', response) + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} + analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} # type: ignore def apply_slot_configuration_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - """Applies the configuration settings from the target slot onto the - current slot. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + """Applies the configuration settings from the target slot onto the current slot. - Applies the configuration settings from the target slot onto the - current slot. + Applies the configuration settings from the target slot onto the current slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :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 """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.apply_slot_configuration_slot.metadata['url'] + url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} + if cls: + return cls(pipeline_response, None, {}) + + apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} # type: ignore def backup_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Creates a backup of an app. Creates a backup of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: Backup configuration. You can use the JSON response - from the POST action as input here. - :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a backup for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + backup for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.backup_slot.metadata['url'] + url = self.backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} + backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} # type: ignore def list_backups_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get backups of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2018_02_01.models.BackupItemPaged[~azure.mgmt.web.v2018_02_01.models.BackupItem] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_backups_slot.metadata['url'] + url = self.list_backups_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} + return ItemPaged( + get_next, extract_data + ) + list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} # type: ignore def get_backup_status_slot( - self, resource_group_name, name, backup_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Gets a backup of an app by its ID. Gets a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a backup + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_backup_status_slot.metadata['url'] + url = self.get_backup_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} + get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore def delete_backup_slot( - self, resource_group_name, name, backup_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a backup of an app by its ID. Deletes a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + backup of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_backup_slot.metadata['url'] + url = self.delete_backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} + if cls: + return cls(pipeline_response, None, {}) - def list_backup_status_secrets_slot( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, **operation_config): - """Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. - - Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_backup_status_secrets_slot( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Gets status of a web app backup that may be in progress, including secrets associated with the + backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the + backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param backup_id: ID of backup. :type backup_id: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str :param request: Information on backup request. :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.list_backup_status_secrets_slot.metadata['url'] + url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} - + list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} # type: ignore def _restore_slot_initial( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_slot.metadata['url'] + url = self._restore_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _restore_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore - def restore_slot( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, polling=True, **operation_config): - """Restores a specific backup to another app (or deployment slot, if - specified). + def begin_restore_slot( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restores a specific backup to another app (or deployment slot, if specified). - Restores a specific backup to another app (or deployment slot, if - specified). + Restores a specific backup to another app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_slot_initial( - resource_group_name=resource_group_name, - name=name, - backup_id=backup_id, - request=request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_slot_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore def list_configurations_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigResourceCollection"] """List the configurations of an app. List the configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigResource - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigResourcePaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configurations_slot.metadata['url'] + url = self.list_configurations_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} + return ItemPaged( + get_next, extract_data + ) + list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} # type: ignore def update_application_settings_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the application settings of an app. Replaces the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the application settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + application settings for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_application_settings_slot.metadata['url'] + url = self.update_application_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} + update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} # type: ignore def list_application_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of an app. Gets the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the application settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + application settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_application_settings_slot.metadata['url'] + url = self.list_application_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} + list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} # type: ignore def update_auth_settings_slot( - self, resource_group_name, name, site_auth_settings, slot, custom_headers=None, raw=False, **operation_config): - """Updates the Authentication / Authorization settings associated with web - app. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_auth_settings, # type: "models.SiteAuthSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" + """Updates the Authentication / Authorization settings associated with web app. - Updates the Authentication / Authorization settings associated with web - app. + Updates the Authentication / Authorization settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param site_auth_settings: Auth settings associated with web app. - :type site_auth_settings: - ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_auth_settings_slot.metadata['url'] + url = self.update_auth_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} + update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} # type: ignore def get_auth_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" """Gets the Authentication/Authorization settings of an app. Gets the Authentication/Authorization settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_auth_settings_slot.metadata['url'] + url = self.get_auth_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} + get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} # type: ignore def update_azure_storage_accounts_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + azure_storage_accounts, # type: "models.AzureStoragePropertyDictionaryResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Updates the Azure storage account configurations of an app. Updates the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the Azure storage account configurations for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.AzureStorageInfoValue] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ - azure_storage_accounts = models.AzureStoragePropertyDictionaryResource(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_azure_storage_accounts_slot.metadata['url'] + url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts'} + update_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts'} # type: ignore def list_azure_storage_accounts_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Gets the Azure storage account configurations of an app. Gets the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the Azure storage account configurations for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_azure_storage_accounts_slot.metadata['url'] + url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list'} + list_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list'} # type: ignore def update_backup_configuration_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Updates the backup configuration of an app. Updates the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + backup configuration for the production slot. + :type slot: str :param request: Edited backup configuration. :type request: ~azure.mgmt.web.v2018_02_01.models.BackupRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the backup configuration for the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_backup_configuration_slot.metadata['url'] + url = self.update_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} + update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore def delete_backup_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the backup configuration of an app. Deletes the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the backup configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + backup configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_backup_configuration_slot.metadata['url'] + url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} + delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore def get_backup_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Gets the backup configuration of an app. Gets the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the backup configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + backup configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_backup_configuration_slot.metadata['url'] + url = self.get_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} + get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} # type: ignore def update_connection_strings_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_strings, # type: "models.ConnectionStringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Replaces the connection strings of an app. Replaces the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the connection settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + connection settings for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2018_02_01.models.ConnStringValueTypePair] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - connection_strings = models.ConnectionStringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_connection_strings_slot.metadata['url'] + url = self.update_connection_strings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} + update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} # type: ignore def list_connection_strings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Gets the connection strings of an app. Gets the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the connection settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + connection settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2018_02_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_connection_strings_slot.metadata['url'] + url = self.list_connection_strings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} + list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} # type: ignore def get_diagnostic_logs_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Gets the logging configuration of an app. Gets the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the logging configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + logging configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_diagnostic_logs_configuration_slot.metadata['url'] + url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} + get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore def update_diagnostic_logs_config_slot( - self, resource_group_name, name, site_logs_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_logs_config, # type: "models.SiteLogsConfig" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Updates the logging configuration of an app. Updates the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_logs_config: A SiteLogsConfig JSON object that contains - the logging configuration to change in the "properties" property. - :type site_logs_config: - ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the logging configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + logging configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_diagnostic_logs_config_slot.metadata['url'] + url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} + update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore def update_metadata_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + metadata, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the metadata of an app. Replaces the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the metadata for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + metadata for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_metadata_slot.metadata['url'] + url = self.update_metadata_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} + update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} # type: ignore def list_metadata_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the metadata of an app. Gets the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the metadata for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + metadata for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_metadata_slot.metadata['url'] + url = self.list_metadata_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} - + list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} # type: ignore def _list_publishing_credentials_slot_initial( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.User" + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_publishing_credentials_slot.metadata['url'] + url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _list_publishing_credentials_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore - def list_publishing_credentials_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_list_publishing_credentials_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.User"] """Gets the Git/FTP publishing credentials of an app. Gets the Git/FTP publishing credentials of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the publishing credentials for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing credentials for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns User or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.User] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.User]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._list_publishing_credentials_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('User', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._list_publishing_credentials_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore def update_site_push_settings_slot( - self, resource_group_name, name, push_settings, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + push_settings, # type: "models.PushSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Updates the Push settings associated with web app. Updates the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str :param push_settings: Push settings associated with web app. :type push_settings: ~azure.mgmt.web.v2018_02_01.models.PushSettings - :param slot: Name of web app slot. If not specified then will default - to production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_site_push_settings_slot.metadata['url'] + url = self.update_site_push_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} + update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} # type: ignore def list_site_push_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Gets the Push settings associated with web app. Gets the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_site_push_settings_slot.metadata['url'] + url = self.list_site_push_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} + list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} # type: ignore def get_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. - Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + Gets the configuration of an app, such as platform version and bitness, default documents, + virtual applications, Always On, etc. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_configuration_slot.metadata['url'] + url = self.get_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def create_or_update_configuration_slot( - self, resource_group_name, name, site_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_configuration_slot.metadata['url'] + url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def update_configuration_slot( - self, resource_group_name, name, site_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_configuration_slot.metadata['url'] + url = self.update_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def list_configuration_snapshot_info_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigurationSnapshotInfoCollection"] + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. - Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + Gets a list of web app configuration snapshots identifiers. Each element of the list contains a + timestamp and the ID of the snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigurationSnapshotInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfoPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configuration_snapshot_info_slot.metadata['url'] + url = self.list_configuration_snapshot_info_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigurationSnapshotInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigurationSnapshotInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} # type: ignore def get_configuration_snapshot_slot( - self, resource_group_name, name, snapshot_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a snapshot of the configuration of an app at a previous point in - time. + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets a snapshot of the configuration of an app at a previous point in time. - Gets a snapshot of the configuration of an app at a previous point in - time. + Gets a snapshot of the configuration of an app at a previous point in time. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_configuration_snapshot_slot.metadata['url'] + url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} + get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} # type: ignore def recover_site_configuration_snapshot_slot( - self, resource_group_name, name, snapshot_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reverts the configuration of an app to a previous snapshot. Reverts the configuration of an app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.recover_site_configuration_snapshot_slot.metadata['url'] + url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} + if cls: + return cls(pipeline_response, None, {}) + + recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} # type: ignore def get_web_site_container_logs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the last lines of docker logs for the given site. Gets the last lines of docker logs for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_web_site_container_logs_slot.metadata['url'] + url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/octet-stream' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} + get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} # type: ignore def get_container_logs_zip_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the ZIP archived docker log files for the given site. Gets the ZIP archived docker log files for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_container_logs_zip_slot.metadata['url'] + url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/zip' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} + get_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} # type: ignore def list_continuous_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ContinuousWebJobCollection"] """List continuous web jobs for an app, or a deployment slot. List continuous web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContinuousWebJob - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobPaged[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_continuous_web_jobs_slot.metadata['url'] + url = self.list_continuous_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContinuousWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContinuousWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} # type: ignore def get_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ContinuousWebJob"] """Gets a continuous web job by its ID for an app, or a deployment slot. Gets a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContinuousWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_continuous_web_job_slot.metadata['url'] + url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ContinuousWebJob', response) + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} + get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore def delete_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a continuous web job by its ID for an app, or a deployment slot. Delete a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_continuous_web_job_slot.metadata['url'] + url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore def start_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Start a continuous web job for an app, or a deployment slot. Start a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_continuous_web_job_slot.metadata['url'] + url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} + if cls: + return cls(pipeline_response, None, {}) + + start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} # type: ignore def stop_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop a continuous web job for an app, or a deployment slot. Stop a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_continuous_web_job_slot.metadata['url'] + url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} + if cls: + return cls(pipeline_response, None, {}) + + stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} # type: ignore def list_deployments_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentCollection"] """List deployments for an app, or a deployment slot. List deployments for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Deployment - :rtype: - ~azure.mgmt.web.v2018_02_01.models.DeploymentPaged[~azure.mgmt.web.v2018_02_01.models.Deployment] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_deployments_slot.metadata['url'] + url = self.list_deployments_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} # type: ignore def get_deployment_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Get a deployment by its ID for an app, or a deployment slot. Get a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets a deployment + for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_deployment_slot.metadata['url'] + url = self.get_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def create_deployment_slot( - self, resource_group_name, name, id, slot, deployment, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + deployment, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Create a deployment for an app, or a deployment slot. Create a deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: ID of an existing deployment. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API creates a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API creates a + deployment for the production slot. :type slot: str :param deployment: Deployment details. :type deployment: ~azure.mgmt.web.v2018_02_01.models.Deployment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_deployment_slot.metadata['url'] + url = self.create_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def delete_deployment_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a deployment by its ID for an app, or a deployment slot. Delete a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_deployment_slot.metadata['url'] + url = self.delete_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def list_deployment_log_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): - """List deployment log for specific deployment for an app, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" + """List deployment log for specific deployment for an app, or a deployment slot. - List deployment log for specific deployment for an app, or a deployment - slot. + List deployment log for specific deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param id: The ID of a specific deployment. This is the value of the - name property in the JSON response from "GET - /api/sites/{siteName}/deployments". + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_deployment_log_slot.metadata['url'] + url = self.list_deployment_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} + list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} # type: ignore def discover_backup_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): - """Discovers an existing app backup that can be restored from a blob in - Azure storage. Use this to get information about the databases stored - in a backup. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreRequest" + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. - Discovers an existing app backup that can be restored from a blob in - Azure storage. Use this to get information about the databases stored - in a backup. + Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to + get information about the databases stored in a backup. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: A RestoreRequest object that includes Azure storage - URL and blog name for discovery of backup. - :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will perform discovery for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will perform + discovery for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RestoreRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.discover_backup_slot.metadata['url'] + url = self.discover_backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RestoreRequest', response) + deserialized = self._deserialize('RestoreRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - discover_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup'} + discover_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup'} # type: ignore def list_domain_ownership_identifiers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """Lists ownership identifiers for domain associated with web app. Lists ownership identifiers for domain associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2018_02_01.models.IdentifierPaged[~azure.mgmt.web.v2018_02_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_domain_ownership_identifiers_slot.metadata['url'] + url = self.list_domain_ownership_identifiers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} # type: ignore def get_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" """Get domain ownership identifier for web app. Get domain ownership identifier for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_domain_ownership_identifier_slot.metadata['url'] + url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def create_or_update_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] + url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def delete_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a domain ownership identifier for a web app. Deletes a domain ownership identifier for a web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_domain_ownership_identifier_slot.metadata['url'] + url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def update_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, kind=None, identifier_id=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2018_02_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, identifier_id=identifier_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_domain_ownership_identifier_slot.metadata['url'] + url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def get_ms_deploy_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_ms_deploy_status_slot.metadata['url'] + url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} - + get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore def _create_ms_deploy_operation_slot_initial( - self, resource_group_name, name, slot, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_ms_deploy_operation_slot.metadata['url'] + url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore - def create_ms_deploy_operation_slot( - self, resource_group_name, name, slot, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_ms_deploy_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_ms_deploy_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore def get_ms_deploy_log_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_ms_deploy_log_slot.metadata['url'] + url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} + get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} # type: ignore def list_instance_functions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.FunctionEnvelopeCollection"] """List the functions for a web site, or a deployment slot. List the functions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of FunctionEnvelope - :rtype: - ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelopePaged[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_functions_slot.metadata['url'] + url = self.list_instance_functions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('FunctionEnvelopeCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.FunctionEnvelopePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} # type: ignore def get_functions_admin_token_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Fetch a short lived token that can be exchanged for a master key. Fetch a short lived token that can be exchanged for a master key. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_functions_admin_token_slot.metadata['url'] + url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} + get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} # type: ignore def get_instance_function_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.FunctionEnvelope"] """Get function information by its ID for web site, or a deployment slot. Get function information by its ID for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15604,119 +15436,125 @@ def get_instance_function_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionEnvelope or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_function_slot.metadata['url'] + url = self.get_instance_function_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} - + get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def _create_instance_function_slot_initial( - self, resource_group_name, name, function_name, slot, function_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionEnvelope" + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_function_slot.metadata['url'] + url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_instance_function_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore - def create_instance_function_slot( - self, resource_group_name, name, function_name, slot, function_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_instance_function_slot( + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.FunctionEnvelope"] """Create function for web site, or a deployment slot. Create function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15725,59 +15563,73 @@ def create_instance_function_slot( :param slot: Name of the deployment slot. :type slot: str :param function_envelope: Function details. - :type function_envelope: - ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type function_envelope: ~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns FunctionEnvelope or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_instance_function_slot_initial( - resource_group_name=resource_group_name, - name=name, - function_name=function_name, - slot=slot, - function_envelope=function_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('FunctionEnvelope', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_function_slot_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + slot=slot, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def delete_instance_function_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function for web site, or a deployment slot. Delete a function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15785,61 +15637,63 @@ def delete_instance_function_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_instance_function_slot.metadata['url'] + url = self.delete_instance_function_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def create_or_update_function_secret_slot( - self, resource_group_name, name, function_name, key_name, slot, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + slot, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a function secret. Add or update a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15849,81 +15703,80 @@ def create_or_update_function_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_function_secret_slot.metadata['url'] + url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} + create_or_update_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore def delete_function_secret_slot( - self, resource_group_name, name, function_name, key_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function secret. Delete a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15933,62 +15786,62 @@ def delete_function_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_function_secret_slot.metadata['url'] + url = self.delete_function_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} + delete_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore def list_function_keys_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Get function keys for a function in a web site, or a deployment slot. Get function keys for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15996,70 +15849,66 @@ def list_function_keys_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_function_keys_slot.metadata['url'] + url = self.list_function_keys_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys'} + list_function_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys'} # type: ignore def list_function_secrets_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): - """Get function secrets for a function in a web site, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" + """Get function secrets for a function in a web site, or a deployment slot. - Get function secrets for a function in a web site, or a deployment - slot. + Get function secrets for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16067,250 +15916,249 @@ def list_function_secrets_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_function_secrets_slot.metadata['url'] + url = self.list_function_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} + list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} # type: ignore def list_host_keys_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostKeys" """Get host secrets for a function app. Get host secrets for a function app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HostKeys or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_host_keys_slot.metadata['url'] + url = self.list_host_keys_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostKeys', response) + deserialized = self._deserialize('HostKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_host_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys'} + list_host_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys'} # type: ignore def list_sync_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """This is to allow calling via powershell and ARM template. This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_sync_status_slot.metadata['url'] + url = self.list_sync_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - list_sync_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus'} + list_sync_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus'} # type: ignore def sync_functions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.sync_functions_slot.metadata['url'] + url = self.sync_functions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync'} + sync_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync'} # type: ignore def create_or_update_host_secret_slot( - self, resource_group_name, name, key_type, key_name, slot, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + slot, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a host level secret. Add or update a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16320,81 +16168,80 @@ def create_or_update_host_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_host_secret_slot.metadata['url'] + url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} + create_or_update_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore def delete_host_secret_slot( - self, resource_group_name, name, key_type, key_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a host level secret. Delete a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16404,354 +16251,353 @@ def delete_host_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_host_secret_slot.metadata['url'] + url = self.delete_host_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore def list_host_name_bindings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HostNameBindingCollection"] """Get hostname bindings for an app or a deployment slot. Get hostname bindings for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets hostname bindings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HostNameBinding - :rtype: - ~azure.mgmt.web.v2018_02_01.models.HostNameBindingPaged[~azure.mgmt.web.v2018_02_01.models.HostNameBinding] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_host_name_bindings_slot.metadata['url'] + url = self.list_host_name_bindings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HostNameBindingCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HostNameBindingPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} + return ItemPaged( + get_next, extract_data + ) + list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} # type: ignore def get_host_name_binding_slot( - self, resource_group_name, name, slot, host_name, custom_headers=None, raw=False, **operation_config): - """Get the named hostname binding for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" + """Get the named hostname binding for an app (or deployment slot, if specified). - Get the named hostname binding for an app (or deployment slot, if - specified). + Get the named hostname binding for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API the named binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. :type slot: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_host_name_binding_slot.metadata['url'] + url = self.get_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def create_or_update_host_name_binding_slot( - self, resource_group_name, name, host_name, host_name_binding, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + slot, # type: str + host_name_binding, # type: "models.HostNameBinding" + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param host_name_binding: Binding details. This is the JSON - representation of a HostNameBinding object. - :type host_name_binding: - ~azure.mgmt.web.v2018_02_01.models.HostNameBinding - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_host_name_binding_slot.metadata['url'] + url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def delete_host_name_binding_slot( - self, resource_group_name, name, slot, host_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_host_name_binding_slot.metadata['url'] + url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def get_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): - """Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. - Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + Retrieves a specific Service Bus Hybrid Connection used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16761,69 +16607,69 @@ def get_hybrid_connection_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_hybrid_connection_slot.metadata['url'] + url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def create_or_update_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16831,78 +16677,78 @@ def create_or_update_hybrid_connection_slot( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.HybridConnection :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_hybrid_connection_slot.metadata['url'] + url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Removes a Hybrid Connection from this site. Removes a Hybrid Connection from this site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16912,62 +16758,64 @@ def delete_hybrid_connection_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_hybrid_connection_slot.metadata['url'] + url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def update_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16975,78 +16823,78 @@ def update_hybrid_connection_slot( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.HybridConnection :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_hybrid_connection_slot.metadata['url'] + url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Gets the send key name and value for a Hybrid Connection. Gets the send key name and value for a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -17056,1239 +16904,1221 @@ def list_hybrid_connection_keys_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_hybrid_connection_keys_slot.metadata['url'] + url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_hybrid_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieves all Service Bus Hybrid Connections used by this Web App. Retrieves all Service Bus Hybrid Connections used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_hybrid_connections_slot.metadata['url'] + url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} + list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} # type: ignore def list_relay_service_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets hybrid connections configured for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Gets hybrid connections configured for an app (or deployment slot, if specified). - Gets hybrid connections configured for an app (or deployment slot, if - specified). + Gets hybrid connections configured for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get hybrid connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get hybrid + connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_relay_service_connections_slot.metadata['url'] + url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} + list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} # type: ignore def get_relay_service_connection_slot( - self, resource_group_name, name, entity_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" """Gets a hybrid connection configuration by its name. Gets a hybrid connection configuration by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection. :type entity_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a hybrid connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a hybrid + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_relay_service_connection_slot.metadata['url'] + url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def create_or_update_relay_service_connection_slot( - self, resource_group_name, name, entity_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create or update a hybrid connection for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_relay_service_connection_slot.metadata['url'] + url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def delete_relay_service_connection_slot( - self, resource_group_name, name, entity_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a relay service connection by its name. Deletes a relay service connection by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete a hybrid connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_relay_service_connection_slot.metadata['url'] + url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def update_relay_service_connection_slot( - self, resource_group_name, name, entity_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create or update a hybrid connection for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_relay_service_connection_slot.metadata['url'] + url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def list_instance_identifiers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppInstanceCollection"] """Gets all scale-out instances of an app. Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets the production slot instances. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteInstance - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteInstancePaged[~azure.mgmt.web.v2018_02_01.models.SiteInstance] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_identifiers_slot.metadata['url'] + url = self.list_instance_identifiers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppInstanceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} + return ItemPaged( + get_next, extract_data + ) + list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} # type: ignore def get_instance_ms_deploy_status_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_ms_deploy_status_slot.metadata['url'] + url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} - + get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def _create_instance_ms_deploy_operation_slot_initial( - self, resource_group_name, name, slot, instance_id, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_ms_deploy_operation_slot.metadata['url'] + url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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 == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_instance_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore - def create_instance_ms_deploy_operation_slot( - self, resource_group_name, name, slot, instance_id, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_instance_ms_deploy_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2018_02_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus]] - :raises: :class:`CloudError` - """ - raw_result = self._create_instance_ms_deploy_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - instance_id=instance_id, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def get_instance_ms_deploy_log_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_ms_deploy_log_slot.metadata['url'] + url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} + get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore def list_instance_processes_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_processes_slot.metadata['url'] + url = self.list_instance_processes_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} # type: ignore def get_instance_process_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_slot.metadata['url'] + url = self.get_instance_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} + get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore def delete_instance_process_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_instance_process_slot.metadata['url'] + url = self.delete_instance_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} + delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore def get_instance_process_dump_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_dump_slot.metadata['url'] + url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} + get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore def list_instance_process_modules_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. - - List module information for a process by its ID for a specific - scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + List module information for a process by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_modules_slot.metadata['url'] + url = self.list_instance_process_modules_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore def get_instance_process_module_slot( - self, resource_group_name, name, process_id, base_address, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Get process information by its ID for a specific scaled-out instance in - a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Get process information by its ID for a specific scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -18296,25 +18126,24 @@ def get_instance_process_module_slot( :type process_id: str :param base_address: Module base address. :type base_address: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_module_slot.metadata['url'] + url = self.get_instance_process_module_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), @@ -18322,143 +18151,141 @@ def get_instance_process_module_slot( 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} + get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_instance_process_threads_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_threads_slot.metadata['url'] + url = self.list_instance_process_threads_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore def get_instance_process_thread_slot( - self, resource_group_name, name, process_id, thread_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -18466,25 +18293,24 @@ def get_instance_process_thread_slot( :type process_id: str :param thread_id: TID. :type thread_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_instance_process_thread_slot.metadata['url'] + url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), @@ -18492,865 +18318,835 @@ def get_instance_process_thread_slot( 'threadId': self._serialize.url("thread_id", thread_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} + get_instance_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads/{threadId}'} # type: ignore def is_cloneable_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Shows whether an app can be cloned to another resource group or - subscription. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteCloneability" + """Shows whether an app can be cloned to another resource group or subscription. - Shows whether an app can be cloned to another resource group or - subscription. + Shows whether an app can be cloned to another resource group or subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. By default, this API returns - information on the production slot. + :param slot: Name of the deployment slot. By default, this API returns information on the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteCloneability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteCloneability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.is_cloneable_slot.metadata['url'] + url = self.is_cloneable_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteCloneability', response) + deserialized = self._deserialize('SiteCloneability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} + is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} # type: ignore def list_sync_function_triggers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" """This is to allow calling via powershell and ARM template. This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_sync_function_triggers_slot.metadata['url'] + url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} + list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} # type: ignore def list_metric_definitions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets all metric definitions of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Gets all metric definitions of an app (or deployment slot, if specified). - Gets all metric definitions of an app (or deployment slot, if - specified). + Gets all metric definitions of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get metric definitions of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metric + definitions of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metric_definitions_slot.metadata['url'] + url = self.list_metric_definitions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metric_definitions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_metric_definitions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions'} # type: ignore def list_metrics_slot( - self, resource_group_name, name, slot, details=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + details=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricCollection"] """Gets performance metrics of an app (or deployment slot, if specified). Gets performance metrics of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get metrics of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get metrics + of the production slot. :type slot: str - :param details: Specify "true" to include metric details in the - response. It is "false" by default. + :param details: Specify "true" to include metric details in the response. It is "false" by + default. :type details: bool - :param filter: Return only metrics specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and - endTime eq 2014-12-31T23:59:59Z and timeGrain eq + :param filter: Return only metrics specified in the filter (using OData syntax). For example: + $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetric - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ResourceMetricPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetric] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ResourceMetricCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_metrics_slot.metadata['url'] + url = self.list_metrics_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if details is not None: query_parameters['details'] = self._serialize.query("details", details, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_metrics_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics'} + return ItemPaged( + get_next, extract_data + ) + list_metrics_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics'} # type: ignore def get_migrate_my_sql_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MigrateMySqlStatus" + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + Returns the status of MySql in app migration, if one is active, and whether or not MySql in app + is enabled. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MigrateMySqlStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_migrate_my_sql_status_slot.metadata['url'] + url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MigrateMySqlStatus', response) + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} + get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} # type: ignore def get_swift_virtual_network_connection_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" """Gets a Swift Virtual Network connection. Gets a Swift Virtual Network connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a gateway for the production slot's Virtual Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_swift_virtual_network_connection_slot.metadata['url'] + url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + get_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def create_or_update_swift_virtual_network_connection_slot( - self, resource_group_name, name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] + url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + create_or_update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def delete_swift_virtual_network_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Deletes a Swift Virtual Network connection from an app (or deployment - slot). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Swift Virtual Network connection from an app (or deployment slot). - Deletes a Swift Virtual Network connection from an app (or deployment - slot). + Deletes a Swift Virtual Network connection from an app (or deployment slot). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_swift_virtual_network_slot.metadata['url'] + url = self.delete_swift_virtual_network_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_swift_virtual_network_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + if cls: + return cls(pipeline_response, None, {}) + + delete_swift_virtual_network_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def update_swift_virtual_network_connection_slot( - self, resource_group_name, name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true + when doing a GET against this resource, and 2) that the target Subnet has already been + delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_swift_virtual_network_connection_slot.metadata['url'] + url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def list_network_features_slot( - self, resource_group_name, name, view, slot, custom_headers=None, raw=False, **operation_config): - """Gets all network features used by the app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + view, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.NetworkFeatures"] + """Gets all network features used by the app (or deployment slot, if specified). - Gets all network features used by the app (or deployment slot, if - specified). + Gets all network features used by the app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param view: The type of view. This can either be "summary" or - "detailed". + :param view: The type of view. This can either be "summary" or "detailed". :type view: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get network features for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get network + features for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NetworkFeatures or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.NetworkFeatures or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_network_features_slot.metadata['url'] + url = self.list_network_features_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'view': self._serialize.url("view", view, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('NetworkFeatures', response) + deserialized = self._deserialize('NetworkFeatures', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} + list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} # type: ignore def get_network_trace_operation_slot( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_trace_operation_slot.metadata['url'] + url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}'} + get_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}'} # type: ignore def start_web_site_network_trace_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str """Start capturing network packets for the site (To be deprecated). Start capturing network packets for the site (To be deprecated). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -19362,125 +19158,134 @@ def start_web_site_network_trace_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_web_site_network_trace_slot.metadata['url'] + url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} - + start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} # type: ignore def _start_web_site_network_trace_operation_slot_initial( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_web_site_network_trace_operation_slot.metadata['url'] + url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_web_site_network_trace_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore - def start_web_site_network_trace_operation_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_web_site_network_trace_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -19492,1426 +19297,1400 @@ def start_web_site_network_trace_operation_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_web_site_network_trace_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_web_site_network_trace_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_web_site_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore def stop_web_site_network_trace_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for this web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_web_site_network_trace_slot.metadata['url'] + url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} + stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} # type: ignore def get_network_traces_slot( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_traces_slot.metadata['url'] + url = self.get_network_traces_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}'} + get_network_traces_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}'} # type: ignore def get_network_trace_operation_slot_v2( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_trace_operation_slot_v2.metadata['url'] + url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}'} + get_network_trace_operation_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}'} # type: ignore def get_network_traces_slot_v2( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). - Gets a named operation for a network trace capturing (or deployment - slot, if specified). + Gets a named operation for a network trace capturing (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_network_traces_slot_v2.metadata['url'] + url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}'} + get_network_traces_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}'} # type: ignore def generate_new_site_publishing_password_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Generates a new publishing password for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Generates a new publishing password for an app (or deployment slot, if specified). - Generates a new publishing password for an app (or deployment slot, if - specified). + Generates a new publishing password for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API generate a new publishing password for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API generate a new + publishing password for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.generate_new_site_publishing_password_slot.metadata['url'] + url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} + generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} # type: ignore def list_perf_mon_counters_slot( - self, resource_group_name, name, slot, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PerfMonCounterCollection"] """Gets perfmon counters for web app. Gets perfmon counters for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PerfMonResponse - :rtype: - ~azure.mgmt.web.v2018_02_01.models.PerfMonResponsePaged[~azure.mgmt.web.v2018_02_01.models.PerfMonResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_perf_mon_counters_slot.metadata['url'] + url = self.list_perf_mon_counters_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PerfMonResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} + return ItemPaged( + get_next, extract_data + ) + list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} # type: ignore def get_site_php_error_log_flag_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SitePhpErrorLogFlag" """Gets web app's event logs. Gets web app's event logs. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SitePhpErrorLogFlag or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SitePhpErrorLogFlag or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_php_error_log_flag_slot.metadata['url'] + url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SitePhpErrorLogFlag', response) + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} + get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} # type: ignore def list_premier_add_ons_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets the premier add-ons of an app. Gets the premier add-ons of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the premier add-ons for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + premier add-ons for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_premier_add_ons_slot.metadata['url'] + url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} + list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} # type: ignore def get_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets a named add-on of an app. Gets a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_premier_add_on_slot.metadata['url'] + url = self.get_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def add_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, premier_add_on, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + premier_add_on, # type: "models.PremierAddOn" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.add_premier_add_on_slot.metadata['url'] + url = self.add_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def delete_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a premier add-on from an app. Delete a premier add-on from an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_premier_add_on_slot.metadata['url'] + url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def update_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, premier_add_on, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + premier_add_on, # type: "models.PremierAddOnPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: - ~azure.mgmt.web.v2018_02_01.models.PremierAddOnPatchResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2018_02_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_premier_add_on_slot.metadata['url'] + url = self.update_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + update_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def get_private_access_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. - Gets data around private site access enablement and authorized Virtual - Networks that can access the site. + Gets data around private site access enablement and authorized Virtual Networks that can access + the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_private_access_slot.metadata['url'] + url = self.get_private_access_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_private_access_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} + get_private_access_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore def put_private_access_vnet_slot( - self, resource_group_name, name, access, slot, custom_headers=None, raw=False, **operation_config): - """Sets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + access, # type: "models.PrivateAccess" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. - Sets data around private site access enablement and authorized Virtual - Networks that can access the site. + Sets data around private site access enablement and authorized Virtual Networks that can access + the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param access: The information for the private access - :type access: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param access: The information for the private access. + :type access: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.put_private_access_vnet_slot.metadata['url'] + url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - put_private_access_vnet_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} + put_private_access_vnet_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore def list_processes_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Get list of processes for a web site, or a deployment slot, or for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_processes_slot.metadata['url'] + url = self.list_processes_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} # type: ignore def get_process_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_slot.metadata['url'] + url = self.get_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} + get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore def delete_process_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_process_slot.metadata['url'] + url = self.delete_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} + delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore def get_process_dump_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_dump_slot.metadata['url'] + url = self.get_process_dump_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} + get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} # type: ignore def list_process_modules_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. - List module information for a process by its ID for a specific - scaled-out instance in a web site. + List module information for a process by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_modules_slot.metadata['url'] + url = self.list_process_modules_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} # type: ignore def get_process_module_slot( - self, resource_group_name, name, process_id, base_address, slot, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. - Get process information by its ID for a specific scaled-out instance in - a web site. + Get process information by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -20919,159 +20698,156 @@ def get_process_module_slot( :type process_id: str :param base_address: Module base address. :type base_address: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_module_slot.metadata['url'] + url = self.get_process_module_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} + get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_process_threads_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - List the threads in a process by its ID for a specific scaled-out - instance in a web site. + List the threads in a process by its ID for a specific scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_threads_slot.metadata['url'] + url = self.list_process_threads_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} # type: ignore def get_process_thread_slot( - self, resource_group_name, name, process_id, thread_id, slot, custom_headers=None, raw=False, **operation_config): - """Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - Get thread information by Thread ID for a specific process, in a - specific scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + thread_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessThreadInfo"] + """Get thread information by Thread ID for a specific process, in a specific scaled-out instance in a web site. + + Get thread information by Thread ID for a specific process, in a specific scaled-out instance + in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -21079,1975 +20855,2100 @@ def get_process_thread_slot( :type process_id: str :param thread_id: TID. :type thread_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessThreadInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessThreadInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ProcessThreadInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_process_thread_slot.metadata['url'] + url = self.get_process_thread_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'threadId': self._serialize.url("thread_id", thread_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('ProcessThreadInfo', response) + deserialized = self._deserialize('ProcessThreadInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads/{threadId}'} + get_process_thread_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads/{threadId}'} # type: ignore def list_public_certificates_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PublicCertificateCollection"] """Get public certificates for an app or a deployment slot. Get public certificates for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets hostname bindings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PublicCertificate - :rtype: - ~azure.mgmt.web.v2018_02_01.models.PublicCertificatePaged[~azure.mgmt.web.v2018_02_01.models.PublicCertificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_public_certificates_slot.metadata['url'] + url = self.list_public_certificates_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PublicCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PublicCertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} + return ItemPaged( + get_next, extract_data + ) + list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} # type: ignore def get_public_certificate_slot( - self, resource_group_name, name, slot, public_certificate_name, custom_headers=None, raw=False, **operation_config): - """Get the named public certificate for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" + """Get the named public certificate for an app (or deployment slot, if specified). - Get the named public certificate for an app (or deployment slot, if - specified). + Get the named public certificate for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API the named binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. :type slot: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_public_certificate_slot.metadata['url'] + url = self.get_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def create_or_update_public_certificate_slot( - self, resource_group_name, name, public_certificate_name, public_certificate, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + slot, # type: str + public_certificate, # type: "models.PublicCertificate" + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" """Creates a hostname binding for an app. Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param public_certificate: Public certificate details. This is the - JSON representation of a PublicCertificate object. - :type public_certificate: - ~azure.mgmt.web.v2018_02_01.models.PublicCertificate - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_public_certificate_slot.metadata['url'] + url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def delete_public_certificate_slot( - self, resource_group_name, name, slot, public_certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_public_certificate_slot.metadata['url'] + url = self.delete_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def list_publishing_profile_xml_with_secrets_slot( - self, resource_group_name, name, slot, format=None, include_disaster_recovery_endpoints=None, custom_headers=None, raw=False, callback=None, **operation_config): - """Gets the publishing profile for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + publishing_profile_options, # type: "models.CsmPublishingProfileOptions" + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets the publishing profile for an app (or deployment slot, if specified). - Gets the publishing profile for an app (or deployment slot, if - specified). + Gets the publishing profile for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the publishing profile for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing profile for the production slot. :type slot: str - :param format: Name of the format. Valid values are: - FileZilla3 - WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2018_02_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the - DisasterRecover endpoint if true - :type include_disaster_recovery_endpoints: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - """ - publishing_profile_options = models.CsmPublishingProfileOptions(format=format, include_disaster_recovery_endpoints=include_disaster_recovery_endpoints) - - # Construct URL - url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2018_02_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/xml' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} + list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} # type: ignore def reset_slot_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. - Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + Resets the configuration settings of the current slot if they were previously modified by + calling the API with POST. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API resets configuration settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API resets + configuration settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.reset_slot_configuration_slot.metadata['url'] + url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} + reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} # type: ignore def restart_slot( - self, resource_group_name, name, slot, soft_restart=None, synchronous=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + soft_restart=None, # type: Optional[bool] + synchronous=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restarts an app (or deployment slot, if specified). Restarts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restart the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will restart the + production slot. :type slot: str - :param soft_restart: Specify true to apply the configuration settings - and restarts the app only if necessary. By default, the API always - restarts and reprovisions the app. + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. :type soft_restart: bool - :param synchronous: Specify true to block until the app is restarted. - By default, it is set to false, and the API responds immediately - (asynchronous). + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). :type synchronous: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.restart_slot.metadata['url'] + url = self.restart_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') if synchronous is not None: query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} + if cls: + return cls(pipeline_response, None, {}) + restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} # type: ignore def _restore_from_backup_blob_slot_initial( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_backup_blob_slot.metadata['url'] + url = self._restore_from_backup_blob_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_backup_blob_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _restore_from_backup_blob_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore + + def begin_restore_from_backup_blob_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores an app from a backup blob in Azure Storage. Restores an app from a backup blob in Azure Storage. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2018_02_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_from_backup_blob_slot_initial( - resource_group_name=resource_group_name, - name=name, - request=request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_backup_blob_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_backup_blob_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore def _restore_from_deleted_app_slot_initial( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_deleted_app_slot.metadata['url'] + url = self._restore_from_deleted_app_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_deleted_app_slot( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _restore_from_deleted_app_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore + + def begin_restore_from_deleted_app_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a deleted web app to this web app. Restores a deleted web app to this web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param restore_request: Deleted web app restore information. - :type restore_request: - ~azure.mgmt.web.v2018_02_01.models.DeletedAppRestoreRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param restore_request: Deleted web app restore information. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_from_deleted_app_slot_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_deleted_app_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_deleted_app_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore def _restore_snapshot_slot_initial( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_snapshot_slot.metadata['url'] + url = self._restore_snapshot_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_snapshot_slot( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _restore_snapshot_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore + + def begin_restore_snapshot_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a web app from a snapshot. Restores a web app from a snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param restore_request: Snapshot restore settings. Snapshot - information can be obtained by calling GetDeletedSites or - GetSiteSnapshots API. - :type restore_request: - ~azure.mgmt.web.v2018_02_01.models.SnapshotRestoreRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2018_02_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._restore_snapshot_slot_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_snapshot_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore def list_site_extensions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteExtensionInfoCollection"] """Get list of siteextensions for a web site, or a deployment slot. Get list of siteextensions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteExtensionInfo - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfoPaged[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_extensions_slot.metadata['url'] + url = self.list_site_extensions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteExtensionInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} + return ItemPaged( + get_next, extract_data + ) + list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} # type: ignore def get_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): - """Get site extension information by its ID for a web site, or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + """Get site extension information by its ID for a web site, or a deployment slot. - Get site extension information by its ID for a web site, or a - deployment slot. + Get site extension information by its ID for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteExtensionInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_site_extension_slot.metadata['url'] + url = self.get_site_extension_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} - + get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def _install_site_extension_slot_initial( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.install_site_extension_slot.metadata['url'] + url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _install_site_extension_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore - def install_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_install_site_extension_slot( + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteExtensionInfo"] """Install site extension on a web site, or a deployment slot. Install site extension on a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteExtensionInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo]] - :raises: :class:`CloudError` - """ - raw_result = self._install_site_extension_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_extension_id=site_extension_id, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteExtensionInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_site_extension_slot_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def delete_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Remove a site extension from a web site, or a deployment slot. Remove a site extension from a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_site_extension_slot.metadata['url'] + url = self.delete_site_extension_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} + delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def list_slot_differences_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SlotDifferenceCollection"] """Get the difference in configuration settings between two web app slots. Get the difference in configuration settings between two web app slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SlotDifference - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SlotDifferencePaged[~azure.mgmt.web.v2018_02_01.models.SlotDifference] - :raises: - :class:`DefaultErrorResponseException` - """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slot_differences_slot.metadata['url'] + url = self.list_slot_differences_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SlotDifferencePaged(internal_paging, self._deserialize.dependencies, header_dict) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized - list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} # type: ignore - def _swap_slot_slot_initial( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + def _swap_slot_initial( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.swap_slot_slot.metadata['url'] + url = self._swap_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def swap_slot_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _swap_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + def begin_swap_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Swaps two deployment slots of an app. Swaps two deployment slots of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._swap_slot_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - target_slot=target_slot, - preserve_vnet=preserve_vnet, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._swap_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - swap_slot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore def list_snapshots_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user. Returns all Snapshots to the user. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str :param slot: Website Slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SnapshotPaged[~azure.mgmt.web.v2018_02_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_slot.metadata['url'] + url = self.list_snapshots_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} # type: ignore def list_snapshots_from_dr_secondary_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user from DRSecondary endpoint. Returns all Snapshots to the user from DRSecondary endpoint. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str :param slot: Website Slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SnapshotPaged[~azure.mgmt.web.v2018_02_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_from_dr_secondary_slot.metadata['url'] + url = self.list_snapshots_from_dr_secondary_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_snapshots_from_dr_secondary_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr'} # type: ignore def get_source_control_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Gets the source control configuration of an app. Gets the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the source control configuration for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_source_control_slot.metadata['url'] + url = self.get_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} - + get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def _create_or_update_source_control_slot_initial( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_source_control_slot.metadata['url'] + url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_source_control_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore - def create_or_update_source_control_slot( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_or_update_source_control_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteSourceControl"] """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteSourceControl or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_source_control_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_source_control=site_source_control, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteSourceControl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_source_control_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def delete_source_control_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the source control configuration of an app. Deletes the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_source_control_slot.metadata['url'] + url = self.delete_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def update_source_control_slot( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control_slot.metadata['url'] + url = self.update_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def start_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Starts an app (or deployment slot, if specified). Starts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will start the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will start the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_slot.metadata['url'] + url = self.start_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} + if cls: + return cls(pipeline_response, None, {}) + start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} # type: ignore def _start_network_trace_slot_initial( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_network_trace_slot.metadata['url'] + url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_network_trace_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore - def start_network_trace_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_network_trace_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -23059,592 +22960,602 @@ def start_network_trace_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_network_trace_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_network_trace_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore def stop_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stops an app (or deployment slot, if specified). Stops an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will stop the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will stop the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_slot.metadata['url'] + url = self.stop_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} + if cls: + return cls(pipeline_response, None, {}) + + stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} # type: ignore def stop_network_trace_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for this web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_network_trace_slot.metadata['url'] + url = self.stop_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace'} + stop_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace'} # type: ignore def sync_repository_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync web app repository. Sync web app repository. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.sync_repository_slot.metadata['url'] + url = self.sync_repository_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} + sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} # type: ignore def sync_function_triggers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.sync_function_triggers_slot.metadata['url'] + url = self.sync_function_triggers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} + sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} # type: ignore def list_triggered_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredWebJobCollection"] """List triggered web jobs for an app, or a deployment slot. List triggered web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredWebJob - :rtype: - ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_jobs_slot.metadata['url'] + url = self.list_triggered_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} # type: ignore def get_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredWebJob"] """Gets a triggered web job by its ID for an app, or a deployment slot. Gets a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_triggered_web_job_slot.metadata['url'] + url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredWebJob', response) + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} + get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore def delete_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a triggered web job by its ID for an app, or a deployment slot. Delete a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_triggered_web_job_slot.metadata['url'] + url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} + delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore def list_triggered_web_job_history_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredJobHistoryCollection"] """List a triggered web job's history for an app, or a deployment slot. List a triggered web job's history for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredJobHistory - :rtype: - ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistoryPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_job_history_slot.metadata['url'] + url = self.list_triggered_web_job_history_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredJobHistoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredJobHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} # type: ignore def get_triggered_web_job_history_slot( - self, resource_group_name, name, web_job_name, id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredJobHistory"] + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. - Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + Gets a triggered web job's history by its ID for an app, , or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -23652,1721 +23563,1744 @@ def get_triggered_web_job_history_slot( :type web_job_name: str :param id: History ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredJobHistory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_triggered_web_job_history_slot.metadata['url'] + url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredJobHistory', response) + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} + get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore def run_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Run a triggered web job for an app, or a deployment slot. Run a triggered web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.run_triggered_web_job_slot.metadata['url'] + url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} + if cls: + return cls(pipeline_response, None, {}) + + run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} # type: ignore def list_usages_slot( - self, resource_group_name, name, slot, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the quota usage information of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] + """Gets the quota usage information of an app (or deployment slot, if specified). - Gets the quota usage information of an app (or deployment slot, if - specified). + Gets the quota usage information of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get quota information of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get quota + information of the production slot. :type slot: str - :param filter: Return only information specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and - endTime eq 2014-12-31T23:59:59Z and timeGrain eq + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages_slot.metadata['url'] + url = self.list_usages_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} # type: ignore def list_vnet_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Gets the virtual networks the app (or deployment slot) is connected to. Gets the virtual networks the app (or deployment slot) is connected to. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get virtual network connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get virtual + network connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_vnet_connections_slot.metadata['url'] + url = self.list_vnet_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} + list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} # type: ignore def get_vnet_connection_slot( - self, resource_group_name, name, vnet_name, slot, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network the app (or deployment slot) is connected to by - name. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Gets a virtual network the app (or deployment slot) is connected to by name. - Gets a virtual network the app (or deployment slot) is connected to by - name. + Gets a virtual network the app (or deployment slot) is connected to by name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the named virtual network for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named virtual network for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_vnet_connection_slot.metadata['url'] + url = self.get_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def create_or_update_vnet_connection_slot( - self, resource_group_name, name, vnet_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). - - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_slot.metadata['url'] + url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def delete_vnet_connection_slot( - self, resource_group_name, name, vnet_name, slot, custom_headers=None, raw=False, **operation_config): - """Deletes a connection from an app (or deployment slot to a named virtual - network. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a connection from an app (or deployment slot to a named virtual network. - Deletes a connection from an app (or deployment slot to a named virtual - network. + Deletes a connection from an app (or deployment slot to a named virtual network. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_vnet_connection_slot.metadata['url'] + url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + if cls: + return cls(pipeline_response, None, {}) - def update_vnet_connection_slot( - self, resource_group_name, name, vnet_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + def update_vnet_connection_slot( + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_slot.metadata['url'] + url = self.update_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetGateway"] """Gets an app's Virtual Network gateway. Gets an app's Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a gateway for the production slot's Virtual Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_vnet_connection_gateway_slot.metadata['url'] + url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def create_or_update_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.VnetGateway - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update a gateway for the production slot's Virtual - Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] + url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.VnetGateway - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update a gateway for the production slot's Virtual - Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_gateway_slot.metadata['url'] + url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebJobCollection"] """List webjobs for an app, or a deployment slot. List webjobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WebJob - :rtype: - ~azure.mgmt.web.v2018_02_01.models.WebJobPaged[~azure.mgmt.web.v2018_02_01.models.WebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_jobs_slot.metadata['url'] + url = self.list_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} + return ItemPaged( + get_next, extract_data + ) + list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} # type: ignore def get_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebJob" """Get webjob information for an app, or a deployment slot. Get webjob information for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of the web job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.WebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_web_job_slot.metadata['url'] + url = self.get_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WebJob', response) + deserialized = self._deserialize('WebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} + get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} # type: ignore def list_slot_differences_from_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SlotDifferenceCollection"] """Get the difference in configuration settings between two web app slots. Get the difference in configuration settings between two web app slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SlotDifference - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SlotDifferencePaged[~azure.mgmt.web.v2018_02_01.models.SlotDifference] - :raises: - :class:`DefaultErrorResponseException` - """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slot_differences_from_production.metadata['url'] + url = self.list_slot_differences_from_production.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SlotDifferencePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} # type: ignore def _swap_slot_with_production_initial( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.swap_slot_with_production.metadata['url'] + url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def swap_slot_with_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): + 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, {}) + + _swap_slot_with_production_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + def begin_swap_slot_with_production( + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Swaps two deployment slots of an app. Swaps two deployment slots of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2018_02_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._swap_slot_with_production_initial( - resource_group_name=resource_group_name, - name=name, - target_slot=target_slot, - preserve_vnet=preserve_vnet, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._swap_slot_with_production_initial( + resource_group_name=resource_group_name, + name=name, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore def list_snapshots( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user. Returns all Snapshots to the user. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SnapshotPaged[~azure.mgmt.web.v2018_02_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots.metadata['url'] + url = self.list_snapshots.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} # type: ignore def list_snapshots_from_dr_secondary( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user from DRSecondary endpoint. Returns all Snapshots to the user from DRSecondary endpoint. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SnapshotPaged[~azure.mgmt.web.v2018_02_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_from_dr_secondary.metadata['url'] + url = self.list_snapshots_from_dr_secondary.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_snapshots_from_dr_secondary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr'} # type: ignore def get_source_control( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Gets the source control configuration of an app. Gets the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_source_control.metadata['url'] + url = self.get_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} - + get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def _create_or_update_source_control_initial( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_source_control.metadata['url'] + url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_source_control_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore - def create_or_update_source_control( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_or_update_source_control( + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteSourceControl"] """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteSourceControl or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_source_control_initial( - resource_group_name=resource_group_name, - name=name, - site_source_control=site_source_control, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2018_02_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteSourceControl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_source_control_initial( + resource_group_name=resource_group_name, + name=name, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def delete_source_control( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the source control configuration of an app. Deletes the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_source_control.metadata['url'] + url = self.delete_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def update_source_control( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Updates the source control configuration of an app. Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control.metadata['url'] + url = self.update_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def start( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Starts an app (or deployment slot, if specified). Starts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start.metadata['url'] + url = self.start.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} + if cls: + return cls(pipeline_response, None, {}) + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} # type: ignore def _start_network_trace_initial( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.start_network_trace.metadata['url'] + url = self._start_network_trace_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_network_trace_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore - def start_network_trace( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_network_trace( + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -25376,561 +25310,563 @@ def start_network_trace( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_network_trace_initial( - resource_group_name=resource_group_name, - name=name, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2018_02_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_network_trace_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore def stop( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stops an app (or deployment slot, if specified). Stops an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop.metadata['url'] + url = self.stop.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} # type: ignore def stop_network_trace( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.stop_network_trace.metadata['url'] + url = self.stop_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace'} + stop_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace'} # type: ignore def sync_repository( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync web app repository. Sync web app repository. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.sync_repository.metadata['url'] + url = self.sync_repository.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} + if cls: + return cls(pipeline_response, None, {}) + + sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} # type: ignore def sync_function_triggers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.sync_function_triggers.metadata['url'] + url = self.sync_function_triggers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} + sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} # type: ignore def list_triggered_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredWebJobCollection"] """List triggered web jobs for an app, or a deployment slot. List triggered web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredWebJob - :rtype: - ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_jobs.metadata['url'] + url = self.list_triggered_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} # type: ignore def get_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredWebJob"] """Gets a triggered web job by its ID for an app, or a deployment slot. Gets a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_triggered_web_job.metadata['url'] + url = self.get_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredWebJob', response) + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} + get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore def delete_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a triggered web job by its ID for an app, or a deployment slot. Delete a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_triggered_web_job.metadata['url'] + url = self.delete_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} + delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore def list_triggered_web_job_history( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredJobHistoryCollection"] """List a triggered web job's history for an app, or a deployment slot. List a triggered web job's history for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredJobHistory - :rtype: - ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistoryPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_job_history.metadata['url'] + url = self.list_triggered_web_job_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredJobHistoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredJobHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} # type: ignore def get_triggered_web_job_history( - self, resource_group_name, name, web_job_name, id, custom_headers=None, raw=False, **operation_config): - """Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredJobHistory"] + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. - Gets a triggered web job's history by its ID for an app, , or a - deployment slot. + Gets a triggered web job's history by its ID for an app, , or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -25938,913 +25874,874 @@ def get_triggered_web_job_history( :type web_job_name: str :param id: History ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredJobHistory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_triggered_web_job_history.metadata['url'] + url = self.get_triggered_web_job_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('TriggeredJobHistory', response) + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} + get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore def run_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Run a triggered web job for an app, or a deployment slot. Run a triggered web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.run_triggered_web_job.metadata['url'] + url = self.run_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} + run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the quota usage information of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] + """Gets the quota usage information of an app (or deployment slot, if specified). - Gets the quota usage information of an app (or deployment slot, if - specified). + Gets the quota usage information of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param filter: Return only information specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and - endTime eq 2014-12-31T23:59:59Z and timeGrain eq + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} # type: ignore def list_vnet_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Gets the virtual networks the app (or deployment slot) is connected to. Gets the virtual networks the app (or deployment slot) is connected to. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2018_02_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_vnet_connections.metadata['url'] + url = self.list_vnet_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} + list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} # type: ignore def get_vnet_connection( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network the app (or deployment slot) is connected to by - name. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Gets a virtual network the app (or deployment slot) is connected to by name. - Gets a virtual network the app (or deployment slot) is connected to by - name. + Gets a virtual network the app (or deployment slot) is connected to by name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_vnet_connection.metadata['url'] + url = self.get_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def create_or_update_vnet_connection( - self, resource_group_name, name, vnet_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). - - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. + :param connection_envelope: Properties of the Virtual Network connection. See example. :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection.metadata['url'] + url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def delete_vnet_connection( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes a connection from an app (or deployment slot to a named virtual - network. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a connection from an app (or deployment slot to a named virtual network. - Deletes a connection from an app (or deployment slot to a named virtual - network. + Deletes a connection from an app (or deployment slot to a named virtual network. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.delete_vnet_connection.metadata['url'] + url = self.delete_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + if cls: + return cls(pipeline_response, None, {}) - def update_vnet_connection( - self, resource_group_name, name, vnet_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore - Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + def update_vnet_connection( + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. + :param connection_envelope: Properties of the Virtual Network connection. See example. :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection.metadata['url'] + url = self.update_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetGateway"] """Gets an app's Virtual Network gateway. Gets an app's Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_vnet_connection_gateway.metadata['url'] + url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def create_or_update_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_gateway.metadata['url'] + url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2018_02_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_gateway.metadata['url'] + url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebJobCollection"] """List webjobs for an app, or a deployment slot. List webjobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WebJob - :rtype: - ~azure.mgmt.web.v2018_02_01.models.WebJobPaged[~azure.mgmt.web.v2018_02_01.models.WebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_jobs.metadata['url'] + url = self.list_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} + return ItemPaged( + get_next, extract_data + ) + list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} # type: ignore def get_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebJob" """Get webjob information for an app, or a deployment slot. Get webjob information for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of the web job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.WebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_web_job.metadata['url'] + url = self.get_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WebJob', response) + deserialized = self._deserialize('WebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} + get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py index 1b6dd1aa23a7..b7558171864d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py @@ -1,564 +1,557 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling from .. import models -import uuid +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 WebSiteManagementClientOperationsMixin(object): def get_publishing_user( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.User" """Gets publishing user. Gets publishing user. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_publishing_user.metadata['url'] + url = self.get_publishing_user.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} + get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore def update_publishing_user( - self, user_details, custom_headers=None, raw=False, **operation_config): + self, + user_details, # type: "models.User" + **kwargs # type: Any + ): + # type: (...) -> "models.User" """Updates publishing user. Updates publishing user. - :param user_details: Details of publishing user + :param user_details: Details of publishing user. :type user_details: ~azure.mgmt.web.v2018_02_01.models.User - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_publishing_user.metadata['url'] + url = self.update_publishing_user.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} + update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore def list_source_controls( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SourceControlCollection"] """Gets the source controls available for Azure websites. Gets the source controls available for Azure websites. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SourceControl - :rtype: - ~azure.mgmt.web.v2018_02_01.models.SourceControlPaged[~azure.mgmt.web.v2018_02_01.models.SourceControl] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_source_controls.metadata['url'] - + url = self.list_source_controls.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SourceControlCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SourceControlPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} + return ItemPaged( + get_next, extract_data + ) + list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} # type: ignore def get_source_control( - self, source_control_type, custom_headers=None, raw=False, **operation_config): + self, + source_control_type, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SourceControl" """Gets source control token. Gets source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_source_control.metadata['url'] + url = self.get_source_control.metadata['url'] # type: ignore path_format_arguments = { - 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str') + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SourceControl', response) + deserialized = self._deserialize('SourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} + get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore def update_source_control( - self, source_control_type, request_message, custom_headers=None, raw=False, **operation_config): + self, + source_control_type, # type: str + request_message, # type: "models.SourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SourceControl" """Updates source control token. Updates source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param request_message: Source control token information - :type request_message: - ~azure.mgmt.web.v2018_02_01.models.SourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2018_02_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control.metadata['url'] + url = self.update_source_control.metadata['url'] # type: ignore path_format_arguments = { - 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str') + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SourceControl', response) + deserialized = self._deserialize('SourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} + update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore def list_billing_meters( - self, billing_location=None, os_type=None, custom_headers=None, raw=False, **operation_config): + self, + billing_location=None, # type: Optional[str] + os_type=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BillingMeterCollection"] """Gets a list of meters for a given location. Gets a list of meters for a given location. - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param os_type: App Service OS type meters used for + :param os_type: App Service OS type meters used for. :type os_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BillingMeter - :rtype: - ~azure.mgmt.web.v2018_02_01.models.BillingMeterPaged[~azure.mgmt.web.v2018_02_01.models.BillingMeter] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_billing_meters.metadata['url'] + url = self.list_billing_meters.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if billing_location is not None: query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') if os_type is not None: query_parameters['osType'] = self._serialize.query("os_type", os_type, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BillingMeterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BillingMeterPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_billing_meters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} + return ItemPaged( + get_next, extract_data + ) + list_billing_meters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} # type: ignore def check_name_availability( - self, name, type, is_fqdn=None, custom_headers=None, raw=False, **operation_config): + self, + name, # type: str + type, # type: Union[str, "models.CheckNameResourceTypes"] + is_fqdn=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceNameAvailability" """Check if a resource name is available. Check if a resource name is available. :param name: Resource name to verify. :type name: str - :param type: Resource type used for verification. Possible values - include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2018_02_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceNameAvailability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceNameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(request, 'ResourceNameAvailabilityRequest') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceNameAvailability', response) + deserialized = self._deserialize('ResourceNameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} # type: ignore def get_subscription_deployment_locations( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentLocations" """Gets list of available geo regions plus ministamps. Gets list of available geo regions plus ministamps. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentLocations or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.DeploymentLocations or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.get_subscription_deployment_locations.metadata['url'] + url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeploymentLocations', response) + deserialized = self._deserialize('DeploymentLocations', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} + get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} # type: ignore def list_geo_regions( - self, sku=None, linux_workers_enabled=None, xenon_workers_enabled=None, linux_dynamic_workers_enabled=None, custom_headers=None, raw=False, **operation_config): + self, + sku=None, # type: Optional[Union[str, "models.SkuName"]] + linux_workers_enabled=None, # type: Optional[bool] + xenon_workers_enabled=None, # type: Optional[bool] + linux_dynamic_workers_enabled=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.GeoRegionCollection"] """Get a list of available geographical regions. Get a list of available geographical regions. - :param sku: Name of SKU used to filter the regions. Possible values - include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', 'Dynamic', - 'Isolated', 'PremiumV2', 'ElasticPremium', 'ElasticIsolated' + :param sku: Name of SKU used to filter the regions. :type sku: str or ~azure.mgmt.web.v2018_02_01.models.SkuName - :param linux_workers_enabled: Specify true if you want to - filter to only regions that support Linux workers. + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. :type linux_workers_enabled: bool - :param xenon_workers_enabled: Specify true if you want to - filter to only regions that support Xenon workers. + :param xenon_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Xenon workers. :type xenon_workers_enabled: bool - :param linux_dynamic_workers_enabled: Specify true if you - want to filter to only regions that support Linux Consumption Workers. + :param linux_dynamic_workers_enabled: Specify :code:`true` if you want to filter + to only regions that support Linux Consumption Workers. :type linux_dynamic_workers_enabled: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of GeoRegion - :rtype: - ~azure.mgmt.web.v2018_02_01.models.GeoRegionPaged[~azure.mgmt.web.v2018_02_01.models.GeoRegion] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_geo_regions.metadata['url'] + url = self.list_geo_regions.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if sku is not None: query_parameters['sku'] = self._serialize.query("sku", sku, 'str') if linux_workers_enabled is not None: @@ -567,563 +560,541 @@ def prepare_request(next_link=None): query_parameters['xenonWorkersEnabled'] = self._serialize.query("xenon_workers_enabled", xenon_workers_enabled, 'bool') if linux_dynamic_workers_enabled is not None: query_parameters['linuxDynamicWorkersEnabled'] = self._serialize.query("linux_dynamic_workers_enabled", linux_dynamic_workers_enabled, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('GeoRegionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.GeoRegionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} + return ItemPaged( + get_next, extract_data + ) + list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} # type: ignore def list_site_identifiers_assigned_to_host_name( - self, name=None, custom_headers=None, raw=False, **operation_config): + self, + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """List all apps that are assigned to a hostname. List all apps that are assigned to a hostname. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2018_02_01.models.IdentifierPaged[~azure.mgmt.web.v2018_02_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2018_02_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - name_identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_identifiers_assigned_to_host_name.metadata['url'] + url = self.list_site_identifiers_assigned_to_host_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(name_identifier, 'NameIdentifier') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} + return ItemPaged( + get_next, extract_data + ) + list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} # type: ignore def list_premier_add_on_offers( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PremierAddOnOfferCollection"] """List all premier add-on offers. List all premier add-on offers. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PremierAddOnOffer - :rtype: - ~azure.mgmt.web.v2018_02_01.models.PremierAddOnOfferPaged[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOffer] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_02_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_premier_add_on_offers.metadata['url'] + url = self.list_premier_add_on_offers.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PremierAddOnOfferCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PremierAddOnOfferPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} + return ItemPaged( + get_next, extract_data + ) + list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} # type: ignore def list_skus( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.SkuInfos" """List all SKUs. List all SKUs. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SkuInfos or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.SkuInfos or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + # Construct URL - url = self.list_skus.metadata['url'] + url = self.list_skus.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SkuInfos', response) + deserialized = self._deserialize('SkuInfos', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} # type: ignore def verify_hosting_environment_vnet( - self, parameters, custom_headers=None, raw=False, **operation_config): - """Verifies if this VNET is compatible with an App Service Environment by - analyzing the Network Security Group rules. + self, + parameters, # type: "models.VnetParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetValidationFailureDetails" + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. - Verifies if this VNET is compatible with an App Service Environment by - analyzing the Network Security Group rules. + Verifies if this VNET is compatible with an App Service Environment by analyzing the Network + Security Group rules. - :param parameters: VNET information + :param parameters: VNET information. :type parameters: ~azure.mgmt.web.v2018_02_01.models.VnetParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetValidationFailureDetails or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2018_02_01.models.VnetValidationFailureDetails or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.verify_hosting_environment_vnet.metadata['url'] + url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetValidationFailureDetails', response) + deserialized = self._deserialize('VnetValidationFailureDetails', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} + verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} # type: ignore def move( - self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): + # type: (...) -> None """Move resources between resource groups. Move resources between resource groups. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope + :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 """ - move_resource_envelope = models.CsmMoveResourceEnvelope(target_resource_group=target_resource_group, resources=resources) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.move.metadata['url'] + url = self.move.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} + if cls: + return cls(pipeline_response, None, {}) + + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} # type: ignore def validate( - self, resource_group_name, validate_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + validate_request, # type: "models.ValidateRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.ValidateResponse" """Validate if a resource can be created. Validate if a resource can be created. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param validate_request: Request with the resources to validate. - :type validate_request: - ~azure.mgmt.web.v2018_02_01.models.ValidateRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ValidateResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_02_01.models.ValidateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type validate_request: ~azure.mgmt.web.v2018_02_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_02_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate.metadata['url'] + url = self.validate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ValidateResponse', response) + deserialized = self._deserialize('ValidateResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} # type: ignore def validate_container_settings( - self, validate_container_settings_request, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + validate_container_settings_request, # type: "models.ValidateContainerSettingsRequest" + **kwargs # type: Any + ): + # type: (...) -> object """Validate if the container settings are correct. Validate if the container settings are correct. - :param validate_container_settings_request: - :type validate_container_settings_request: - ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param validate_container_settings_request: + :type validate_container_settings_request: ~azure.mgmt.web.v2018_02_01.models.ValidateContainerSettingsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate_container_settings.metadata['url'] + url = self.validate_container_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_container_settings_request, 'ValidateContainerSettingsRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate_container_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validateContainerSettings'} + validate_container_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validateContainerSettings'} # type: ignore def validate_move( - self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): + # type: (...) -> None """Validate whether a resource can be moved. Validate whether a resource can be moved. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2018_02_01.models.CsmMoveResourceEnvelope + :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 """ - move_resource_envelope = models.CsmMoveResourceEnvelope(target_resource_group=target_resource_group, resources=resources) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-02-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.validate_move.metadata['url'] + url = self.validate_move.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} + 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, {}) + + validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py index b96e0933169e..320f393eaad4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2018-11-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json new file mode 100644 index 000000000000..60ea13b904df --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json @@ -0,0 +1,58 @@ +{ + "chosen_version": "2018-11-01", + "total_api_version_list": ["2018-11-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "certificates": "CertificatesOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py index 67eb48a12b0b..dc9bd8458e90 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py @@ -1,50 +1,69 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration from .operations import CertificatesOperations from . import models -class WebSiteManagementClient(SDKClient): - """WebSite Management Client +class WebSiteManagementClient(object): + """WebSite Management Client. - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration - - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.web.v2018_11_01.operations.CertificatesOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2018-11-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py new file mode 100644 index 000000000000..4c156dabe8ec --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-11-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..520547ef2222 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import CertificatesOperations +from .. import models + + +class WebSiteManagementClient(object): + """WebSite Management Client. + + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.web.v2018_11_01.aio.operations_async.CertificatesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..9ca77d91ff12 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._certificates_operations_async import CertificatesOperations + +__all__ = [ + 'CertificatesOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py new file mode 100644 index 000000000000..02932d5ed2df --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py @@ -0,0 +1,423 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +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.web.v2018_11_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates for a subscription. + + Get all certificates for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_11_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates in a resource group. + + Get all certificates in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2018_11_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.Certificate": + """Get a certificate. + + Get a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.Certificate", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_11_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'Certificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete a certificate. + + Delete a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.CertificatePatchResource", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_11_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/__init__.py index 7558f02f8c20..aede0a0c6891 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/__init__.py @@ -1,216 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from ._models_py3 import ApiDefinitionInfo - from ._models_py3 import AppServicePlan - from ._models_py3 import AutoHealActions - from ._models_py3 import AutoHealCustomAction - from ._models_py3 import AutoHealRules - from ._models_py3 import AutoHealTriggers - from ._models_py3 import AzureStorageInfoValue - from ._models_py3 import Capability from ._models_py3 import Certificate + from ._models_py3 import CertificateCollection from ._models_py3 import CertificatePatchResource - from ._models_py3 import CloningInfo - from ._models_py3 import ConnStringInfo - from ._models_py3 import CorsSettings - from ._models_py3 import DefaultErrorResponse, DefaultErrorResponseException + from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem - from ._models_py3 import DeletedSite - from ._models_py3 import Experiments - from ._models_py3 import GeoDistribution - from ._models_py3 import HandlerMapping from ._models_py3 import HostingEnvironmentProfile - from ._models_py3 import HostNameSslState - from ._models_py3 import HybridConnection - from ._models_py3 import HybridConnectionKey - from ._models_py3 import Identifier - from ._models_py3 import IpSecurityRestriction - from ._models_py3 import ManagedServiceIdentity - from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue - from ._models_py3 import NameValuePair from ._models_py3 import ProxyOnlyResource - from ._models_py3 import PushSettings - from ._models_py3 import RampUpRule - from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource - from ._models_py3 import ResourceMetricAvailability - from ._models_py3 import ResourceMetricDefinition - from ._models_py3 import Site - from ._models_py3 import SiteConfig - from ._models_py3 import SiteLimits - from ._models_py3 import SiteMachineKey - from ._models_py3 import SkuCapacity - from ._models_py3 import SkuDescription - from ._models_py3 import SlotSwapStatus - from ._models_py3 import SlowRequestsBasedTrigger - from ._models_py3 import Snapshot - from ._models_py3 import StatusCodesBasedTrigger - from ._models_py3 import User - from ._models_py3 import VirtualApplication - from ._models_py3 import VirtualDirectory - from ._models_py3 import VnetGateway - from ._models_py3 import VnetInfo - from ._models_py3 import VnetRoute except (SyntaxError, ImportError): - from ._models import ApiDefinitionInfo - from ._models import AppServicePlan - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import AzureStorageInfoValue - from ._models import Capability - from ._models import Certificate - from ._models import CertificatePatchResource - from ._models import CloningInfo - from ._models import ConnStringInfo - from ._models import CorsSettings - from ._models import DefaultErrorResponse, DefaultErrorResponseException - from ._models import DefaultErrorResponseError - from ._models import DefaultErrorResponseErrorDetailsItem - from ._models import DeletedSite - from ._models import Experiments - from ._models import GeoDistribution - from ._models import HandlerMapping - from ._models import HostingEnvironmentProfile - from ._models import HostNameSslState - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import Identifier - from ._models import IpSecurityRestriction - from ._models import ManagedServiceIdentity - from ._models import ManagedServiceIdentityUserAssignedIdentitiesValue - from ._models import NameValuePair - from ._models import ProxyOnlyResource - from ._models import PushSettings - from ._models import RampUpRule - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import Site - from ._models import SiteConfig - from ._models import SiteLimits - from ._models import SiteMachineKey - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import Snapshot - from ._models import StatusCodesBasedTrigger - from ._models import User - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetRoute -from ._paged_models import CertificatePaged + from ._models import Certificate # type: ignore + from ._models import CertificateCollection # type: ignore + from ._models import CertificatePatchResource # type: ignore + from ._models import DefaultErrorResponse # type: ignore + from ._models import DefaultErrorResponseError # type: ignore + from ._models import DefaultErrorResponseErrorDetailsItem # type: ignore + from ._models import HostingEnvironmentProfile # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import Resource # type: ignore + from ._web_site_management_client_enums import ( KeyVaultSecretStatus, - RouteType, - ManagedServiceIdentityType, - IpFilterTag, - AutoHealActionType, - ConnectionStringType, - AzureStorageType, - AzureStorageState, - ScmType, - ManagedPipelineMode, - SiteLoadBalancing, - SupportedTlsVersions, - FtpsState, - SslState, - HostType, - UsageState, - SiteAvailabilityState, - RedundancyMode, - StatusOptions, - ProvisioningState, ) __all__ = [ - 'ApiDefinitionInfo', - 'AppServicePlan', - 'AutoHealActions', - 'AutoHealCustomAction', - 'AutoHealRules', - 'AutoHealTriggers', - 'AzureStorageInfoValue', - 'Capability', 'Certificate', + 'CertificateCollection', 'CertificatePatchResource', - 'CloningInfo', - 'ConnStringInfo', - 'CorsSettings', - 'DefaultErrorResponse', 'DefaultErrorResponseException', + 'DefaultErrorResponse', 'DefaultErrorResponseError', 'DefaultErrorResponseErrorDetailsItem', - 'DeletedSite', - 'Experiments', - 'GeoDistribution', - 'HandlerMapping', 'HostingEnvironmentProfile', - 'HostNameSslState', - 'HybridConnection', - 'HybridConnectionKey', - 'Identifier', - 'IpSecurityRestriction', - 'ManagedServiceIdentity', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'NameValuePair', 'ProxyOnlyResource', - 'PushSettings', - 'RampUpRule', - 'RequestsBasedTrigger', 'Resource', - 'ResourceMetricAvailability', - 'ResourceMetricDefinition', - 'Site', - 'SiteConfig', - 'SiteLimits', - 'SiteMachineKey', - 'SkuCapacity', - 'SkuDescription', - 'SlotSwapStatus', - 'SlowRequestsBasedTrigger', - 'Snapshot', - 'StatusCodesBasedTrigger', - 'User', - 'VirtualApplication', - 'VirtualDirectory', - 'VnetGateway', - 'VnetInfo', - 'VnetRoute', - 'CertificatePaged', 'KeyVaultSecretStatus', - 'RouteType', - 'ManagedServiceIdentityType', - 'IpFilterTag', - 'AutoHealActionType', - 'ConnectionStringType', - 'AzureStorageType', - 'AzureStorageState', - 'ScmType', - 'ManagedPipelineMode', - 'SiteLoadBalancing', - 'SupportedTlsVersions', - 'FtpsState', - 'SslState', - 'HostType', - 'UsageState', - 'SiteAvailabilityState', - 'RedundancyMode', - 'StatusOptions', - 'ProvisioningState', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models.py index 6edea73571f3..3f4eb9abd831 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models.py @@ -1,39 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class ApiDefinitionInfo(Model): - """Information about the formal API definition for the app. - - :param url: The URL of the API definition. - :type url: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ApiDefinitionInfo, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - - -class Resource(Model): +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -47,7 +27,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -67,341 +47,23 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.type = None self.tags = kwargs.get('tags', None) -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2018_11_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan - :type maximum_elastic_worker_count: int - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . - :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . - :type hyper_v: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_11_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2018_11_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'maximum_elastic_worker_count': {'key': 'properties.maximumElasticWorkerCount', 'type': 'int'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'free_offer_expiration_time': {'key': 'properties.freeOfferExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'is_xenon': {'key': 'properties.isXenon', 'type': 'bool'}, - 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, **kwargs): - super(AppServicePlan, self).__init__(**kwargs) - self.worker_tier_name = kwargs.get('worker_tier_name', None) - self.status = None - self.subscription = None - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = kwargs.get('per_site_scaling', False) - self.maximum_elastic_worker_count = kwargs.get('maximum_elastic_worker_count', None) - self.number_of_sites = None - self.is_spot = kwargs.get('is_spot', None) - self.spot_expiration_time = kwargs.get('spot_expiration_time', None) - self.free_offer_expiration_time = kwargs.get('free_offer_expiration_time', None) - self.resource_group = None - self.reserved = kwargs.get('reserved', False) - self.is_xenon = kwargs.get('is_xenon', False) - self.hyper_v = kwargs.get('hyper_v', False) - self.target_worker_count = kwargs.get('target_worker_count', None) - self.target_worker_size_id = kwargs.get('target_worker_size_id', None) - self.provisioning_state = None - self.sku = kwargs.get('sku', None) - - -class AutoHealActions(Model): - """Actions which to take by the auto-heal module when a rule is triggered. - - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2018_11_01.models.AutoHealActionType - :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2018_11_01.models.AutoHealCustomAction - :param min_process_execution_time: Minimum time the process must execute - before taking the action - :type min_process_execution_time: str - """ - - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, - 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, - 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AutoHealActions, self).__init__(**kwargs) - self.action_type = kwargs.get('action_type', None) - self.custom_action = kwargs.get('custom_action', None) - self.min_process_execution_time = kwargs.get('min_process_execution_time', None) - - -class AutoHealCustomAction(Model): - """Custom action to be executed - when an auto heal rule is triggered. - - :param exe: Executable to be run. - :type exe: str - :param parameters: Parameters for the executable. - :type parameters: str - """ - - _attribute_map = { - 'exe': {'key': 'exe', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AutoHealCustomAction, self).__init__(**kwargs) - self.exe = kwargs.get('exe', None) - self.parameters = kwargs.get('parameters', None) - - -class AutoHealRules(Model): - """Rules that can be defined for auto-heal. - - :param triggers: Conditions that describe when to execute the auto-heal - actions. - :type triggers: ~azure.mgmt.web.v2018_11_01.models.AutoHealTriggers - :param actions: Actions to be executed when a rule is triggered. - :type actions: ~azure.mgmt.web.v2018_11_01.models.AutoHealActions - """ - - _attribute_map = { - 'triggers': {'key': 'triggers', 'type': 'AutoHealTriggers'}, - 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, - } - - def __init__(self, **kwargs): - super(AutoHealRules, self).__init__(**kwargs) - self.triggers = kwargs.get('triggers', None) - self.actions = kwargs.get('actions', None) - - -class AutoHealTriggers(Model): - """Triggers for auto-heal. - - :param requests: A rule based on total requests. - :type requests: ~azure.mgmt.web.v2018_11_01.models.RequestsBasedTrigger - :param private_bytes_in_kb: A rule based on private bytes. - :type private_bytes_in_kb: int - :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2018_11_01.models.StatusCodesBasedTrigger] - :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2018_11_01.models.SlowRequestsBasedTrigger - """ - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'RequestsBasedTrigger'}, - 'private_bytes_in_kb': {'key': 'privateBytesInKB', 'type': 'int'}, - 'status_codes': {'key': 'statusCodes', 'type': '[StatusCodesBasedTrigger]'}, - 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, - } - - def __init__(self, **kwargs): - super(AutoHealTriggers, self).__init__(**kwargs) - self.requests = kwargs.get('requests', None) - self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) - self.status_codes = kwargs.get('status_codes', None) - self.slow_requests = kwargs.get('slow_requests', None) - - -class AzureStorageInfoValue(Model): - """Azure Files or Blob Storage access information value for dictionary - storage. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of storage. Possible values include: 'AzureFiles', - 'AzureBlob' - :type type: str or ~azure.mgmt.web.v2018_11_01.models.AzureStorageType - :param account_name: Name of the storage account. - :type account_name: str - :param share_name: Name of the file share (container name, for Blob - storage). - :type share_name: str - :param access_key: Access key for the storage account. - :type access_key: str - :param mount_path: Path to mount the storage within the site's runtime - environment. - :type mount_path: str - :ivar state: State of the storage account. Possible values include: 'Ok', - 'InvalidCredentials', 'InvalidShare' - :vartype state: str or - ~azure.mgmt.web.v2018_11_01.models.AzureStorageState - """ - - _validation = { - 'state': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'AzureStorageType'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'share_name': {'key': 'shareName', 'type': 'str'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'AzureStorageState'}, - } - - def __init__(self, **kwargs): - super(AzureStorageInfoValue, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.account_name = kwargs.get('account_name', None) - self.share_name = kwargs.get('share_name', None) - self.access_key = kwargs.get('access_key', None) - self.mount_path = kwargs.get('mount_path', None) - self.state = None - - -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Capability, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - self.reason = kwargs.get('reason', None) - - class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -415,7 +77,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -432,37 +94,35 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_11_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -479,7 +139,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -512,11 +171,14 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Certificate, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -539,12 +201,42 @@ def __init__(self, **kwargs): self.server_farm_id = kwargs.get('server_farm_id', None) -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_11_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + - Variables are only populated by the server, and will be ignored when - sending a request. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. + + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -569,7 +261,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -580,10 +275,7 @@ def __init__(self, **kwargs): class CertificatePatchResource(ProxyOnlyResource): """ARM resource for a certificate. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -608,37 +300,35 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_11_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -654,7 +344,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -685,11 +374,14 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePatchResource, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -712,155 +404,13 @@ def __init__(self, **kwargs): self.server_farm_id = kwargs.get('server_farm_id', None) -class CloningInfo(Model): - """Information needed for cloning operation. - - All required parameters must be populated in order to send to Azure. - - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations - together to use the same snapshot. - :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. - :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. - :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. - :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type source_web_app_id: str - :param source_web_app_location: Location of source app ex: West US or - North Europe - :type source_web_app_location: str - :param hosting_environment: App Service Environment. - :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. - :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. - :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. - :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. - :type traffic_manager_profile_name: str - """ - - _validation = { - 'source_web_app_id': {'required': True}, - } - - _attribute_map = { - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'overwrite': {'key': 'overwrite', 'type': 'bool'}, - 'clone_custom_host_names': {'key': 'cloneCustomHostNames', 'type': 'bool'}, - 'clone_source_control': {'key': 'cloneSourceControl', 'type': 'bool'}, - 'source_web_app_id': {'key': 'sourceWebAppId', 'type': 'str'}, - 'source_web_app_location': {'key': 'sourceWebAppLocation', 'type': 'str'}, - 'hosting_environment': {'key': 'hostingEnvironment', 'type': 'str'}, - 'app_settings_overrides': {'key': 'appSettingsOverrides', 'type': '{str}'}, - 'configure_load_balancing': {'key': 'configureLoadBalancing', 'type': 'bool'}, - 'traffic_manager_profile_id': {'key': 'trafficManagerProfileId', 'type': 'str'}, - 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(CloningInfo, self).__init__(**kwargs) - self.correlation_id = kwargs.get('correlation_id', None) - self.overwrite = kwargs.get('overwrite', None) - self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) - self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) - self.source_web_app_location = kwargs.get('source_web_app_location', None) - self.hosting_environment = kwargs.get('hosting_environment', None) - self.app_settings_overrides = kwargs.get('app_settings_overrides', None) - self.configure_load_balancing = kwargs.get('configure_load_balancing', None) - self.traffic_manager_profile_id = kwargs.get('traffic_manager_profile_id', None) - self.traffic_manager_profile_name = kwargs.get('traffic_manager_profile_name', None) - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): - """Database connection string information. - - :param name: Name of connection string. - :type name: str - :param connection_string: Connection string value. - :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' - :type type: str or ~azure.mgmt.web.v2018_11_01.models.ConnectionStringType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, - } - - def __init__(self, **kwargs): - super(ConnStringInfo, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.connection_string = kwargs.get('connection_string', None) - self.type = kwargs.get('type', None) - - -class CorsSettings(Model): - """Cross-Origin Resource Sharing (CORS) settings for the app. - - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin - calls (for example: http://example.com:12345). Use "*" to allow all. - :type allowed_origins: list[str] - :param support_credentials: Gets or sets whether CORS requests with - credentials are allowed. See - https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials - for more details. - :type support_credentials: bool - """ - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'support_credentials': {'key': 'supportCredentials', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(CorsSettings, self).__init__(**kwargs) - self.allowed_origins = kwargs.get('allowed_origins', None) - self.support_credentials = kwargs.get('support_credentials', None) - - -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseError """ _validation = { @@ -871,28 +421,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -901,8 +441,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -922,7 +461,10 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -931,11 +473,10 @@ def __init__(self, **kwargs): self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -957,156 +498,20 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None self.target = None -class DeletedSite(ProxyOnlyResource): - """A deleted app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar deleted_site_id: Numeric id for the deleted site - :vartype deleted_site_id: int - :ivar deleted_timestamp: Time in UTC when the app was deleted. - :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site - :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site - :vartype resource_group: str - :ivar deleted_site_name: Name of the deleted site - :vartype deleted_site_name: str - :ivar slot: Slot of the deleted site - :vartype slot: str - :ivar deleted_site_kind: Kind of site that was deleted - :vartype deleted_site_kind: str - :ivar geo_region_name: Geo Region of the deleted site - :vartype geo_region_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'deleted_site_id': {'readonly': True}, - 'deleted_timestamp': {'readonly': True}, - 'subscription': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'deleted_site_name': {'readonly': True}, - 'slot': {'readonly': True}, - 'deleted_site_kind': {'readonly': True}, - 'geo_region_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'deleted_site_id': {'key': 'properties.deletedSiteId', 'type': 'int'}, - 'deleted_timestamp': {'key': 'properties.deletedTimestamp', 'type': 'str'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'deleted_site_name': {'key': 'properties.deletedSiteName', 'type': 'str'}, - 'slot': {'key': 'properties.slot', 'type': 'str'}, - 'deleted_site_kind': {'key': 'properties.kind', 'type': 'str'}, - 'geo_region_name': {'key': 'properties.geoRegionName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(DeletedSite, self).__init__(**kwargs) - self.deleted_site_id = None - self.deleted_timestamp = None - self.subscription = None - self.resource_group = None - self.deleted_site_name = None - self.slot = None - self.deleted_site_kind = None - self.geo_region_name = None - - -class Experiments(Model): - """Routing rules in production experiments. - - :param ramp_up_rules: List of ramp-up rules. - :type ramp_up_rules: list[~azure.mgmt.web.v2018_11_01.models.RampUpRule] - """ - - _attribute_map = { - 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, - } - - def __init__(self, **kwargs): - super(Experiments, self).__init__(**kwargs) - self.ramp_up_rules = kwargs.get('ramp_up_rules', None) - - -class GeoDistribution(Model): - """A global distribution definition. - - :param location: Location. - :type location: str - :param number_of_workers: NumberOfWorkers. - :type number_of_workers: int - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(GeoDistribution, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.number_of_workers = kwargs.get('number_of_workers', None) - - -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. - - :param extension: Requests with this extension will be handled using the - specified FastCGI application. - :type extension: str - :param script_processor: The absolute path to the FastCGI application. - :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. - :type arguments: str - """ - - _attribute_map = { - 'extension': {'key': 'extension', 'type': 'str'}, - 'script_processor': {'key': 'scriptProcessor', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HandlerMapping, self).__init__(**kwargs) - self.extension = kwargs.get('extension', None) - self.script_processor = kwargs.get('script_processor', None) - self.arguments = kwargs.get('arguments', None) - - -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -1127,1624 +532,11 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None self.type = None - - -class HostNameSslState(Model): - """SSL-enabled hostname. - - :param name: Hostname. - :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' - :type ssl_state: str or ~azure.mgmt.web.v2018_11_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. - :type virtual_ip: str - :param thumbprint: SSL certificate thumbprint. - :type thumbprint: str - :param to_update: Set to true to update existing hostname. - :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' - :type host_type: str or ~azure.mgmt.web.v2018_11_01.models.HostType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, - 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, **kwargs): - super(HostNameSslState, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.ssl_state = kwargs.get('ssl_state', None) - self.virtual_ip = kwargs.get('virtual_ip', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.to_update = kwargs.get('to_update', None) - self.host_type = kwargs.get('host_type', None) - - -class HybridConnection(ProxyOnlyResource): - """Hybrid Connection contract. This is used to configure a Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param service_bus_namespace: The name of the Service Bus namespace. - :type service_bus_namespace: str - :param relay_name: The name of the Service Bus relay. - :type relay_name: str - :param relay_arm_uri: The ARM URI to the Service Bus relay. - :type relay_arm_uri: str - :param hostname: The hostname of the endpoint. - :type hostname: str - :param port: The port of the endpoint. - :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. - :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned - normally, use the POST /listKeys API instead. - :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net - :type service_bus_suffix: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'service_bus_namespace': {'key': 'properties.serviceBusNamespace', 'type': 'str'}, - 'relay_name': {'key': 'properties.relayName', 'type': 'str'}, - 'relay_arm_uri': {'key': 'properties.relayArmUri', 'type': 'str'}, - 'hostname': {'key': 'properties.hostname', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HybridConnection, self).__init__(**kwargs) - self.service_bus_namespace = kwargs.get('service_bus_namespace', None) - self.relay_name = kwargs.get('relay_name', None) - self.relay_arm_uri = kwargs.get('relay_arm_uri', None) - self.hostname = kwargs.get('hostname', None) - self.port = kwargs.get('port', None) - self.send_key_name = kwargs.get('send_key_name', None) - self.send_key_value = kwargs.get('send_key_value', None) - self.service_bus_suffix = kwargs.get('service_bus_suffix', None) - - -class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar send_key_name: The name of the send key. - :vartype send_key_name: str - :ivar send_key_value: The value of the send key. - :vartype send_key_value: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'send_key_name': {'readonly': True}, - 'send_key_value': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HybridConnectionKey, self).__init__(**kwargs) - self.send_key_name = None - self.send_key_value = None - - -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Identifier, self).__init__(**kwargs) - self.identifier_id = kwargs.get('identifier_id', None) - - -class IpSecurityRestriction(Model): - """IP security restriction on an app. - - :param ip_address: IP address the security restriction is valid for. - It can be in form of pure ipv4 address (required SubnetMask property) or - CIDR notation such as ipv4/mask (leading bit match). For CIDR, - SubnetMask property must not be specified. - :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. - :type subnet_mask: str - :param vnet_subnet_resource_id: Virtual network resource id - :type vnet_subnet_resource_id: str - :param vnet_traffic_tag: (internal) Vnet traffic tag - :type vnet_traffic_tag: int - :param subnet_traffic_tag: (internal) Subnet traffic tag - :type subnet_traffic_tag: int - :param action: Allow or Deny access for this IP range. - :type action: str - :param tag: Defines what this IP filter will be used for. This is to - support IP filtering on proxies. Possible values include: 'Default', - 'XffProxy' - :type tag: str or ~azure.mgmt.web.v2018_11_01.models.IpFilterTag - :param priority: Priority of IP restriction rule. - :type priority: int - :param name: IP restriction rule name. - :type name: str - :param description: IP restriction rule description. - :type description: str - """ - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, - 'vnet_subnet_resource_id': {'key': 'vnetSubnetResourceId', 'type': 'str'}, - 'vnet_traffic_tag': {'key': 'vnetTrafficTag', 'type': 'int'}, - 'subnet_traffic_tag': {'key': 'subnetTrafficTag', 'type': 'int'}, - 'action': {'key': 'action', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'IpFilterTag'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = kwargs.get('ip_address', None) - self.subnet_mask = kwargs.get('subnet_mask', None) - self.vnet_subnet_resource_id = kwargs.get('vnet_subnet_resource_id', None) - self.vnet_traffic_tag = kwargs.get('vnet_traffic_tag', None) - self.subnet_traffic_tag = kwargs.get('subnet_traffic_tag', None) - self.action = kwargs.get('action', None) - self.tag = kwargs.get('tag', None) - self.priority = kwargs.get('priority', None) - self.name = kwargs.get('name', None) - self.description = kwargs.get('description', None) - - -class ManagedServiceIdentity(Model): - """Managed service identity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' - :type type: str or - ~azure.mgmt.web.v2018_11_01.models.ManagedServiceIdentityType - :ivar tenant_id: Tenant of managed service identity. - :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. - :vartype principal_id: str - :param user_assigned_identities: The list of user assigned identities - associated with the resource. The user identity dictionary key references - will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} - :type user_assigned_identities: dict[str, - ~azure.mgmt.web.v2018_11_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] - """ - - _validation = { - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, - } - - def __init__(self, **kwargs): - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.tenant_id = None - self.principal_id = None - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ManagedServiceIdentityUserAssignedIdentitiesValue(Model): - """ManagedServiceIdentityUserAssignedIdentitiesValue. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar principal_id: Principal Id of user assigned identity - :vartype principal_id: str - :ivar client_id: Client Id of user assigned 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(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class NameValuePair(Model): - """Name value pair. - - :param name: Pair name. - :type name: str - :param value: Pair value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(NameValuePair, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class PushSettings(ProxyOnlyResource): - """Push settings for the App. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. - :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. - :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. - Tags can consist of alphanumeric characters and the following: - '_', '@', '#', '.', ':', '-'. - Validation should be performed at the PushRequestHandler. - :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. - :type dynamic_tags_json: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'is_push_enabled': {'key': 'properties.isPushEnabled', 'type': 'bool'}, - 'tag_whitelist_json': {'key': 'properties.tagWhitelistJson', 'type': 'str'}, - 'tags_requiring_auth': {'key': 'properties.tagsRequiringAuth', 'type': 'str'}, - 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PushSettings, self).__init__(**kwargs) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) - self.tags_requiring_auth = kwargs.get('tags_requiring_auth', None) - self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) - - -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. - - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. - :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. - :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. - :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. - :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. - :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. - :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ - :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. - :type name: str - """ - - _attribute_map = { - 'action_host_name': {'key': 'actionHostName', 'type': 'str'}, - 'reroute_percentage': {'key': 'reroutePercentage', 'type': 'float'}, - 'change_step': {'key': 'changeStep', 'type': 'float'}, - 'change_interval_in_minutes': {'key': 'changeIntervalInMinutes', 'type': 'int'}, - 'min_reroute_percentage': {'key': 'minReroutePercentage', 'type': 'float'}, - 'max_reroute_percentage': {'key': 'maxReroutePercentage', 'type': 'float'}, - 'change_decision_callback_url': {'key': 'changeDecisionCallbackUrl', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(RampUpRule, self).__init__(**kwargs) - self.action_host_name = kwargs.get('action_host_name', None) - self.reroute_percentage = kwargs.get('reroute_percentage', None) - self.change_step = kwargs.get('change_step', None) - self.change_interval_in_minutes = kwargs.get('change_interval_in_minutes', None) - self.min_reroute_percentage = kwargs.get('min_reroute_percentage', None) - self.max_reroute_percentage = kwargs.get('max_reroute_percentage', None) - self.change_decision_callback_url = kwargs.get('change_decision_callback_url', None) - self.name = kwargs.get('name', None) - - -class RequestsBasedTrigger(Model): - """Trigger based on total requests. - - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(RequestsBasedTrigger, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class ResourceMetricAvailability(Model): - """Metrics availability and retention. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar time_grain: Time grain . - :vartype time_grain: str - :ivar retention: Retention period for the current time grain. - :vartype retention: str - """ - - _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, - } - - _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ResourceMetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None - - -class ResourceMetricDefinition(ProxyOnlyResource): - """Metadata for the metrics. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar unit: Unit of the metric. - :vartype unit: str - :ivar primary_aggregation_type: Primary aggregation type. - :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2018_11_01.models.ResourceMetricAvailability] - :ivar resource_uri: Resource URI. - :vartype resource_uri: str - :ivar properties: Resource metric definition properties. - :vartype properties: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'unit': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'metric_availabilities': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, - 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, - 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'properties': {'key': 'properties.properties', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(ResourceMetricDefinition, self).__init__(**kwargs) - self.unit = None - self.primary_aggregation_type = None - self.metric_availabilities = None - self.resource_uri = None - self.properties = None - - -class Site(Resource): - """A web app, a mobile app backend, or an API app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :ivar state: Current state of the app. - :vartype state: str - :ivar host_names: Hostnames associated with the app. - :vartype host_names: list[str] - :ivar repository_site_name: Name of the repository site. - :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' - :vartype usage_state: str or ~azure.mgmt.web.v2018_11_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). - :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, - the app is not served on those hostnames. - :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2018_11_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2018_11_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: - "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". - :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . - :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . - :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . - :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime - :param site_config: Configuration of the app. - :type site_config: ~azure.mgmt.web.v2018_11_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. - :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . - :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. - :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. - :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. - :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths - :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. - :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. - :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. - :vartype possible_outbound_ip_addresses: str - :param container_size: Size of the function container. - :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). - :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime - :ivar max_number_of_workers: Maximum number of workers. - This only applies to Functions container. - :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. - :type cloning_info: ~azure.mgmt.web.v2018_11_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. - :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. - :vartype is_default_container: bool - :ivar default_host_name: Default hostname of the app. Read-only. - :vartype default_host_name: str - :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2018_11_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests - :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2018_11_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. - :vartype in_progress_operation_id: str - :param geo_distributions: GeoDistributions for this site - :type geo_distributions: - list[~azure.mgmt.web.v2018_11_01.models.GeoDistribution] - :param identity: - :type identity: ~azure.mgmt.web.v2018_11_01.models.ManagedServiceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'host_names': {'readonly': True}, - 'repository_site_name': {'readonly': True}, - 'usage_state': {'readonly': True}, - 'enabled_host_names': {'readonly': True}, - 'availability_state': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'traffic_manager_host_names': {'readonly': True}, - 'target_swap_slot': {'readonly': True}, - 'outbound_ip_addresses': {'readonly': True}, - 'possible_outbound_ip_addresses': {'readonly': True}, - 'suspended_till': {'readonly': True}, - 'max_number_of_workers': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'is_default_container': {'readonly': True}, - 'default_host_name': {'readonly': True}, - 'slot_swap_status': {'readonly': True}, - 'in_progress_operation_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, - 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, - 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, - 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'is_xenon': {'key': 'properties.isXenon', 'type': 'bool'}, - 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, - 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, - 'site_config': {'key': 'properties.siteConfig', 'type': 'SiteConfig'}, - 'traffic_manager_host_names': {'key': 'properties.trafficManagerHostNames', 'type': '[str]'}, - 'scm_site_also_stopped': {'key': 'properties.scmSiteAlsoStopped', 'type': 'bool'}, - 'target_swap_slot': {'key': 'properties.targetSwapSlot', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'client_affinity_enabled': {'key': 'properties.clientAffinityEnabled', 'type': 'bool'}, - 'client_cert_enabled': {'key': 'properties.clientCertEnabled', 'type': 'bool'}, - 'client_cert_exclusion_paths': {'key': 'properties.clientCertExclusionPaths', 'type': 'str'}, - 'host_names_disabled': {'key': 'properties.hostNamesDisabled', 'type': 'bool'}, - 'outbound_ip_addresses': {'key': 'properties.outboundIpAddresses', 'type': 'str'}, - 'possible_outbound_ip_addresses': {'key': 'properties.possibleOutboundIpAddresses', 'type': 'str'}, - 'container_size': {'key': 'properties.containerSize', 'type': 'int'}, - 'daily_memory_time_quota': {'key': 'properties.dailyMemoryTimeQuota', 'type': 'int'}, - 'suspended_till': {'key': 'properties.suspendedTill', 'type': 'iso-8601'}, - 'max_number_of_workers': {'key': 'properties.maxNumberOfWorkers', 'type': 'int'}, - 'cloning_info': {'key': 'properties.cloningInfo', 'type': 'CloningInfo'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'is_default_container': {'key': 'properties.isDefaultContainer', 'type': 'bool'}, - 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, - 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, - 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, - 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, - 'geo_distributions': {'key': 'properties.geoDistributions', 'type': '[GeoDistribution]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - } - - def __init__(self, **kwargs): - super(Site, self).__init__(**kwargs) - self.state = None - self.host_names = None - self.repository_site_name = None - self.usage_state = None - self.enabled = kwargs.get('enabled', None) - self.enabled_host_names = None - self.availability_state = None - self.host_name_ssl_states = kwargs.get('host_name_ssl_states', None) - self.server_farm_id = kwargs.get('server_farm_id', None) - self.reserved = kwargs.get('reserved', False) - self.is_xenon = kwargs.get('is_xenon', False) - self.hyper_v = kwargs.get('hyper_v', False) - self.last_modified_time_utc = None - self.site_config = kwargs.get('site_config', None) - self.traffic_manager_host_names = None - self.scm_site_also_stopped = kwargs.get('scm_site_also_stopped', False) - self.target_swap_slot = None - self.hosting_environment_profile = kwargs.get('hosting_environment_profile', None) - self.client_affinity_enabled = kwargs.get('client_affinity_enabled', None) - self.client_cert_enabled = kwargs.get('client_cert_enabled', None) - self.client_cert_exclusion_paths = kwargs.get('client_cert_exclusion_paths', None) - self.host_names_disabled = kwargs.get('host_names_disabled', None) - self.outbound_ip_addresses = None - self.possible_outbound_ip_addresses = None - self.container_size = kwargs.get('container_size', None) - self.daily_memory_time_quota = kwargs.get('daily_memory_time_quota', None) - self.suspended_till = None - self.max_number_of_workers = None - self.cloning_info = kwargs.get('cloning_info', None) - self.resource_group = None - self.is_default_container = None - self.default_host_name = None - self.slot_swap_status = None - self.https_only = kwargs.get('https_only', None) - self.redundancy_mode = kwargs.get('redundancy_mode', None) - self.in_progress_operation_id = None - self.geo_distributions = kwargs.get('geo_distributions', None) - self.identity = kwargs.get('identity', None) - - -class SiteConfig(Model): - """Configuration of an App Service app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param number_of_workers: Number of workers. - :type number_of_workers: int - :param default_documents: Default documents. - :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . - :type net_framework_version: str - :param php_version: Version of PHP. - :type php_version: str - :param python_version: Version of Python. - :type python_version: str - :param node_version: Version of Node.js. - :type node_version: str - :param linux_fx_version: Linux App Framework and version - :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version - :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. - :type request_tracing_enabled: bool - :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. - :type remote_debugging_enabled: bool - :param remote_debugging_version: Remote debugging version. - :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. - :type http_logging_enabled: bool - :param logs_directory_size_limit: HTTP logs directory size limit. - :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. - :type detailed_error_logging_enabled: bool - :param publishing_username: Publishing user name. - :type publishing_username: str - :param app_settings: Application settings. - :type app_settings: list[~azure.mgmt.web.v2018_11_01.models.NameValuePair] - :param azure_storage_accounts: User-provided Azure storage accounts. - :type azure_storage_accounts: dict[str, - ~azure.mgmt.web.v2018_11_01.models.AzureStorageInfoValue] - :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2018_11_01.models.ConnStringInfo] - :ivar machine_key: Site MachineKey. - :vartype machine_key: ~azure.mgmt.web.v2018_11_01.models.SiteMachineKey - :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2018_11_01.models.HandlerMapping] - :param document_root: Document root. - :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' - :type scm_type: str or ~azure.mgmt.web.v2018_11_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. - :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. - :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. - :type always_on: bool - :param java_version: Java version. - :type java_version: str - :param java_container: Java container. - :type java_container: str - :param java_container_version: Java container version. - :type java_container_version: str - :param app_command_line: App command line to launch. - :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2018_11_01.models.ManagedPipelineMode - :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2018_11_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2018_11_01.models.SiteLoadBalancing - :param experiments: This is work around for polymorphic types. - :type experiments: ~azure.mgmt.web.v2018_11_01.models.Experiments - :param limits: Site limits. - :type limits: ~azure.mgmt.web.v2018_11_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. - :type auto_heal_enabled: bool - :param auto_heal_rules: Auto Heal rules. - :type auto_heal_rules: ~azure.mgmt.web.v2018_11_01.models.AutoHealRules - :param tracing_options: Tracing options. - :type tracing_options: str - :param vnet_name: Virtual Network name. - :type vnet_name: str - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.web.v2018_11_01.models.CorsSettings - :param push: Push endpoint settings. - :type push: ~azure.mgmt.web.v2018_11_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. - :type api_definition: ~azure.mgmt.web.v2018_11_01.models.ApiDefinitionInfo - :param auto_swap_slot_name: Auto-swap slot name. - :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . - :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id - :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id - :type x_managed_service_identity_id: int - :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2018_11_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions: IP security restrictions for scm. - :type scm_ip_security_restrictions: - list[~azure.mgmt.web.v2018_11_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. - :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . - :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2018_11_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' - :type ftps_state: str or ~azure.mgmt.web.v2018_11_01.models.FtpsState - :param reserved_instance_count: Number of reserved instances. - This setting only applies to the Consumption Plan - :type reserved_instance_count: int - """ - - _validation = { - 'machine_key': {'readonly': True}, - 'reserved_instance_count': {'maximum': 10, 'minimum': 0}, - } - - _attribute_map = { - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'default_documents': {'key': 'defaultDocuments', 'type': '[str]'}, - 'net_framework_version': {'key': 'netFrameworkVersion', 'type': 'str'}, - 'php_version': {'key': 'phpVersion', 'type': 'str'}, - 'python_version': {'key': 'pythonVersion', 'type': 'str'}, - 'node_version': {'key': 'nodeVersion', 'type': 'str'}, - 'linux_fx_version': {'key': 'linuxFxVersion', 'type': 'str'}, - 'windows_fx_version': {'key': 'windowsFxVersion', 'type': 'str'}, - 'request_tracing_enabled': {'key': 'requestTracingEnabled', 'type': 'bool'}, - 'request_tracing_expiration_time': {'key': 'requestTracingExpirationTime', 'type': 'iso-8601'}, - 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, - 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, - 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, - 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, - 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, - 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, - 'app_settings': {'key': 'appSettings', 'type': '[NameValuePair]'}, - 'azure_storage_accounts': {'key': 'azureStorageAccounts', 'type': '{AzureStorageInfoValue}'}, - 'connection_strings': {'key': 'connectionStrings', 'type': '[ConnStringInfo]'}, - 'machine_key': {'key': 'machineKey', 'type': 'SiteMachineKey'}, - 'handler_mappings': {'key': 'handlerMappings', 'type': '[HandlerMapping]'}, - 'document_root': {'key': 'documentRoot', 'type': 'str'}, - 'scm_type': {'key': 'scmType', 'type': 'str'}, - 'use32_bit_worker_process': {'key': 'use32BitWorkerProcess', 'type': 'bool'}, - 'web_sockets_enabled': {'key': 'webSocketsEnabled', 'type': 'bool'}, - 'always_on': {'key': 'alwaysOn', 'type': 'bool'}, - 'java_version': {'key': 'javaVersion', 'type': 'str'}, - 'java_container': {'key': 'javaContainer', 'type': 'str'}, - 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, - 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, - 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, - 'experiments': {'key': 'experiments', 'type': 'Experiments'}, - 'limits': {'key': 'limits', 'type': 'SiteLimits'}, - 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, - 'auto_heal_rules': {'key': 'autoHealRules', 'type': 'AutoHealRules'}, - 'tracing_options': {'key': 'tracingOptions', 'type': 'str'}, - 'vnet_name': {'key': 'vnetName', 'type': 'str'}, - 'cors': {'key': 'cors', 'type': 'CorsSettings'}, - 'push': {'key': 'push', 'type': 'PushSettings'}, - 'api_definition': {'key': 'apiDefinition', 'type': 'ApiDefinitionInfo'}, - 'auto_swap_slot_name': {'key': 'autoSwapSlotName', 'type': 'str'}, - 'local_my_sql_enabled': {'key': 'localMySqlEnabled', 'type': 'bool'}, - 'managed_service_identity_id': {'key': 'managedServiceIdentityId', 'type': 'int'}, - 'x_managed_service_identity_id': {'key': 'xManagedServiceIdentityId', 'type': 'int'}, - 'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'scm_ip_security_restrictions': {'key': 'scmIpSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'scm_ip_security_restrictions_use_main': {'key': 'scmIpSecurityRestrictionsUseMain', 'type': 'bool'}, - 'http20_enabled': {'key': 'http20Enabled', 'type': 'bool'}, - 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, - 'ftps_state': {'key': 'ftpsState', 'type': 'str'}, - 'reserved_instance_count': {'key': 'reservedInstanceCount', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(SiteConfig, self).__init__(**kwargs) - self.number_of_workers = kwargs.get('number_of_workers', None) - self.default_documents = kwargs.get('default_documents', None) - self.net_framework_version = kwargs.get('net_framework_version', "v4.6") - self.php_version = kwargs.get('php_version', None) - self.python_version = kwargs.get('python_version', None) - self.node_version = kwargs.get('node_version', None) - self.linux_fx_version = kwargs.get('linux_fx_version', None) - self.windows_fx_version = kwargs.get('windows_fx_version', None) - self.request_tracing_enabled = kwargs.get('request_tracing_enabled', None) - self.request_tracing_expiration_time = kwargs.get('request_tracing_expiration_time', None) - self.remote_debugging_enabled = kwargs.get('remote_debugging_enabled', None) - self.remote_debugging_version = kwargs.get('remote_debugging_version', None) - self.http_logging_enabled = kwargs.get('http_logging_enabled', None) - self.logs_directory_size_limit = kwargs.get('logs_directory_size_limit', None) - self.detailed_error_logging_enabled = kwargs.get('detailed_error_logging_enabled', None) - self.publishing_username = kwargs.get('publishing_username', None) - self.app_settings = kwargs.get('app_settings', None) - self.azure_storage_accounts = kwargs.get('azure_storage_accounts', None) - self.connection_strings = kwargs.get('connection_strings', None) - self.machine_key = None - self.handler_mappings = kwargs.get('handler_mappings', None) - self.document_root = kwargs.get('document_root', None) - self.scm_type = kwargs.get('scm_type', None) - self.use32_bit_worker_process = kwargs.get('use32_bit_worker_process', None) - self.web_sockets_enabled = kwargs.get('web_sockets_enabled', None) - self.always_on = kwargs.get('always_on', None) - self.java_version = kwargs.get('java_version', None) - self.java_container = kwargs.get('java_container', None) - self.java_container_version = kwargs.get('java_container_version', None) - self.app_command_line = kwargs.get('app_command_line', None) - self.managed_pipeline_mode = kwargs.get('managed_pipeline_mode', None) - self.virtual_applications = kwargs.get('virtual_applications', None) - self.load_balancing = kwargs.get('load_balancing', None) - self.experiments = kwargs.get('experiments', None) - self.limits = kwargs.get('limits', None) - self.auto_heal_enabled = kwargs.get('auto_heal_enabled', None) - self.auto_heal_rules = kwargs.get('auto_heal_rules', None) - self.tracing_options = kwargs.get('tracing_options', None) - self.vnet_name = kwargs.get('vnet_name', None) - self.cors = kwargs.get('cors', None) - self.push = kwargs.get('push', None) - self.api_definition = kwargs.get('api_definition', None) - self.auto_swap_slot_name = kwargs.get('auto_swap_slot_name', None) - self.local_my_sql_enabled = kwargs.get('local_my_sql_enabled', False) - self.managed_service_identity_id = kwargs.get('managed_service_identity_id', None) - self.x_managed_service_identity_id = kwargs.get('x_managed_service_identity_id', None) - self.ip_security_restrictions = kwargs.get('ip_security_restrictions', None) - self.scm_ip_security_restrictions = kwargs.get('scm_ip_security_restrictions', None) - self.scm_ip_security_restrictions_use_main = kwargs.get('scm_ip_security_restrictions_use_main', None) - self.http20_enabled = kwargs.get('http20_enabled', True) - self.min_tls_version = kwargs.get('min_tls_version', None) - self.ftps_state = kwargs.get('ftps_state', None) - self.reserved_instance_count = kwargs.get('reserved_instance_count', None) - - -class SiteLimits(Model): - """Metric limits set on an app. - - :param max_percentage_cpu: Maximum allowed CPU usage percentage. - :type max_percentage_cpu: float - :param max_memory_in_mb: Maximum allowed memory usage in MB. - :type max_memory_in_mb: long - :param max_disk_size_in_mb: Maximum allowed disk size usage in MB. - :type max_disk_size_in_mb: long - """ - - _attribute_map = { - 'max_percentage_cpu': {'key': 'maxPercentageCpu', 'type': 'float'}, - 'max_memory_in_mb': {'key': 'maxMemoryInMb', 'type': 'long'}, - 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, - } - - def __init__(self, **kwargs): - super(SiteLimits, self).__init__(**kwargs) - self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) - self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) - self.max_disk_size_in_mb = kwargs.get('max_disk_size_in_mb', None) - - -class SiteMachineKey(Model): - """MachineKey of an app. - - :param validation: MachineKey validation. - :type validation: str - :param validation_key: Validation key. - :type validation_key: str - :param decryption: Algorithm used for decryption. - :type decryption: str - :param decryption_key: Decryption key. - :type decryption_key: str - """ - - _attribute_map = { - 'validation': {'key': 'validation', 'type': 'str'}, - 'validation_key': {'key': 'validationKey', 'type': 'str'}, - 'decryption': {'key': 'decryption', 'type': 'str'}, - 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SiteMachineKey, self).__init__(**kwargs) - self.validation = kwargs.get('validation', None) - self.validation_key = kwargs.get('validation_key', None) - self.decryption = kwargs.get('decryption', None) - self.decryption_key = kwargs.get('decryption_key', None) - - -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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, **kwargs): - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) - self.maximum = kwargs.get('maximum', None) - self.default = kwargs.get('default', None) - self.scale_type = kwargs.get('scale_type', None) - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2018_11_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2018_11_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, **kwargs): - super(SkuDescription, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - self.sku_capacity = kwargs.get('sku_capacity', None) - self.locations = kwargs.get('locations', None) - self.capabilities = kwargs.get('capabilities', None) - - -class SlotSwapStatus(Model): - """The status of the last successful slot swap operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime - :ivar source_slot_name: The source slot of the last swap operation. - :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. - :vartype destination_slot_name: str - """ - - _validation = { - 'timestamp_utc': {'readonly': True}, - 'source_slot_name': {'readonly': True}, - 'destination_slot_name': {'readonly': True}, - } - - _attribute_map = { - 'timestamp_utc': {'key': 'timestampUtc', 'type': 'iso-8601'}, - 'source_slot_name': {'key': 'sourceSlotName', 'type': 'str'}, - 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SlotSwapStatus, self).__init__(**kwargs) - self.timestamp_utc = None - self.source_slot_name = None - self.destination_slot_name = None - - -class SlowRequestsBasedTrigger(Model): - """Trigger based on request execution time. - - :param time_taken: Time taken. - :type time_taken: str - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'time_taken': {'key': 'timeTaken', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SlowRequestsBasedTrigger, self).__init__(**kwargs) - self.time_taken = kwargs.get('time_taken', None) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class Snapshot(ProxyOnlyResource): - """A snapshot of an app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar time: The time the snapshot was taken. - :vartype time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'time': {'key': 'properties.time', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Snapshot, self).__init__(**kwargs) - self.time = None - - -class StatusCodesBasedTrigger(Model): - """Trigger based on status code. - - :param status: HTTP status code. - :type status: int - :param sub_status: Request Sub Status. - :type sub_status: int - :param win32_status: Win32 error code. - :type win32_status: int - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'int'}, - 'sub_status': {'key': 'subStatus', 'type': 'int'}, - 'win32_status': {'key': 'win32Status', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(StatusCodesBasedTrigger, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.sub_status = kwargs.get('sub_status', None) - self.win32_status = kwargs.get('win32_status', None) - self.count = kwargs.get('count', None) - self.time_interval = kwargs.get('time_interval', None) - - -class User(ProxyOnlyResource): - """User credentials used for publishing activity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str - :param scm_uri: Url of SCM site. - :type scm_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, - 'scm_uri': {'key': 'properties.scmUri', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(User, self).__init__(**kwargs) - self.publishing_user_name = kwargs.get('publishing_user_name', None) - self.publishing_password = kwargs.get('publishing_password', None) - self.publishing_password_hash = kwargs.get('publishing_password_hash', None) - self.publishing_password_hash_salt = kwargs.get('publishing_password_hash_salt', None) - self.scm_uri = kwargs.get('scm_uri', None) - - -class VirtualApplication(Model): - """Virtual application in an app. - - :param virtual_path: Virtual path. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. - :type preload_enabled: bool - :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2018_11_01.models.VirtualDirectory] - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - 'preload_enabled': {'key': 'preloadEnabled', 'type': 'bool'}, - 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, - } - - def __init__(self, **kwargs): - super(VirtualApplication, self).__init__(**kwargs) - self.virtual_path = kwargs.get('virtual_path', None) - self.physical_path = kwargs.get('physical_path', None) - self.preload_enabled = kwargs.get('preload_enabled', None) - self.virtual_directories = kwargs.get('virtual_directories', None) - - -class VirtualDirectory(Model): - """Directory for virtual application. - - :param virtual_path: Path to virtual application. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VirtualDirectory, self).__init__(**kwargs) - self.virtual_path = kwargs.get('virtual_path', None) - self.physical_path = kwargs.get('physical_path', None) - - -class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_name: The Virtual Network name. - :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. - :type vpn_package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, - 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetGateway, self).__init__(**kwargs) - self.vnet_name = kwargs.get('vnet_name', None) - self.vpn_package_uri = kwargs.get('vpn_package_uri', None) - - -class VnetInfo(ProxyOnlyResource): - """Virtual Network information contract. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_resource_id: The Virtual Network's resource ID. - :type vnet_resource_id: str - :ivar cert_thumbprint: The client certificate thumbprint. - :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a - Point-To-Site VPN connection. - :type cert_blob: str - :ivar routes: The routes that this Virtual Network connection uses. - :vartype routes: list[~azure.mgmt.web.v2018_11_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. - :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. - :type dns_servers: str - :param is_swift: Flag that is used to denote if this is VNET injection - :type is_swift: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'cert_thumbprint': {'readonly': True}, - 'routes': {'readonly': True}, - 'resync_required': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_resource_id': {'key': 'properties.vnetResourceId', 'type': 'str'}, - 'cert_thumbprint': {'key': 'properties.certThumbprint', 'type': 'str'}, - 'cert_blob': {'key': 'properties.certBlob', 'type': 'str'}, - 'routes': {'key': 'properties.routes', 'type': '[VnetRoute]'}, - 'resync_required': {'key': 'properties.resyncRequired', 'type': 'bool'}, - 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, - 'is_swift': {'key': 'properties.isSwift', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(VnetInfo, self).__init__(**kwargs) - self.vnet_resource_id = kwargs.get('vnet_resource_id', None) - self.cert_thumbprint = None - self.cert_blob = kwargs.get('cert_blob', None) - self.routes = None - self.resync_required = None - self.dns_servers = kwargs.get('dns_servers', None) - self.is_swift = kwargs.get('is_swift', None) - - -class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. - :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. - :type end_address: str - :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 - INHERITED - Routes inherited from the real Virtual Network routes - STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' - :type route_type: str or ~azure.mgmt.web.v2018_11_01.models.RouteType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, - 'end_address': {'key': 'properties.endAddress', 'type': 'str'}, - 'route_type': {'key': 'properties.routeType', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VnetRoute, self).__init__(**kwargs) - self.start_address = kwargs.get('start_address', None) - self.end_address = kwargs.get('end_address', None) - self.route_type = kwargs.get('route_type', None) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models_py3.py index 77ef8bba2712..fc22d5cb4d4b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_models_py3.py @@ -1,39 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Dict, List, Optional +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class ApiDefinitionInfo(Model): - """Information about the formal API definition for the app. - :param url: The URL of the API definition. - :type url: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self, *, url: str=None, **kwargs) -> None: - super(ApiDefinitionInfo, self).__init__(**kwargs) - self.url = url - - -class Resource(Model): +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -47,7 +29,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -67,7 +49,14 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -77,331 +66,10 @@ def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> Non self.tags = tags -class AppServicePlan(Resource): - """App Service plan. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param worker_tier_name: Target worker tier assigned to the App Service - plan. - :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' - :vartype status: str or ~azure.mgmt.web.v2018_11_01.models.StatusOptions - :ivar subscription: App Service plan subscription. - :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. - :vartype maximum_number_of_workers: int - :ivar geo_region: Geographical location for the App Service plan. - :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . - :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan - :type maximum_elastic_worker_count: int - :ivar number_of_sites: Number of apps assigned to this App Service plan. - :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. - :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime - :ivar resource_group: Resource group of the App Service plan. - :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . - :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . - :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . - :type hyper_v: bool - :param target_worker_count: Scaling worker count. - :type target_worker_count: int - :param target_worker_size_id: Scaling worker size ID. - :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2018_11_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2018_11_01.models.SkuDescription - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'subscription': {'readonly': True}, - 'maximum_number_of_workers': {'readonly': True}, - 'geo_region': {'readonly': True}, - 'number_of_sites': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, - 'geo_region': {'key': 'properties.geoRegion', 'type': 'str'}, - 'per_site_scaling': {'key': 'properties.perSiteScaling', 'type': 'bool'}, - 'maximum_elastic_worker_count': {'key': 'properties.maximumElasticWorkerCount', 'type': 'int'}, - 'number_of_sites': {'key': 'properties.numberOfSites', 'type': 'int'}, - 'is_spot': {'key': 'properties.isSpot', 'type': 'bool'}, - 'spot_expiration_time': {'key': 'properties.spotExpirationTime', 'type': 'iso-8601'}, - 'free_offer_expiration_time': {'key': 'properties.freeOfferExpirationTime', 'type': 'iso-8601'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'is_xenon': {'key': 'properties.isXenon', 'type': 'bool'}, - 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, - 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, - 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, worker_tier_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, maximum_elastic_worker_count: int=None, is_spot: bool=None, spot_expiration_time=None, free_offer_expiration_time=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: - super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.worker_tier_name = worker_tier_name - self.status = None - self.subscription = None - self.hosting_environment_profile = hosting_environment_profile - self.maximum_number_of_workers = None - self.geo_region = None - self.per_site_scaling = per_site_scaling - self.maximum_elastic_worker_count = maximum_elastic_worker_count - self.number_of_sites = None - self.is_spot = is_spot - self.spot_expiration_time = spot_expiration_time - self.free_offer_expiration_time = free_offer_expiration_time - self.resource_group = None - self.reserved = reserved - self.is_xenon = is_xenon - self.hyper_v = hyper_v - self.target_worker_count = target_worker_count - self.target_worker_size_id = target_worker_size_id - self.provisioning_state = None - self.sku = sku - - -class AutoHealActions(Model): - """Actions which to take by the auto-heal module when a rule is triggered. - - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2018_11_01.models.AutoHealActionType - :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2018_11_01.models.AutoHealCustomAction - :param min_process_execution_time: Minimum time the process must execute - before taking the action - :type min_process_execution_time: str - """ - - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, - 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, - 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, - } - - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: - super(AutoHealActions, self).__init__(**kwargs) - self.action_type = action_type - self.custom_action = custom_action - self.min_process_execution_time = min_process_execution_time - - -class AutoHealCustomAction(Model): - """Custom action to be executed - when an auto heal rule is triggered. - - :param exe: Executable to be run. - :type exe: str - :param parameters: Parameters for the executable. - :type parameters: str - """ - - _attribute_map = { - 'exe': {'key': 'exe', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: - super(AutoHealCustomAction, self).__init__(**kwargs) - self.exe = exe - self.parameters = parameters - - -class AutoHealRules(Model): - """Rules that can be defined for auto-heal. - - :param triggers: Conditions that describe when to execute the auto-heal - actions. - :type triggers: ~azure.mgmt.web.v2018_11_01.models.AutoHealTriggers - :param actions: Actions to be executed when a rule is triggered. - :type actions: ~azure.mgmt.web.v2018_11_01.models.AutoHealActions - """ - - _attribute_map = { - 'triggers': {'key': 'triggers', 'type': 'AutoHealTriggers'}, - 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, - } - - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: - super(AutoHealRules, self).__init__(**kwargs) - self.triggers = triggers - self.actions = actions - - -class AutoHealTriggers(Model): - """Triggers for auto-heal. - - :param requests: A rule based on total requests. - :type requests: ~azure.mgmt.web.v2018_11_01.models.RequestsBasedTrigger - :param private_bytes_in_kb: A rule based on private bytes. - :type private_bytes_in_kb: int - :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2018_11_01.models.StatusCodesBasedTrigger] - :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2018_11_01.models.SlowRequestsBasedTrigger - """ - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'RequestsBasedTrigger'}, - 'private_bytes_in_kb': {'key': 'privateBytesInKB', 'type': 'int'}, - 'status_codes': {'key': 'statusCodes', 'type': '[StatusCodesBasedTrigger]'}, - 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, - } - - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: - super(AutoHealTriggers, self).__init__(**kwargs) - self.requests = requests - self.private_bytes_in_kb = private_bytes_in_kb - self.status_codes = status_codes - self.slow_requests = slow_requests - - -class AzureStorageInfoValue(Model): - """Azure Files or Blob Storage access information value for dictionary - storage. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of storage. Possible values include: 'AzureFiles', - 'AzureBlob' - :type type: str or ~azure.mgmt.web.v2018_11_01.models.AzureStorageType - :param account_name: Name of the storage account. - :type account_name: str - :param share_name: Name of the file share (container name, for Blob - storage). - :type share_name: str - :param access_key: Access key for the storage account. - :type access_key: str - :param mount_path: Path to mount the storage within the site's runtime - environment. - :type mount_path: str - :ivar state: State of the storage account. Possible values include: 'Ok', - 'InvalidCredentials', 'InvalidShare' - :vartype state: str or - ~azure.mgmt.web.v2018_11_01.models.AzureStorageState - """ - - _validation = { - 'state': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'AzureStorageType'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'share_name': {'key': 'shareName', 'type': 'str'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'AzureStorageState'}, - } - - def __init__(self, *, type=None, account_name: str=None, share_name: str=None, access_key: str=None, mount_path: str=None, **kwargs) -> None: - super(AzureStorageInfoValue, self).__init__(**kwargs) - self.type = type - self.account_name = account_name - self.share_name = share_name - self.access_key = access_key - self.mount_path = mount_path - self.state = None - - -class Capability(Model): - """Describes the capabilities/features allowed for a specific SKU. - - :param name: Name of the SKU capability. - :type name: str - :param value: Value of the SKU capability. - :type value: str - :param reason: Reason of the SKU capability. - :type reason: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: - super(Capability, self).__init__(**kwargs) - self.name = name - self.value = value - self.reason = reason - - class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -415,7 +83,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -432,37 +100,35 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_11_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -479,7 +145,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -512,11 +177,24 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, *, location: str, password: str, kind: str=None, tags=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + **kwargs + ): super(Certificate, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.friendly_name = None self.subject_name = None @@ -539,12 +217,44 @@ def __init__(self, *, location: str, password: str, kind: str=None, tags=None, h self.server_farm_id = server_farm_id -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2018_11_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Certificate"], + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -569,7 +279,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -580,10 +295,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class CertificatePatchResource(ProxyOnlyResource): """ARM resource for a certificate. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -608,37 +320,35 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2018_11_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str """ @@ -654,7 +364,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -685,11 +394,22 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, } - def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + **kwargs + ): super(CertificatePatchResource, self).__init__(kind=kind, **kwargs) self.friendly_name = None self.subject_name = None @@ -712,155 +432,13 @@ def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: self.server_farm_id = server_farm_id -class CloningInfo(Model): - """Information needed for cloning operation. - - All required parameters must be populated in order to send to Azure. - - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations - together to use the same snapshot. - :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. - :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. - :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. - :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} - for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} - for other slots. - :type source_web_app_id: str - :param source_web_app_location: Location of source app ex: West US or - North Europe - :type source_web_app_location: str - :param hosting_environment: App Service Environment. - :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. - :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. - :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. - :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. - :type traffic_manager_profile_name: str - """ - - _validation = { - 'source_web_app_id': {'required': True}, - } - - _attribute_map = { - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'overwrite': {'key': 'overwrite', 'type': 'bool'}, - 'clone_custom_host_names': {'key': 'cloneCustomHostNames', 'type': 'bool'}, - 'clone_source_control': {'key': 'cloneSourceControl', 'type': 'bool'}, - 'source_web_app_id': {'key': 'sourceWebAppId', 'type': 'str'}, - 'source_web_app_location': {'key': 'sourceWebAppLocation', 'type': 'str'}, - 'hosting_environment': {'key': 'hostingEnvironment', 'type': 'str'}, - 'app_settings_overrides': {'key': 'appSettingsOverrides', 'type': '{str}'}, - 'configure_load_balancing': {'key': 'configureLoadBalancing', 'type': 'bool'}, - 'traffic_manager_profile_id': {'key': 'trafficManagerProfileId', 'type': 'str'}, - 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, - } - - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, source_web_app_location: str=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, **kwargs) -> None: - super(CloningInfo, self).__init__(**kwargs) - self.correlation_id = correlation_id - self.overwrite = overwrite - self.clone_custom_host_names = clone_custom_host_names - self.clone_source_control = clone_source_control - self.source_web_app_id = source_web_app_id - self.source_web_app_location = source_web_app_location - self.hosting_environment = hosting_environment - self.app_settings_overrides = app_settings_overrides - self.configure_load_balancing = configure_load_balancing - self.traffic_manager_profile_id = traffic_manager_profile_id - self.traffic_manager_profile_name = traffic_manager_profile_name - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class ConnStringInfo(Model): - """Database connection string information. - - :param name: Name of connection string. - :type name: str - :param connection_string: Connection string value. - :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' - :type type: str or ~azure.mgmt.web.v2018_11_01.models.ConnectionStringType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, - } - - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: - super(ConnStringInfo, self).__init__(**kwargs) - self.name = name - self.connection_string = connection_string - self.type = type - - -class CorsSettings(Model): - """Cross-Origin Resource Sharing (CORS) settings for the app. - - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin - calls (for example: http://example.com:12345). Use "*" to allow all. - :type allowed_origins: list[str] - :param support_credentials: Gets or sets whether CORS requests with - credentials are allowed. See - https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials - for more details. - :type support_credentials: bool - """ - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'support_credentials': {'key': 'supportCredentials', 'type': 'bool'}, - } - - def __init__(self, *, allowed_origins=None, support_credentials: bool=None, **kwargs) -> None: - super(CorsSettings, self).__init__(**kwargs) - self.allowed_origins = allowed_origins - self.support_credentials = support_credentials - - -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseError """ _validation = { @@ -871,28 +449,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -901,8 +469,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2018_11_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -922,7 +489,12 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, *, details=None, **kwargs) -> None: + def __init__( + self, + *, + details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -931,11 +503,10 @@ def __init__(self, *, details=None, **kwargs) -> None: self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -957,156 +528,20 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None self.target = None -class DeletedSite(ProxyOnlyResource): - """A deleted app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar deleted_site_id: Numeric id for the deleted site - :vartype deleted_site_id: int - :ivar deleted_timestamp: Time in UTC when the app was deleted. - :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site - :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site - :vartype resource_group: str - :ivar deleted_site_name: Name of the deleted site - :vartype deleted_site_name: str - :ivar slot: Slot of the deleted site - :vartype slot: str - :ivar deleted_site_kind: Kind of site that was deleted - :vartype deleted_site_kind: str - :ivar geo_region_name: Geo Region of the deleted site - :vartype geo_region_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'deleted_site_id': {'readonly': True}, - 'deleted_timestamp': {'readonly': True}, - 'subscription': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'deleted_site_name': {'readonly': True}, - 'slot': {'readonly': True}, - 'deleted_site_kind': {'readonly': True}, - 'geo_region_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'deleted_site_id': {'key': 'properties.deletedSiteId', 'type': 'int'}, - 'deleted_timestamp': {'key': 'properties.deletedTimestamp', 'type': 'str'}, - 'subscription': {'key': 'properties.subscription', 'type': 'str'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'deleted_site_name': {'key': 'properties.deletedSiteName', 'type': 'str'}, - 'slot': {'key': 'properties.slot', 'type': 'str'}, - 'deleted_site_kind': {'key': 'properties.kind', 'type': 'str'}, - 'geo_region_name': {'key': 'properties.geoRegionName', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(DeletedSite, self).__init__(kind=kind, **kwargs) - self.deleted_site_id = None - self.deleted_timestamp = None - self.subscription = None - self.resource_group = None - self.deleted_site_name = None - self.slot = None - self.deleted_site_kind = None - self.geo_region_name = None - - -class Experiments(Model): - """Routing rules in production experiments. - - :param ramp_up_rules: List of ramp-up rules. - :type ramp_up_rules: list[~azure.mgmt.web.v2018_11_01.models.RampUpRule] - """ - - _attribute_map = { - 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, - } - - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: - super(Experiments, self).__init__(**kwargs) - self.ramp_up_rules = ramp_up_rules - - -class GeoDistribution(Model): - """A global distribution definition. - - :param location: Location. - :type location: str - :param number_of_workers: NumberOfWorkers. - :type number_of_workers: int - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - } - - def __init__(self, *, location: str=None, number_of_workers: int=None, **kwargs) -> None: - super(GeoDistribution, self).__init__(**kwargs) - self.location = location - self.number_of_workers = number_of_workers - - -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. - - :param extension: Requests with this extension will be handled using the - specified FastCGI application. - :type extension: str - :param script_processor: The absolute path to the FastCGI application. - :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. - :type arguments: str - """ - - _attribute_map = { - 'extension': {'key': 'extension', 'type': 'str'}, - 'script_processor': {'key': 'scriptProcessor', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': 'str'}, - } - - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: - super(HandlerMapping, self).__init__(**kwargs) - self.extension = extension - self.script_processor = script_processor - self.arguments = arguments - - -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -1127,1624 +562,13 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = id self.name = None self.type = None - - -class HostNameSslState(Model): - """SSL-enabled hostname. - - :param name: Hostname. - :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' - :type ssl_state: str or ~azure.mgmt.web.v2018_11_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. - :type virtual_ip: str - :param thumbprint: SSL certificate thumbprint. - :type thumbprint: str - :param to_update: Set to true to update existing hostname. - :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' - :type host_type: str or ~azure.mgmt.web.v2018_11_01.models.HostType - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, - 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: - super(HostNameSslState, self).__init__(**kwargs) - self.name = name - self.ssl_state = ssl_state - self.virtual_ip = virtual_ip - self.thumbprint = thumbprint - self.to_update = to_update - self.host_type = host_type - - -class HybridConnection(ProxyOnlyResource): - """Hybrid Connection contract. This is used to configure a Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param service_bus_namespace: The name of the Service Bus namespace. - :type service_bus_namespace: str - :param relay_name: The name of the Service Bus relay. - :type relay_name: str - :param relay_arm_uri: The ARM URI to the Service Bus relay. - :type relay_arm_uri: str - :param hostname: The hostname of the endpoint. - :type hostname: str - :param port: The port of the endpoint. - :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. - :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned - normally, use the POST /listKeys API instead. - :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net - :type service_bus_suffix: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'service_bus_namespace': {'key': 'properties.serviceBusNamespace', 'type': 'str'}, - 'relay_name': {'key': 'properties.relayName', 'type': 'str'}, - 'relay_arm_uri': {'key': 'properties.relayArmUri', 'type': 'str'}, - 'hostname': {'key': 'properties.hostname', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: - super(HybridConnection, self).__init__(kind=kind, **kwargs) - self.service_bus_namespace = service_bus_namespace - self.relay_name = relay_name - self.relay_arm_uri = relay_arm_uri - self.hostname = hostname - self.port = port - self.send_key_name = send_key_name - self.send_key_value = send_key_value - self.service_bus_suffix = service_bus_suffix - - -class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar send_key_name: The name of the send key. - :vartype send_key_name: str - :ivar send_key_value: The value of the send key. - :vartype send_key_value: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'send_key_name': {'readonly': True}, - 'send_key_value': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'send_key_name': {'key': 'properties.sendKeyName', 'type': 'str'}, - 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) - self.send_key_name = None - self.send_key_value = None - - -class Identifier(ProxyOnlyResource): - """A domain specific resource identifier. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param identifier_id: String representation of the identity. - :type identifier_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identifier_id': {'key': 'properties.id', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, identifier_id: str=None, **kwargs) -> None: - super(Identifier, self).__init__(kind=kind, **kwargs) - self.identifier_id = identifier_id - - -class IpSecurityRestriction(Model): - """IP security restriction on an app. - - :param ip_address: IP address the security restriction is valid for. - It can be in form of pure ipv4 address (required SubnetMask property) or - CIDR notation such as ipv4/mask (leading bit match). For CIDR, - SubnetMask property must not be specified. - :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. - :type subnet_mask: str - :param vnet_subnet_resource_id: Virtual network resource id - :type vnet_subnet_resource_id: str - :param vnet_traffic_tag: (internal) Vnet traffic tag - :type vnet_traffic_tag: int - :param subnet_traffic_tag: (internal) Subnet traffic tag - :type subnet_traffic_tag: int - :param action: Allow or Deny access for this IP range. - :type action: str - :param tag: Defines what this IP filter will be used for. This is to - support IP filtering on proxies. Possible values include: 'Default', - 'XffProxy' - :type tag: str or ~azure.mgmt.web.v2018_11_01.models.IpFilterTag - :param priority: Priority of IP restriction rule. - :type priority: int - :param name: IP restriction rule name. - :type name: str - :param description: IP restriction rule description. - :type description: str - """ - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, - 'vnet_subnet_resource_id': {'key': 'vnetSubnetResourceId', 'type': 'str'}, - 'vnet_traffic_tag': {'key': 'vnetTrafficTag', 'type': 'int'}, - 'subnet_traffic_tag': {'key': 'subnetTrafficTag', 'type': 'int'}, - 'action': {'key': 'action', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'IpFilterTag'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__(self, *, ip_address: str=None, subnet_mask: str=None, vnet_subnet_resource_id: str=None, vnet_traffic_tag: int=None, subnet_traffic_tag: int=None, action: str=None, tag=None, priority: int=None, name: str=None, description: str=None, **kwargs) -> None: - super(IpSecurityRestriction, self).__init__(**kwargs) - self.ip_address = ip_address - self.subnet_mask = subnet_mask - self.vnet_subnet_resource_id = vnet_subnet_resource_id - self.vnet_traffic_tag = vnet_traffic_tag - self.subnet_traffic_tag = subnet_traffic_tag - self.action = action - self.tag = tag - self.priority = priority - self.name = name - self.description = description - - -class ManagedServiceIdentity(Model): - """Managed service identity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param type: Type of managed service identity. Possible values include: - 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' - :type type: str or - ~azure.mgmt.web.v2018_11_01.models.ManagedServiceIdentityType - :ivar tenant_id: Tenant of managed service identity. - :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. - :vartype principal_id: str - :param user_assigned_identities: The list of user assigned identities - associated with the resource. The user identity dictionary key references - will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} - :type user_assigned_identities: dict[str, - ~azure.mgmt.web.v2018_11_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] - """ - - _validation = { - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, - } - - def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.type = type - self.tenant_id = None - self.principal_id = None - self.user_assigned_identities = user_assigned_identities - - -class ManagedServiceIdentityUserAssignedIdentitiesValue(Model): - """ManagedServiceIdentityUserAssignedIdentitiesValue. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar principal_id: Principal Id of user assigned identity - :vartype principal_id: str - :ivar client_id: Client Id of user assigned 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) -> None: - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class NameValuePair(Model): - """Name value pair. - - :param name: Pair name. - :type name: str - :param value: Pair value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: - super(NameValuePair, self).__init__(**kwargs) - self.name = name - self.value = value - - -class PushSettings(ProxyOnlyResource): - """Push settings for the App. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. - :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. - :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. - Tags can consist of alphanumeric characters and the following: - '_', '@', '#', '.', ':', '-'. - Validation should be performed at the PushRequestHandler. - :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. - :type dynamic_tags_json: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'is_push_enabled': {'key': 'properties.isPushEnabled', 'type': 'bool'}, - 'tag_whitelist_json': {'key': 'properties.tagWhitelistJson', 'type': 'str'}, - 'tags_requiring_auth': {'key': 'properties.tagsRequiringAuth', 'type': 'str'}, - 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, - } - - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: - super(PushSettings, self).__init__(kind=kind, **kwargs) - self.is_push_enabled = is_push_enabled - self.tag_whitelist_json = tag_whitelist_json - self.tags_requiring_auth = tags_requiring_auth - self.dynamic_tags_json = dynamic_tags_json - - -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. - - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. - :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. - :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - MinReroutePercentage or MaxReroutePercentage. - Site metrics are checked every N minutes specified in - ChangeIntervalInMinutes. - Custom decision algorithm can be provided in TiPCallback site extension - which URL can be specified in ChangeDecisionCallbackUrl. - :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. - :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. - :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. - :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ - :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. - :type name: str - """ - - _attribute_map = { - 'action_host_name': {'key': 'actionHostName', 'type': 'str'}, - 'reroute_percentage': {'key': 'reroutePercentage', 'type': 'float'}, - 'change_step': {'key': 'changeStep', 'type': 'float'}, - 'change_interval_in_minutes': {'key': 'changeIntervalInMinutes', 'type': 'int'}, - 'min_reroute_percentage': {'key': 'minReroutePercentage', 'type': 'float'}, - 'max_reroute_percentage': {'key': 'maxReroutePercentage', 'type': 'float'}, - 'change_decision_callback_url': {'key': 'changeDecisionCallbackUrl', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: - super(RampUpRule, self).__init__(**kwargs) - self.action_host_name = action_host_name - self.reroute_percentage = reroute_percentage - self.change_step = change_step - self.change_interval_in_minutes = change_interval_in_minutes - self.min_reroute_percentage = min_reroute_percentage - self.max_reroute_percentage = max_reroute_percentage - self.change_decision_callback_url = change_decision_callback_url - self.name = name - - -class RequestsBasedTrigger(Model): - """Trigger based on total requests. - - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: - super(RequestsBasedTrigger, self).__init__(**kwargs) - self.count = count - self.time_interval = time_interval - - -class ResourceMetricAvailability(Model): - """Metrics availability and retention. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar time_grain: Time grain . - :vartype time_grain: str - :ivar retention: Retention period for the current time grain. - :vartype retention: str - """ - - _validation = { - 'time_grain': {'readonly': True}, - 'retention': {'readonly': True}, - } - - _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'retention': {'key': 'retention', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(ResourceMetricAvailability, self).__init__(**kwargs) - self.time_grain = None - self.retention = None - - -class ResourceMetricDefinition(ProxyOnlyResource): - """Metadata for the metrics. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar unit: Unit of the metric. - :vartype unit: str - :ivar primary_aggregation_type: Primary aggregation type. - :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. - :vartype metric_availabilities: - list[~azure.mgmt.web.v2018_11_01.models.ResourceMetricAvailability] - :ivar resource_uri: Resource URI. - :vartype resource_uri: str - :ivar properties: Resource metric definition properties. - :vartype properties: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'unit': {'readonly': True}, - 'primary_aggregation_type': {'readonly': True}, - 'metric_availabilities': {'readonly': True}, - 'resource_uri': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'primary_aggregation_type': {'key': 'properties.primaryAggregationType', 'type': 'str'}, - 'metric_availabilities': {'key': 'properties.metricAvailabilities', 'type': '[ResourceMetricAvailability]'}, - 'resource_uri': {'key': 'properties.resourceUri', 'type': 'str'}, - 'properties': {'key': 'properties.properties', 'type': '{str}'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) - self.unit = None - self.primary_aggregation_type = None - self.metric_availabilities = None - self.resource_uri = None - self.properties = None - - -class Site(Resource): - """A web app, a mobile app backend, or an API app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :param location: Required. Resource Location. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :ivar state: Current state of the app. - :vartype state: str - :ivar host_names: Hostnames associated with the app. - :vartype host_names: list[str] - :ivar repository_site_name: Name of the repository site. - :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' - :vartype usage_state: str or ~azure.mgmt.web.v2018_11_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). - :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, - the app is not served on those hostnames. - :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2018_11_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2018_11_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: - "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". - :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . - :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . - :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . - :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime - :param site_config: Configuration of the app. - :type site_config: ~azure.mgmt.web.v2018_11_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. - :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . - :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. - :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2018_11_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. - :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. - :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths - :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. - :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. - :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants. Read-only. - :vartype possible_outbound_ip_addresses: str - :param container_size: Size of the function container. - :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). - :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime - :ivar max_number_of_workers: Maximum number of workers. - This only applies to Functions container. - :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. - :type cloning_info: ~azure.mgmt.web.v2018_11_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. - :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. - :vartype is_default_container: bool - :ivar default_host_name: Default hostname of the app. Read-only. - :vartype default_host_name: str - :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2018_11_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests - :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2018_11_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. - :vartype in_progress_operation_id: str - :param geo_distributions: GeoDistributions for this site - :type geo_distributions: - list[~azure.mgmt.web.v2018_11_01.models.GeoDistribution] - :param identity: - :type identity: ~azure.mgmt.web.v2018_11_01.models.ManagedServiceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'host_names': {'readonly': True}, - 'repository_site_name': {'readonly': True}, - 'usage_state': {'readonly': True}, - 'enabled_host_names': {'readonly': True}, - 'availability_state': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'traffic_manager_host_names': {'readonly': True}, - 'target_swap_slot': {'readonly': True}, - 'outbound_ip_addresses': {'readonly': True}, - 'possible_outbound_ip_addresses': {'readonly': True}, - 'suspended_till': {'readonly': True}, - 'max_number_of_workers': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'is_default_container': {'readonly': True}, - 'default_host_name': {'readonly': True}, - 'slot_swap_status': {'readonly': True}, - 'in_progress_operation_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, - 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, - 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, - 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, - 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, - 'is_xenon': {'key': 'properties.isXenon', 'type': 'bool'}, - 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, - 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, - 'site_config': {'key': 'properties.siteConfig', 'type': 'SiteConfig'}, - 'traffic_manager_host_names': {'key': 'properties.trafficManagerHostNames', 'type': '[str]'}, - 'scm_site_also_stopped': {'key': 'properties.scmSiteAlsoStopped', 'type': 'bool'}, - 'target_swap_slot': {'key': 'properties.targetSwapSlot', 'type': 'str'}, - 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, - 'client_affinity_enabled': {'key': 'properties.clientAffinityEnabled', 'type': 'bool'}, - 'client_cert_enabled': {'key': 'properties.clientCertEnabled', 'type': 'bool'}, - 'client_cert_exclusion_paths': {'key': 'properties.clientCertExclusionPaths', 'type': 'str'}, - 'host_names_disabled': {'key': 'properties.hostNamesDisabled', 'type': 'bool'}, - 'outbound_ip_addresses': {'key': 'properties.outboundIpAddresses', 'type': 'str'}, - 'possible_outbound_ip_addresses': {'key': 'properties.possibleOutboundIpAddresses', 'type': 'str'}, - 'container_size': {'key': 'properties.containerSize', 'type': 'int'}, - 'daily_memory_time_quota': {'key': 'properties.dailyMemoryTimeQuota', 'type': 'int'}, - 'suspended_till': {'key': 'properties.suspendedTill', 'type': 'iso-8601'}, - 'max_number_of_workers': {'key': 'properties.maxNumberOfWorkers', 'type': 'int'}, - 'cloning_info': {'key': 'properties.cloningInfo', 'type': 'CloningInfo'}, - 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, - 'is_default_container': {'key': 'properties.isDefaultContainer', 'type': 'bool'}, - 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, - 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, - 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, - 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, - 'geo_distributions': {'key': 'properties.geoDistributions', 'type': '[GeoDistribution]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - } - - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, client_cert_exclusion_paths: str=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, https_only: bool=None, redundancy_mode=None, geo_distributions=None, identity=None, **kwargs) -> None: - super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.state = None - self.host_names = None - self.repository_site_name = None - self.usage_state = None - self.enabled = enabled - self.enabled_host_names = None - self.availability_state = None - self.host_name_ssl_states = host_name_ssl_states - self.server_farm_id = server_farm_id - self.reserved = reserved - self.is_xenon = is_xenon - self.hyper_v = hyper_v - self.last_modified_time_utc = None - self.site_config = site_config - self.traffic_manager_host_names = None - self.scm_site_also_stopped = scm_site_also_stopped - self.target_swap_slot = None - self.hosting_environment_profile = hosting_environment_profile - self.client_affinity_enabled = client_affinity_enabled - self.client_cert_enabled = client_cert_enabled - self.client_cert_exclusion_paths = client_cert_exclusion_paths - self.host_names_disabled = host_names_disabled - self.outbound_ip_addresses = None - self.possible_outbound_ip_addresses = None - self.container_size = container_size - self.daily_memory_time_quota = daily_memory_time_quota - self.suspended_till = None - self.max_number_of_workers = None - self.cloning_info = cloning_info - self.resource_group = None - self.is_default_container = None - self.default_host_name = None - self.slot_swap_status = None - self.https_only = https_only - self.redundancy_mode = redundancy_mode - self.in_progress_operation_id = None - self.geo_distributions = geo_distributions - self.identity = identity - - -class SiteConfig(Model): - """Configuration of an App Service app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param number_of_workers: Number of workers. - :type number_of_workers: int - :param default_documents: Default documents. - :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . - :type net_framework_version: str - :param php_version: Version of PHP. - :type php_version: str - :param python_version: Version of Python. - :type python_version: str - :param node_version: Version of Node.js. - :type node_version: str - :param linux_fx_version: Linux App Framework and version - :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version - :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. - :type request_tracing_enabled: bool - :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. - :type remote_debugging_enabled: bool - :param remote_debugging_version: Remote debugging version. - :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. - :type http_logging_enabled: bool - :param logs_directory_size_limit: HTTP logs directory size limit. - :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. - :type detailed_error_logging_enabled: bool - :param publishing_username: Publishing user name. - :type publishing_username: str - :param app_settings: Application settings. - :type app_settings: list[~azure.mgmt.web.v2018_11_01.models.NameValuePair] - :param azure_storage_accounts: User-provided Azure storage accounts. - :type azure_storage_accounts: dict[str, - ~azure.mgmt.web.v2018_11_01.models.AzureStorageInfoValue] - :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2018_11_01.models.ConnStringInfo] - :ivar machine_key: Site MachineKey. - :vartype machine_key: ~azure.mgmt.web.v2018_11_01.models.SiteMachineKey - :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2018_11_01.models.HandlerMapping] - :param document_root: Document root. - :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO' - :type scm_type: str or ~azure.mgmt.web.v2018_11_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. - :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. - :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. - :type always_on: bool - :param java_version: Java version. - :type java_version: str - :param java_container: Java container. - :type java_container: str - :param java_container_version: Java container version. - :type java_container_version: str - :param app_command_line: App command line to launch. - :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2018_11_01.models.ManagedPipelineMode - :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2018_11_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2018_11_01.models.SiteLoadBalancing - :param experiments: This is work around for polymorphic types. - :type experiments: ~azure.mgmt.web.v2018_11_01.models.Experiments - :param limits: Site limits. - :type limits: ~azure.mgmt.web.v2018_11_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. - :type auto_heal_enabled: bool - :param auto_heal_rules: Auto Heal rules. - :type auto_heal_rules: ~azure.mgmt.web.v2018_11_01.models.AutoHealRules - :param tracing_options: Tracing options. - :type tracing_options: str - :param vnet_name: Virtual Network name. - :type vnet_name: str - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.web.v2018_11_01.models.CorsSettings - :param push: Push endpoint settings. - :type push: ~azure.mgmt.web.v2018_11_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. - :type api_definition: ~azure.mgmt.web.v2018_11_01.models.ApiDefinitionInfo - :param auto_swap_slot_name: Auto-swap slot name. - :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . - :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id - :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id - :type x_managed_service_identity_id: int - :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2018_11_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions: IP security restrictions for scm. - :type scm_ip_security_restrictions: - list[~azure.mgmt.web.v2018_11_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. - :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . - :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2018_11_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' - :type ftps_state: str or ~azure.mgmt.web.v2018_11_01.models.FtpsState - :param reserved_instance_count: Number of reserved instances. - This setting only applies to the Consumption Plan - :type reserved_instance_count: int - """ - - _validation = { - 'machine_key': {'readonly': True}, - 'reserved_instance_count': {'maximum': 10, 'minimum': 0}, - } - - _attribute_map = { - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'default_documents': {'key': 'defaultDocuments', 'type': '[str]'}, - 'net_framework_version': {'key': 'netFrameworkVersion', 'type': 'str'}, - 'php_version': {'key': 'phpVersion', 'type': 'str'}, - 'python_version': {'key': 'pythonVersion', 'type': 'str'}, - 'node_version': {'key': 'nodeVersion', 'type': 'str'}, - 'linux_fx_version': {'key': 'linuxFxVersion', 'type': 'str'}, - 'windows_fx_version': {'key': 'windowsFxVersion', 'type': 'str'}, - 'request_tracing_enabled': {'key': 'requestTracingEnabled', 'type': 'bool'}, - 'request_tracing_expiration_time': {'key': 'requestTracingExpirationTime', 'type': 'iso-8601'}, - 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, - 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, - 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, - 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, - 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, - 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, - 'app_settings': {'key': 'appSettings', 'type': '[NameValuePair]'}, - 'azure_storage_accounts': {'key': 'azureStorageAccounts', 'type': '{AzureStorageInfoValue}'}, - 'connection_strings': {'key': 'connectionStrings', 'type': '[ConnStringInfo]'}, - 'machine_key': {'key': 'machineKey', 'type': 'SiteMachineKey'}, - 'handler_mappings': {'key': 'handlerMappings', 'type': '[HandlerMapping]'}, - 'document_root': {'key': 'documentRoot', 'type': 'str'}, - 'scm_type': {'key': 'scmType', 'type': 'str'}, - 'use32_bit_worker_process': {'key': 'use32BitWorkerProcess', 'type': 'bool'}, - 'web_sockets_enabled': {'key': 'webSocketsEnabled', 'type': 'bool'}, - 'always_on': {'key': 'alwaysOn', 'type': 'bool'}, - 'java_version': {'key': 'javaVersion', 'type': 'str'}, - 'java_container': {'key': 'javaContainer', 'type': 'str'}, - 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, - 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, - 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, - 'experiments': {'key': 'experiments', 'type': 'Experiments'}, - 'limits': {'key': 'limits', 'type': 'SiteLimits'}, - 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, - 'auto_heal_rules': {'key': 'autoHealRules', 'type': 'AutoHealRules'}, - 'tracing_options': {'key': 'tracingOptions', 'type': 'str'}, - 'vnet_name': {'key': 'vnetName', 'type': 'str'}, - 'cors': {'key': 'cors', 'type': 'CorsSettings'}, - 'push': {'key': 'push', 'type': 'PushSettings'}, - 'api_definition': {'key': 'apiDefinition', 'type': 'ApiDefinitionInfo'}, - 'auto_swap_slot_name': {'key': 'autoSwapSlotName', 'type': 'str'}, - 'local_my_sql_enabled': {'key': 'localMySqlEnabled', 'type': 'bool'}, - 'managed_service_identity_id': {'key': 'managedServiceIdentityId', 'type': 'int'}, - 'x_managed_service_identity_id': {'key': 'xManagedServiceIdentityId', 'type': 'int'}, - 'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'scm_ip_security_restrictions': {'key': 'scmIpSecurityRestrictions', 'type': '[IpSecurityRestriction]'}, - 'scm_ip_security_restrictions_use_main': {'key': 'scmIpSecurityRestrictionsUseMain', 'type': 'bool'}, - 'http20_enabled': {'key': 'http20Enabled', 'type': 'bool'}, - 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, - 'ftps_state': {'key': 'ftpsState', 'type': 'str'}, - 'reserved_instance_count': {'key': 'reservedInstanceCount', 'type': 'int'}, - } - - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, linux_fx_version: str=None, windows_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, azure_storage_accounts=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, managed_service_identity_id: int=None, x_managed_service_identity_id: int=None, ip_security_restrictions=None, scm_ip_security_restrictions=None, scm_ip_security_restrictions_use_main: bool=None, http20_enabled: bool=True, min_tls_version=None, ftps_state=None, reserved_instance_count: int=None, **kwargs) -> None: - super(SiteConfig, self).__init__(**kwargs) - self.number_of_workers = number_of_workers - self.default_documents = default_documents - self.net_framework_version = net_framework_version - self.php_version = php_version - self.python_version = python_version - self.node_version = node_version - self.linux_fx_version = linux_fx_version - self.windows_fx_version = windows_fx_version - self.request_tracing_enabled = request_tracing_enabled - self.request_tracing_expiration_time = request_tracing_expiration_time - self.remote_debugging_enabled = remote_debugging_enabled - self.remote_debugging_version = remote_debugging_version - self.http_logging_enabled = http_logging_enabled - self.logs_directory_size_limit = logs_directory_size_limit - self.detailed_error_logging_enabled = detailed_error_logging_enabled - self.publishing_username = publishing_username - self.app_settings = app_settings - self.azure_storage_accounts = azure_storage_accounts - self.connection_strings = connection_strings - self.machine_key = None - self.handler_mappings = handler_mappings - self.document_root = document_root - self.scm_type = scm_type - self.use32_bit_worker_process = use32_bit_worker_process - self.web_sockets_enabled = web_sockets_enabled - self.always_on = always_on - self.java_version = java_version - self.java_container = java_container - self.java_container_version = java_container_version - self.app_command_line = app_command_line - self.managed_pipeline_mode = managed_pipeline_mode - self.virtual_applications = virtual_applications - self.load_balancing = load_balancing - self.experiments = experiments - self.limits = limits - self.auto_heal_enabled = auto_heal_enabled - self.auto_heal_rules = auto_heal_rules - self.tracing_options = tracing_options - self.vnet_name = vnet_name - self.cors = cors - self.push = push - self.api_definition = api_definition - self.auto_swap_slot_name = auto_swap_slot_name - self.local_my_sql_enabled = local_my_sql_enabled - self.managed_service_identity_id = managed_service_identity_id - self.x_managed_service_identity_id = x_managed_service_identity_id - self.ip_security_restrictions = ip_security_restrictions - self.scm_ip_security_restrictions = scm_ip_security_restrictions - self.scm_ip_security_restrictions_use_main = scm_ip_security_restrictions_use_main - self.http20_enabled = http20_enabled - self.min_tls_version = min_tls_version - self.ftps_state = ftps_state - self.reserved_instance_count = reserved_instance_count - - -class SiteLimits(Model): - """Metric limits set on an app. - - :param max_percentage_cpu: Maximum allowed CPU usage percentage. - :type max_percentage_cpu: float - :param max_memory_in_mb: Maximum allowed memory usage in MB. - :type max_memory_in_mb: long - :param max_disk_size_in_mb: Maximum allowed disk size usage in MB. - :type max_disk_size_in_mb: long - """ - - _attribute_map = { - 'max_percentage_cpu': {'key': 'maxPercentageCpu', 'type': 'float'}, - 'max_memory_in_mb': {'key': 'maxMemoryInMb', 'type': 'long'}, - 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, - } - - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: - super(SiteLimits, self).__init__(**kwargs) - self.max_percentage_cpu = max_percentage_cpu - self.max_memory_in_mb = max_memory_in_mb - self.max_disk_size_in_mb = max_disk_size_in_mb - - -class SiteMachineKey(Model): - """MachineKey of an app. - - :param validation: MachineKey validation. - :type validation: str - :param validation_key: Validation key. - :type validation_key: str - :param decryption: Algorithm used for decryption. - :type decryption: str - :param decryption_key: Decryption key. - :type decryption_key: str - """ - - _attribute_map = { - 'validation': {'key': 'validation', 'type': 'str'}, - 'validation_key': {'key': 'validationKey', 'type': 'str'}, - 'decryption': {'key': 'decryption', 'type': 'str'}, - 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, - } - - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: - super(SiteMachineKey, self).__init__(**kwargs) - self.validation = validation - self.validation_key = validation_key - self.decryption = decryption - self.decryption_key = decryption_key - - -class SkuCapacity(Model): - """Description of the App Service plan scale options. - - :param minimum: Minimum number of workers for this App Service plan SKU. - :type minimum: int - :param maximum: Maximum number of workers for this App Service plan SKU. - :type maximum: int - :param default: Default number of workers for this App Service plan SKU. - :type default: int - :param scale_type: Available scale configurations for an App Service plan. - :type scale_type: str - """ - - _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=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuDescription(Model): - """Description of a SKU for a scalable resource. - - :param name: Name of the resource SKU. - :type name: str - :param tier: Service tier of the resource SKU. - :type tier: str - :param size: Size specifier of the resource SKU. - :type size: str - :param family: Family code of the resource SKU. - :type family: str - :param capacity: Current number of instances assigned to the resource. - :type capacity: int - :param sku_capacity: Min, max, and default scale values of the SKU. - :type sku_capacity: ~azure.mgmt.web.v2018_11_01.models.SkuCapacity - :param locations: Locations of the SKU. - :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? - :type capabilities: list[~azure.mgmt.web.v2018_11_01.models.Capability] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'sku_capacity': {'key': 'skuCapacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, - } - - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: - super(SkuDescription, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - self.sku_capacity = sku_capacity - self.locations = locations - self.capabilities = capabilities - - -class SlotSwapStatus(Model): - """The status of the last successful slot swap operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime - :ivar source_slot_name: The source slot of the last swap operation. - :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. - :vartype destination_slot_name: str - """ - - _validation = { - 'timestamp_utc': {'readonly': True}, - 'source_slot_name': {'readonly': True}, - 'destination_slot_name': {'readonly': True}, - } - - _attribute_map = { - 'timestamp_utc': {'key': 'timestampUtc', 'type': 'iso-8601'}, - 'source_slot_name': {'key': 'sourceSlotName', 'type': 'str'}, - 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(SlotSwapStatus, self).__init__(**kwargs) - self.timestamp_utc = None - self.source_slot_name = None - self.destination_slot_name = None - - -class SlowRequestsBasedTrigger(Model): - """Trigger based on request execution time. - - :param time_taken: Time taken. - :type time_taken: str - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'time_taken': {'key': 'timeTaken', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: - super(SlowRequestsBasedTrigger, self).__init__(**kwargs) - self.time_taken = time_taken - self.count = count - self.time_interval = time_interval - - -class Snapshot(ProxyOnlyResource): - """A snapshot of an app. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar time: The time the snapshot was taken. - :vartype time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'time': {'key': 'properties.time', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(Snapshot, self).__init__(kind=kind, **kwargs) - self.time = None - - -class StatusCodesBasedTrigger(Model): - """Trigger based on status code. - - :param status: HTTP status code. - :type status: int - :param sub_status: Request Sub Status. - :type sub_status: int - :param win32_status: Win32 error code. - :type win32_status: int - :param count: Request Count. - :type count: int - :param time_interval: Time interval. - :type time_interval: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'int'}, - 'sub_status': {'key': 'subStatus', 'type': 'int'}, - 'win32_status': {'key': 'win32Status', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'time_interval': {'key': 'timeInterval', 'type': 'str'}, - } - - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: - super(StatusCodesBasedTrigger, self).__init__(**kwargs) - self.status = status - self.sub_status = sub_status - self.win32_status = win32_status - self.count = count - self.time_interval = time_interval - - -class User(ProxyOnlyResource): - """User credentials used for publishing activity. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param publishing_user_name: Required. Username used for publishing. - :type publishing_user_name: str - :param publishing_password: Password used for publishing. - :type publishing_password: str - :param publishing_password_hash: Password hash used for publishing. - :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. - :type publishing_password_hash_salt: str - :param scm_uri: Url of SCM site. - :type scm_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'publishing_user_name': {'key': 'properties.publishingUserName', 'type': 'str'}, - 'publishing_password': {'key': 'properties.publishingPassword', 'type': 'str'}, - 'publishing_password_hash': {'key': 'properties.publishingPasswordHash', 'type': 'str'}, - 'publishing_password_hash_salt': {'key': 'properties.publishingPasswordHashSalt', 'type': 'str'}, - 'scm_uri': {'key': 'properties.scmUri', 'type': 'str'}, - } - - def __init__(self, *, publishing_user_name: str, kind: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, scm_uri: str=None, **kwargs) -> None: - super(User, self).__init__(kind=kind, **kwargs) - self.publishing_user_name = publishing_user_name - self.publishing_password = publishing_password - self.publishing_password_hash = publishing_password_hash - self.publishing_password_hash_salt = publishing_password_hash_salt - self.scm_uri = scm_uri - - -class VirtualApplication(Model): - """Virtual application in an app. - - :param virtual_path: Virtual path. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. - :type preload_enabled: bool - :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2018_11_01.models.VirtualDirectory] - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - 'preload_enabled': {'key': 'preloadEnabled', 'type': 'bool'}, - 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, - } - - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: - super(VirtualApplication, self).__init__(**kwargs) - self.virtual_path = virtual_path - self.physical_path = physical_path - self.preload_enabled = preload_enabled - self.virtual_directories = virtual_directories - - -class VirtualDirectory(Model): - """Directory for virtual application. - - :param virtual_path: Path to virtual application. - :type virtual_path: str - :param physical_path: Physical path. - :type physical_path: str - """ - - _attribute_map = { - 'virtual_path': {'key': 'virtualPath', 'type': 'str'}, - 'physical_path': {'key': 'physicalPath', 'type': 'str'}, - } - - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: - super(VirtualDirectory, self).__init__(**kwargs) - self.virtual_path = virtual_path - self.physical_path = physical_path - - -class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_name: The Virtual Network name. - :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. - :type vpn_package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, - 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, - } - - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: - super(VnetGateway, self).__init__(kind=kind, **kwargs) - self.vnet_name = vnet_name - self.vpn_package_uri = vpn_package_uri - - -class VnetInfo(ProxyOnlyResource): - """Virtual Network information contract. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param vnet_resource_id: The Virtual Network's resource ID. - :type vnet_resource_id: str - :ivar cert_thumbprint: The client certificate thumbprint. - :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a - Point-To-Site VPN connection. - :type cert_blob: str - :ivar routes: The routes that this Virtual Network connection uses. - :vartype routes: list[~azure.mgmt.web.v2018_11_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. - :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. - :type dns_servers: str - :param is_swift: Flag that is used to denote if this is VNET injection - :type is_swift: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'cert_thumbprint': {'readonly': True}, - 'routes': {'readonly': True}, - 'resync_required': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vnet_resource_id': {'key': 'properties.vnetResourceId', 'type': 'str'}, - 'cert_thumbprint': {'key': 'properties.certThumbprint', 'type': 'str'}, - 'cert_blob': {'key': 'properties.certBlob', 'type': 'str'}, - 'routes': {'key': 'properties.routes', 'type': '[VnetRoute]'}, - 'resync_required': {'key': 'properties.resyncRequired', 'type': 'bool'}, - 'dns_servers': {'key': 'properties.dnsServers', 'type': 'str'}, - 'is_swift': {'key': 'properties.isSwift', 'type': 'bool'}, - } - - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: str=None, dns_servers: str=None, is_swift: bool=None, **kwargs) -> None: - super(VnetInfo, self).__init__(kind=kind, **kwargs) - self.vnet_resource_id = vnet_resource_id - self.cert_thumbprint = None - self.cert_blob = cert_blob - self.routes = None - self.resync_required = None - self.dns_servers = dns_servers - self.is_swift = is_swift - - -class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. - :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. - :type end_address: str - :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 - INHERITED - Routes inherited from the real Virtual Network routes - STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' - :type route_type: str or ~azure.mgmt.web.v2018_11_01.models.RouteType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_address': {'key': 'properties.startAddress', 'type': 'str'}, - 'end_address': {'key': 'properties.endAddress', 'type': 'str'}, - 'route_type': {'key': 'properties.routeType', 'type': 'str'}, - } - - def __init__(self, *, kind: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: - super(VnetRoute, self).__init__(kind=kind, **kwargs) - self.start_address = start_address - self.end_address = end_address - self.route_type = route_type diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_web_site_management_client_enums.py index 13703438d9ea..ccf3cfda0398 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_web_site_management_client_enums.py @@ -1,180 +1,43 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class KeyVaultSecretStatus(str, Enum): - - initialized = "Initialized" - waiting_on_certificate_order = "WaitingOnCertificateOrder" - succeeded = "Succeeded" - certificate_order_failed = "CertificateOrderFailed" - operation_not_permitted_on_key_vault = "OperationNotPermittedOnKeyVault" - azure_service_unauthorized_to_access_key_vault = "AzureServiceUnauthorizedToAccessKeyVault" - key_vault_does_not_exist = "KeyVaultDoesNotExist" - key_vault_secret_does_not_exist = "KeyVaultSecretDoesNotExist" - unknown_error = "UnknownError" - external_private_key = "ExternalPrivateKey" - unknown = "Unknown" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned, UserAssigned" - none = "None" - - -class IpFilterTag(str, Enum): - - default = "Default" - xff_proxy = "XffProxy" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class AzureStorageType(str, Enum): - - azure_files = "AzureFiles" - azure_blob = "AzureBlob" - - -class AzureStorageState(str, Enum): - - ok = "Ok" - invalid_credentials = "InvalidCredentials" - invalid_share = "InvalidShare" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class FtpsState(str, Enum): - - all_allowed = "AllAllowed" - ftps_only = "FtpsOnly" - disabled = "Disabled" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class RedundancyMode(str, Enum): - - none = "None" - manual = "Manual" - failover = "Failover" - active_active = "ActiveActive" - geo_redundant = "GeoRedundant" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 KeyVaultSecretStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Key Vault secret. + """ + + INITIALIZED = "Initialized" + WAITING_ON_CERTIFICATE_ORDER = "WaitingOnCertificateOrder" + SUCCEEDED = "Succeeded" + CERTIFICATE_ORDER_FAILED = "CertificateOrderFailed" + OPERATION_NOT_PERMITTED_ON_KEY_VAULT = "OperationNotPermittedOnKeyVault" + AZURE_SERVICE_UNAUTHORIZED_TO_ACCESS_KEY_VAULT = "AzureServiceUnauthorizedToAccessKeyVault" + KEY_VAULT_DOES_NOT_EXIST = "KeyVaultDoesNotExist" + KEY_VAULT_SECRET_DOES_NOT_EXIST = "KeyVaultSecretDoesNotExist" + UNKNOWN_ERROR = "UnknownError" + EXTERNAL_PRIVATE_KEY = "ExternalPrivateKey" + UNKNOWN = "Unknown" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/__init__.py index 4ae1c5953295..d364847de656 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._certificates_operations import CertificatesOperations diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py index f17fd25713ea..17ed637ef12a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py @@ -1,439 +1,433 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2018_11_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. - :ivar api_version: API Version. Constant value: "2018-11-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-11-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates for a subscription. Get all certificates for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2018_11_01.models.CertificatePaged[~azure.mgmt.web.v2018_11_01.models.Certificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_11_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates in a resource group. Get all certificates in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2018_11_01.models.CertificatePaged[~azure.mgmt.web.v2018_11_01.models.Certificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2018_11_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Get a certificate. Get a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def create_or_update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.Certificate" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2018_11_01.models.Certificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_11_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a certificate. Delete a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + 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, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.CertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2018_11_01.models.CertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2018_11_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2018_11_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/__init__.py index 55c66f839cff..45c59c58316a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import WebSiteManagementClientConfiguration from ._web_site_management_client import WebSiteManagementClient -__all__ = ['WebSiteManagementClient', 'WebSiteManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['WebSiteManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py index b96e0933169e..e4c16b761c60 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py @@ -1,49 +1,72 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +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 WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. -class WebSiteManagementClientConfiguration(AzureConfiguration): - """Configuration for WebSiteManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(WebSiteManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(WebSiteManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-web/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2019-08-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json new file mode 100644 index 000000000000..dd60bcfe8d6d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json @@ -0,0 +1,264 @@ +{ + "chosen_version": "2019-08-01", + "total_api_version_list": ["2019-08-01"], + "client": { + "name": "WebSiteManagementClient", + "filename": "_web_site_management_client", + "description": "WebSite Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + "app_service_certificate_orders": "AppServiceCertificateOrdersOperations", + "certificate_registration_provider": "CertificateRegistrationProviderOperations", + "domains": "DomainsOperations", + "top_level_domains": "TopLevelDomainsOperations", + "domain_registration_provider": "DomainRegistrationProviderOperations", + "certificates": "CertificatesOperations", + "deleted_web_apps": "DeletedWebAppsOperations", + "diagnostics": "DiagnosticsOperations", + "provider": "ProviderOperations", + "recommendations": "RecommendationsOperations", + "web_apps": "WebAppsOperations", + "static_sites": "StaticSitesOperations", + "app_service_environments": "AppServiceEnvironmentsOperations", + "app_service_plans": "AppServicePlansOperations", + "resource_health_metadata": "ResourceHealthMetadataOperations" + }, + "operation_mixins": { + "get_publishing_user" : { + "sync": { + "signature": "def get_publishing_user(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets publishing user.\n\nDescription for Gets publishing user.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_publishing_user(\n self,\n **kwargs\n) -\u003e \"models.User\":\n", + "doc": "\"\"\"Gets publishing user.\n\nDescription for Gets publishing user.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "update_publishing_user" : { + "sync": { + "signature": "def update_publishing_user(\n self,\n user_details, # type: \"models.User\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates publishing user.\n\nDescription for Updates publishing user.\n\n:param user_details: Details of publishing user.\n:type user_details: ~azure.mgmt.web.v2019_08_01.models.User\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_publishing_user(\n self,\n user_details: \"models.User\",\n **kwargs\n) -\u003e \"models.User\":\n", + "doc": "\"\"\"Updates publishing user.\n\nDescription for Updates publishing user.\n\n:param user_details: Details of publishing user.\n:type user_details: ~azure.mgmt.web.v2019_08_01.models.User\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: User, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.User\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "user_details" + }, + "list_source_controls" : { + "sync": { + "signature": "def list_source_controls(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the source controls available for Azure websites.\n\nDescription for Gets the source controls available for Azure websites.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SourceControlCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SourceControlCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_source_controls(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SourceControlCollection\"]:\n", + "doc": "\"\"\"Gets the source controls available for Azure websites.\n\nDescription for Gets the source controls available for Azure websites.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SourceControlCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SourceControlCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "get_source_control" : { + "sync": { + "signature": "def get_source_control(\n self,\n source_control_type, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets source control token.\n\nDescription for Gets source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_source_control(\n self,\n source_control_type: str,\n **kwargs\n) -\u003e \"models.SourceControl\":\n", + "doc": "\"\"\"Gets source control token.\n\nDescription for Gets source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "source_control_type" + }, + "update_source_control" : { + "sync": { + "signature": "def update_source_control(\n self,\n source_control_type, # type: str\n request_message, # type: \"models.SourceControl\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates source control token.\n\nDescription for Updates source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:param request_message: Source control token information.\n:type request_message: ~azure.mgmt.web.v2019_08_01.models.SourceControl\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_source_control(\n self,\n source_control_type: str,\n request_message: \"models.SourceControl\",\n **kwargs\n) -\u003e \"models.SourceControl\":\n", + "doc": "\"\"\"Updates source control token.\n\nDescription for Updates source control token.\n\n:param source_control_type: Type of source control.\n:type source_control_type: str\n:param request_message: Source control token information.\n:type request_message: ~azure.mgmt.web.v2019_08_01.models.SourceControl\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SourceControl, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "source_control_type, request_message" + }, + "list_billing_meters" : { + "sync": { + "signature": "def list_billing_meters(\n self,\n billing_location=None, # type: Optional[str]\n os_type=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets a list of meters for a given location.\n\nDescription for Gets a list of meters for a given location.\n\n:param billing_location: Azure Location of billable resource.\n:type billing_location: str\n:param os_type: App Service OS type meters used for.\n:type os_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BillingMeterCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeterCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_billing_meters(\n self,\n billing_location: Optional[str] = None,\n os_type: Optional[str] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.BillingMeterCollection\"]:\n", + "doc": "\"\"\"Gets a list of meters for a given location.\n\nDescription for Gets a list of meters for a given location.\n\n:param billing_location: Azure Location of billable resource.\n:type billing_location: str\n:param os_type: App Service OS type meters used for.\n:type os_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BillingMeterCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeterCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "billing_location, os_type" + }, + "check_name_availability" : { + "sync": { + "signature": "def check_name_availability(\n self,\n name, # type: str\n type, # type: Union[str, \"models.CheckNameResourceTypes\"]\n is_fqdn=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Check if a resource name is available.\n\nDescription for Check if a resource name is available.\n\n:param name: Resource name to verify.\n:type name: str\n:param type: Resource type used for verification.\n:type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes\n:param is_fqdn: Is fully qualified domain name.\n:type is_fqdn: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceNameAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_name_availability(\n self,\n name: str,\n type: Union[str, \"models.CheckNameResourceTypes\"],\n is_fqdn: Optional[bool] = None,\n **kwargs\n) -\u003e \"models.ResourceNameAvailability\":\n", + "doc": "\"\"\"Check if a resource name is available.\n\nDescription for Check if a resource name is available.\n\n:param name: Resource name to verify.\n:type name: str\n:param type: Resource type used for verification.\n:type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes\n:param is_fqdn: Is fully qualified domain name.\n:type is_fqdn: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceNameAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "name, type, is_fqdn" + }, + "get_subscription_deployment_locations" : { + "sync": { + "signature": "def get_subscription_deployment_locations(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets list of available geo regions plus ministamps.\n\nDescription for Gets list of available geo regions plus ministamps.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeploymentLocations, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_subscription_deployment_locations(\n self,\n **kwargs\n) -\u003e \"models.DeploymentLocations\":\n", + "doc": "\"\"\"Gets list of available geo regions plus ministamps.\n\nDescription for Gets list of available geo regions plus ministamps.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeploymentLocations, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "list_geo_regions" : { + "sync": { + "signature": "def list_geo_regions(\n self,\n sku=None, # type: Optional[Union[str, \"models.SkuName\"]]\n linux_workers_enabled=None, # type: Optional[bool]\n xenon_workers_enabled=None, # type: Optional[bool]\n linux_dynamic_workers_enabled=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get a list of available geographical regions.\n\nDescription for Get a list of available geographical regions.\n\n:param sku: Name of SKU used to filter the regions.\n:type sku: str or ~azure.mgmt.web.v2019_08_01.models.SkuName\n:param linux_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Linux workers.\n:type linux_workers_enabled: bool\n:param xenon_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Xenon workers.\n:type xenon_workers_enabled: bool\n:param linux_dynamic_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter\n to only regions that support Linux Consumption Workers.\n:type linux_dynamic_workers_enabled: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either GeoRegionCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegionCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_geo_regions(\n self,\n sku: Optional[Union[str, \"models.SkuName\"]] = None,\n linux_workers_enabled: Optional[bool] = None,\n xenon_workers_enabled: Optional[bool] = None,\n linux_dynamic_workers_enabled: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.GeoRegionCollection\"]:\n", + "doc": "\"\"\"Get a list of available geographical regions.\n\nDescription for Get a list of available geographical regions.\n\n:param sku: Name of SKU used to filter the regions.\n:type sku: str or ~azure.mgmt.web.v2019_08_01.models.SkuName\n:param linux_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Linux workers.\n:type linux_workers_enabled: bool\n:param xenon_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter to only\n regions that support Xenon workers.\n:type xenon_workers_enabled: bool\n:param linux_dynamic_workers_enabled: Specify :code:`\u003ccode\u003etrue\u003c/code\u003e` if you want to filter\n to only regions that support Linux Consumption Workers.\n:type linux_dynamic_workers_enabled: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either GeoRegionCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegionCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "sku, linux_workers_enabled, xenon_workers_enabled, linux_dynamic_workers_enabled" + }, + "list_site_identifiers_assigned_to_host_name" : { + "sync": { + "signature": "def list_site_identifiers_assigned_to_host_name(\n self,\n name_identifier, # type: \"models.NameIdentifier\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all apps that are assigned to a hostname.\n\nDescription for List all apps that are assigned to a hostname.\n\n:param name_identifier: Hostname information.\n:type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either IdentifierCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_site_identifiers_assigned_to_host_name(\n self,\n name_identifier: \"models.NameIdentifier\",\n **kwargs\n) -\u003e AsyncItemPaged[\"models.IdentifierCollection\"]:\n", + "doc": "\"\"\"List all apps that are assigned to a hostname.\n\nDescription for List all apps that are assigned to a hostname.\n\n:param name_identifier: Hostname information.\n:type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either IdentifierCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "name_identifier" + }, + "list_premier_add_on_offers" : { + "sync": { + "signature": "def list_premier_add_on_offers(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all premier add-on offers.\n\nDescription for List all premier add-on offers.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_premier_add_on_offers(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PremierAddOnOfferCollection\"]:\n", + "doc": "\"\"\"List all premier add-on offers.\n\nDescription for List all premier add-on offers.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferCollection]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "list_skus" : { + "sync": { + "signature": "def list_skus(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all SKUs.\n\nDescription for List all SKUs.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuInfos, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def list_skus(\n self,\n **kwargs\n) -\u003e \"models.SkuInfos\":\n", + "doc": "\"\"\"List all SKUs.\n\nDescription for List all SKUs.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuInfos, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "verify_hosting_environment_vnet" : { + "sync": { + "signature": "def verify_hosting_environment_vnet(\n self,\n parameters, # type: \"models.VnetParameters\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.\n\nDescription for Verifies if this VNET is compatible with an App Service Environment by\nanalyzing the Network Security Group rules.\n\n:param parameters: VNET information.\n:type parameters: ~azure.mgmt.web.v2019_08_01.models.VnetParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VnetValidationFailureDetails, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def verify_hosting_environment_vnet(\n self,\n parameters: \"models.VnetParameters\",\n **kwargs\n) -\u003e \"models.VnetValidationFailureDetails\":\n", + "doc": "\"\"\"Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.\n\nDescription for Verifies if this VNET is compatible with an App Service Environment by\nanalyzing the Network Security Group rules.\n\n:param parameters: VNET information.\n:type parameters: ~azure.mgmt.web.v2019_08_01.models.VnetParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VnetValidationFailureDetails, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "parameters" + }, + "move" : { + "sync": { + "signature": "def move(\n self,\n resource_group_name, # type: str\n move_resource_envelope, # type: \"models.CsmMoveResourceEnvelope\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Move resources between resource groups.\n\nDescription for Move resources between resource groups.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def move(\n self,\n resource_group_name: str,\n move_resource_envelope: \"models.CsmMoveResourceEnvelope\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Move resources between resource groups.\n\nDescription for Move resources between resource groups.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, move_resource_envelope" + }, + "validate" : { + "sync": { + "signature": "def validate(\n self,\n resource_group_name, # type: str\n validate_request, # type: \"models.ValidateRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate if a resource can be created.\n\nDescription for Validate if a resource can be created.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_request: Request with the resources to validate.\n:type validate_request: ~azure.mgmt.web.v2019_08_01.models.ValidateRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate(\n self,\n resource_group_name: str,\n validate_request: \"models.ValidateRequest\",\n **kwargs\n) -\u003e \"models.ValidateResponse\":\n", + "doc": "\"\"\"Validate if a resource can be created.\n\nDescription for Validate if a resource can be created.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param validate_request: Request with the resources to validate.\n:type validate_request: ~azure.mgmt.web.v2019_08_01.models.ValidateRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, validate_request" + }, + "validate_move" : { + "sync": { + "signature": "def validate_move(\n self,\n resource_group_name, # type: str\n move_resource_envelope, # type: \"models.CsmMoveResourceEnvelope\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Validate whether a resource can be moved.\n\nDescription for Validate whether a resource can be moved.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate_move(\n self,\n resource_group_name: str,\n move_resource_envelope: \"models.CsmMoveResourceEnvelope\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Validate whether a resource can be moved.\n\nDescription for Validate whether a resource can be moved.\n\n:param resource_group_name: Name of the resource group to which the resource belongs.\n:type resource_group_name: str\n:param move_resource_envelope: Object that represents the resource to move.\n:type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, move_resource_envelope" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" +} \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py new file mode 100644 index 000000000000..5c14e0d8303d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_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 = "0.42.0" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py index f02d0132faa8..c1b706667583 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py @@ -1,19 +1,23 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import 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 ._configuration import WebSiteManagementClientConfiguration -from .operations import WebSiteManagementClientOperationsMixin from .operations import AppServiceCertificateOrdersOperations from .operations import CertificateRegistrationProviderOperations from .operations import DomainsOperations @@ -24,6 +28,7 @@ from .operations import DiagnosticsOperations from .operations import ProviderOperations from .operations import RecommendationsOperations +from .operations import WebSiteManagementClientOperationsMixin from .operations import WebAppsOperations from .operations import StaticSitesOperations from .operations import AppServiceEnvironmentsOperations @@ -32,90 +37,104 @@ from . import models -class WebSiteManagementClient(WebSiteManagementClientOperationsMixin, SDKClient): - """WebSite Management Client - - :ivar config: Configuration for client. - :vartype config: WebSiteManagementClientConfiguration +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): + """WebSite Management Client. - :ivar app_service_certificate_orders: AppServiceCertificateOrders operations + :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations :vartype app_service_certificate_orders: azure.mgmt.web.v2019_08_01.operations.AppServiceCertificateOrdersOperations - :ivar certificate_registration_provider: CertificateRegistrationProvider operations + :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations :vartype certificate_registration_provider: azure.mgmt.web.v2019_08_01.operations.CertificateRegistrationProviderOperations - :ivar domains: Domains operations + :ivar domains: DomainsOperations operations :vartype domains: azure.mgmt.web.v2019_08_01.operations.DomainsOperations - :ivar top_level_domains: TopLevelDomains operations + :ivar top_level_domains: TopLevelDomainsOperations operations :vartype top_level_domains: azure.mgmt.web.v2019_08_01.operations.TopLevelDomainsOperations - :ivar domain_registration_provider: DomainRegistrationProvider operations + :ivar domain_registration_provider: DomainRegistrationProviderOperations operations :vartype domain_registration_provider: azure.mgmt.web.v2019_08_01.operations.DomainRegistrationProviderOperations - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.web.v2019_08_01.operations.CertificatesOperations - :ivar deleted_web_apps: DeletedWebApps operations + :ivar deleted_web_apps: DeletedWebAppsOperations operations :vartype deleted_web_apps: azure.mgmt.web.v2019_08_01.operations.DeletedWebAppsOperations - :ivar diagnostics: Diagnostics operations + :ivar diagnostics: DiagnosticsOperations operations :vartype diagnostics: azure.mgmt.web.v2019_08_01.operations.DiagnosticsOperations - :ivar provider: Provider operations + :ivar provider: ProviderOperations operations :vartype provider: azure.mgmt.web.v2019_08_01.operations.ProviderOperations - :ivar recommendations: Recommendations operations + :ivar recommendations: RecommendationsOperations operations :vartype recommendations: azure.mgmt.web.v2019_08_01.operations.RecommendationsOperations - :ivar web_apps: WebApps operations + :ivar web_apps: WebAppsOperations operations :vartype web_apps: azure.mgmt.web.v2019_08_01.operations.WebAppsOperations - :ivar static_sites: StaticSites operations + :ivar static_sites: StaticSitesOperations operations :vartype static_sites: azure.mgmt.web.v2019_08_01.operations.StaticSitesOperations - :ivar app_service_environments: AppServiceEnvironments operations + :ivar app_service_environments: AppServiceEnvironmentsOperations operations :vartype app_service_environments: azure.mgmt.web.v2019_08_01.operations.AppServiceEnvironmentsOperations - :ivar app_service_plans: AppServicePlans operations + :ivar app_service_plans: AppServicePlansOperations operations :vartype app_service_plans: azure.mgmt.web.v2019_08_01.operations.AppServicePlansOperations - :ivar resource_health_metadata: ResourceHealthMetadata operations + :ivar resource_health_metadata: ResourceHealthMetadataOperations operations :vartype resource_health_metadata: azure.mgmt.web.v2019_08_01.operations.ResourceHealthMetadataOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Your Azure subscription ID. This is a - GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = WebSiteManagementClientConfiguration(credentials, subscription_id, base_url) - super(WebSiteManagementClient, self).__init__(self.config.credentials, self.config) + 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 = WebSiteManagementClientConfiguration(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.api_version = '2019-08-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.app_service_certificate_orders = AppServiceCertificateOrdersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificate_registration_provider = CertificateRegistrationProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.domains = DomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.top_level_domains = TopLevelDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.domain_registration_provider = DomainRegistrationProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deleted_web_apps = DeletedWebAppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.diagnostics = DiagnosticsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.provider = ProviderOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.recommendations = RecommendationsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.web_apps = WebAppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.static_sites = StaticSitesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.app_service_environments = AppServiceEnvironmentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.app_service_plans = AppServicePlansOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.resource_health_metadata = ResourceHealthMetadataOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebSiteManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py new file mode 100644 index 000000000000..cc8f3cf28fcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._web_site_management_client_async import WebSiteManagementClient +__all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py new file mode 100644 index 000000000000..4610981e0e40 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WebSiteManagementClientConfiguration(Configuration): + """Configuration for WebSiteManagementClient. + + 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: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> 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(WebSiteManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-08-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py new file mode 100644 index 000000000000..3082f2d27363 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +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 ._configuration_async import WebSiteManagementClientConfiguration +from .operations_async import AppServiceCertificateOrdersOperations +from .operations_async import CertificateRegistrationProviderOperations +from .operations_async import DomainsOperations +from .operations_async import TopLevelDomainsOperations +from .operations_async import DomainRegistrationProviderOperations +from .operations_async import CertificatesOperations +from .operations_async import DeletedWebAppsOperations +from .operations_async import DiagnosticsOperations +from .operations_async import ProviderOperations +from .operations_async import RecommendationsOperations +from .operations_async import WebSiteManagementClientOperationsMixin +from .operations_async import WebAppsOperations +from .operations_async import StaticSitesOperations +from .operations_async import AppServiceEnvironmentsOperations +from .operations_async import AppServicePlansOperations +from .operations_async import ResourceHealthMetadataOperations +from .. import models + + +class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): + """WebSite Management Client. + + :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations + :vartype app_service_certificate_orders: azure.mgmt.web.v2019_08_01.aio.operations_async.AppServiceCertificateOrdersOperations + :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations + :vartype certificate_registration_provider: azure.mgmt.web.v2019_08_01.aio.operations_async.CertificateRegistrationProviderOperations + :ivar domains: DomainsOperations operations + :vartype domains: azure.mgmt.web.v2019_08_01.aio.operations_async.DomainsOperations + :ivar top_level_domains: TopLevelDomainsOperations operations + :vartype top_level_domains: azure.mgmt.web.v2019_08_01.aio.operations_async.TopLevelDomainsOperations + :ivar domain_registration_provider: DomainRegistrationProviderOperations operations + :vartype domain_registration_provider: azure.mgmt.web.v2019_08_01.aio.operations_async.DomainRegistrationProviderOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.web.v2019_08_01.aio.operations_async.CertificatesOperations + :ivar deleted_web_apps: DeletedWebAppsOperations operations + :vartype deleted_web_apps: azure.mgmt.web.v2019_08_01.aio.operations_async.DeletedWebAppsOperations + :ivar diagnostics: DiagnosticsOperations operations + :vartype diagnostics: azure.mgmt.web.v2019_08_01.aio.operations_async.DiagnosticsOperations + :ivar provider: ProviderOperations operations + :vartype provider: azure.mgmt.web.v2019_08_01.aio.operations_async.ProviderOperations + :ivar recommendations: RecommendationsOperations operations + :vartype recommendations: azure.mgmt.web.v2019_08_01.aio.operations_async.RecommendationsOperations + :ivar web_apps: WebAppsOperations operations + :vartype web_apps: azure.mgmt.web.v2019_08_01.aio.operations_async.WebAppsOperations + :ivar static_sites: StaticSitesOperations operations + :vartype static_sites: azure.mgmt.web.v2019_08_01.aio.operations_async.StaticSitesOperations + :ivar app_service_environments: AppServiceEnvironmentsOperations operations + :vartype app_service_environments: azure.mgmt.web.v2019_08_01.aio.operations_async.AppServiceEnvironmentsOperations + :ivar app_service_plans: AppServicePlansOperations operations + :vartype app_service_plans: azure.mgmt.web.v2019_08_01.aio.operations_async.AppServicePlansOperations + :ivar resource_health_metadata: ResourceHealthMetadataOperations operations + :vartype resource_health_metadata: azure.mgmt.web.v2019_08_01.aio.operations_async.ResourceHealthMetadataOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = WebSiteManagementClientConfiguration(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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificate_registration_provider = CertificateRegistrationProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.domains = DomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.top_level_domains = TopLevelDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.domain_registration_provider = DomainRegistrationProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deleted_web_apps = DeletedWebAppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostics = DiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.provider = ProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.recommendations = RecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_apps = WebAppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.static_sites = StaticSitesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.app_service_environments = AppServiceEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.app_service_plans = AppServicePlansOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_health_metadata = ResourceHealthMetadataOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebSiteManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..812a44e55525 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_service_certificate_orders_operations_async import AppServiceCertificateOrdersOperations +from ._certificate_registration_provider_operations_async import CertificateRegistrationProviderOperations +from ._domains_operations_async import DomainsOperations +from ._top_level_domains_operations_async import TopLevelDomainsOperations +from ._domain_registration_provider_operations_async import DomainRegistrationProviderOperations +from ._certificates_operations_async import CertificatesOperations +from ._deleted_web_apps_operations_async import DeletedWebAppsOperations +from ._diagnostics_operations_async import DiagnosticsOperations +from ._provider_operations_async import ProviderOperations +from ._recommendations_operations_async import RecommendationsOperations +from ._web_site_management_client_operations_async import WebSiteManagementClientOperationsMixin +from ._web_apps_operations_async import WebAppsOperations +from ._static_sites_operations_async import StaticSitesOperations +from ._app_service_environments_operations_async import AppServiceEnvironmentsOperations +from ._app_service_plans_operations_async import AppServicePlansOperations +from ._resource_health_metadata_operations_async import ResourceHealthMetadataOperations + +__all__ = [ + 'AppServiceCertificateOrdersOperations', + 'CertificateRegistrationProviderOperations', + 'DomainsOperations', + 'TopLevelDomainsOperations', + 'DomainRegistrationProviderOperations', + 'CertificatesOperations', + 'DeletedWebAppsOperations', + 'DiagnosticsOperations', + 'ProviderOperations', + 'RecommendationsOperations', + 'WebSiteManagementClientOperationsMixin', + 'WebAppsOperations', + 'StaticSitesOperations', + 'AppServiceEnvironmentsOperations', + 'AppServicePlansOperations', + 'ResourceHealthMetadataOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py new file mode 100644 index 000000000000..fb71809824fc --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py @@ -0,0 +1,1419 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServiceCertificateOrdersOperations: + """AppServiceCertificateOrdersOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateOrderCollection"]: + """List all certificate orders in a subscription. + + Description for List all certificate orders 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 AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('AppServiceCertificateOrderCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore + + async def validate_purchase_information( + self, + app_service_certificate_order: "models.AppServiceCertificateOrder", + **kwargs + ) -> None: + """Validate information for a certificate order. + + Description for Validate information for a certificate order. + + :param app_service_certificate_order: Information for a certificate order. + :type app_service_certificate_order: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_purchase_information.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateOrderCollection"]: + """Get certificate orders in a resource group. + + Description for Get certificate orders in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServiceCertificateOrderCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore + + async def get( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> "models.AppServiceCertificateOrder": + """Get a certificate order. + + Description for Get a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order.. + :type certificate_order_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrder", + **kwargs + ) -> "models.AppServiceCertificateOrder": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrder", + **kwargs + ) -> AsyncLROPoller["models.AppServiceCertificateOrder"]: + """Create or update a certificate purchase order. + + Description for Create or update a certificate purchase order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceCertificateOrder or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + lro_delay = kwargs.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, + certificate_order_name=certificate_order_name, + certificate_distinguished_name=certificate_distinguished_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Delete an existing certificate order. + + Description for Delete an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + certificate_order_name: str, + certificate_distinguished_name: "models.AppServiceCertificateOrderPatchResource", + **kwargs + ) -> "models.AppServiceCertificateOrder": + """Create or update a certificate purchase order. + + Description for Create or update a certificate purchase order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + def list_certificates( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceCertificateCollection"]: + """List all certificates associated with a certificate order. + + Description for List all certificates associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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: + 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('AppServiceCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} # type: ignore + + async def get_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + **kwargs + ) -> "models.AppServiceCertificateResource": + """Get the certificate associated with a certificate order. + + Description for Get the certificate associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def _create_or_update_certificate_initial( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificateResource", + **kwargs + ) -> "models.AppServiceCertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def begin_create_or_update_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificateResource", + **kwargs + ) -> AsyncLROPoller["models.AppServiceCertificateResource"]: + """Creates or updates a certificate and associates with key vault secret. + + Description for Creates or updates a certificate and associates with key vault secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :param key_vault_certificate: Key vault certificate resource Id. + :type key_vault_certificate: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceCertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + lro_delay = kwargs.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_certificate_initial( + resource_group_name=resource_group_name, + certificate_order_name=certificate_order_name, + name=name, + key_vault_certificate=key_vault_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def delete_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + **kwargs + ) -> None: + """Delete the certificate associated with a certificate order. + + Description for Delete the certificate associated with a certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def update_certificate( + self, + resource_group_name: str, + certificate_order_name: str, + name: str, + key_vault_certificate: "models.AppServiceCertificatePatchResource", + **kwargs + ) -> "models.AppServiceCertificateResource": + """Creates or updates a certificate and associates with key vault secret. + + Description for Creates or updates a certificate and associates with key vault secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name: Name of the certificate. + :type name: str + :param key_vault_certificate: Key vault certificate resource Id. + :type key_vault_certificate: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + async def reissue( + self, + resource_group_name: str, + certificate_order_name: str, + reissue_certificate_order_request: "models.ReissueCertificateOrderRequest", + **kwargs + ) -> None: + """Reissue an existing certificate order. + + Description for Reissue an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param reissue_certificate_order_request: Parameters for the reissue. + :type reissue_certificate_order_request: ~azure.mgmt.web.v2019_08_01.models.ReissueCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.reissue.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} # type: ignore + + async def renew( + self, + resource_group_name: str, + certificate_order_name: str, + renew_certificate_order_request: "models.RenewCertificateOrderRequest", + **kwargs + ) -> None: + """Renew an existing certificate order. + + Description for Renew an existing certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param renew_certificate_order_request: Renew parameters. + :type renew_certificate_order_request: ~azure.mgmt.web.v2019_08_01.models.RenewCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.renew.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} # type: ignore + + async def resend_email( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Resend certificate email. + + Description for Resend certificate email. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.resend_email.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} # type: ignore + + async def resend_request_emails( + self, + resource_group_name: str, + certificate_order_name: str, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> None: + """Verify domain ownership for this certificate order. + + Description for Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param name_identifier: Email address. + :type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.resend_request_emails.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} # type: ignore + + async def retrieve_site_seal( + self, + resource_group_name: str, + certificate_order_name: str, + site_seal_request: "models.SiteSealRequest", + **kwargs + ) -> "models.SiteSeal": + """Verify domain ownership for this certificate order. + + Description for Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_name: str + :param site_seal_request: Site seal request. + :type site_seal_request: ~azure.mgmt.web.v2019_08_01.models.SiteSealRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSeal, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSeal + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.retrieve_site_seal.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteSeal', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} # type: ignore + + async def verify_domain_ownership( + self, + resource_group_name: str, + certificate_order_name: str, + **kwargs + ) -> None: + """Verify domain ownership for this certificate order. + + Description for Verify domain ownership for this certificate order. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param certificate_order_name: Name of the certificate order. + :type certificate_order_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.verify_domain_ownership.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} # type: ignore + + async def retrieve_certificate_actions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.CertificateOrderAction"]: + """Retrieve the list of certificate actions. + + Description for Retrieve the list of certificate actions. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate order. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateOrderAction, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.CertificateOrderAction] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.retrieve_certificate_actions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[CertificateOrderAction]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} # type: ignore + + async def retrieve_certificate_email_history( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.CertificateEmail"]: + """Retrieve email history. + + Description for Retrieve email history. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate order. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateEmail, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.CertificateEmail] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[CertificateEmail]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py new file mode 100644 index 000000000000..7035f240c3d0 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py @@ -0,0 +1,3093 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServiceEnvironmentsOperations: + """AppServiceEnvironmentsOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AppServiceEnvironmentCollection"]: + """Get all App Service Environments for a subscription. + + Description for Get all App Service Environments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('AppServiceEnvironmentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServiceEnvironmentCollection"]: + """Get all App Service Environments in a resource group. + + Description for Get all App Service Environments in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServiceEnvironmentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AppServiceEnvironmentResource": + """Get the properties of an App Service Environment. + + Description for Get the properties of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentResource", + **kwargs + ) -> "models.AppServiceEnvironmentResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentResource", + **kwargs + ) -> AsyncLROPoller["models.AppServiceEnvironmentResource"]: + """Create or update an App Service Environment. + + Description for Create or update an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServiceEnvironmentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + lro_delay = kwargs.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, + name=name, + hosting_environment_envelope=hosting_environment_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/hostingEnvironments/{name}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + name: str, + force_delete: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if force_delete is not None: + query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + name: str, + force_delete: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete an App Service Environment. + + Description for Delete an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param force_delete: Specify :code:`true` to force the deletion even if the App + Service Environment contains resources. The default is :code:`false`. + :type force_delete: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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, + name=name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + hosting_environment_envelope: "models.AppServiceEnvironmentPatchResource", + **kwargs + ) -> "models.AppServiceEnvironmentResource": + """Create or update an App Service Environment. + + Description for Create or update an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def list_capacities( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.StampCapacityCollection"]: + """Get the used, available, and total worker capacity an App Service Environment. + + Description for Get the used, available, and total worker capacity an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StampCapacityCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StampCapacityCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_capacities.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('StampCapacityCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} # type: ignore + + async def get_vip_info( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AddressResponse": + """Get IP addresses assigned to an App Service Environment. + + Description for Get IP addresses assigned to an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AddressResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vip_info.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AddressResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vip_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} # type: ignore + + async def _change_vnet_initial( + self, + resource_group_name: str, + name: str, + vnet_info: "models.VirtualNetworkProfile", + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._change_vnet_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _change_vnet_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore + + async def begin_change_vnet( + self, + resource_group_name: str, + name: str, + vnet_info: "models.VirtualNetworkProfile", + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Move an App Service Environment to a different VNET. + + Description for Move an App Service Environment to a different VNET. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param vnet_info: Details for the new virtual network. + :type vnet_info: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.change_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._change_vnet_initial( + resource_group_name=resource_group_name, + name=name, + vnet_info=vnet_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_change_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore + + async def list_diagnostics( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.HostingEnvironmentDiagnostics"]: + """Get diagnostic information for an App Service Environment. + + Description for Get diagnostic information for an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDiagnostics] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_diagnostics.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} # type: ignore + + async def get_diagnostics_item( + self, + resource_group_name: str, + name: str, + diagnostics_name: str, + **kwargs + ) -> "models.HostingEnvironmentDiagnostics": + """Get a diagnostics item for an App Service Environment. + + Description for Get a diagnostics item for an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param diagnostics_name: Name of the diagnostics item. + :type diagnostics_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDiagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_diagnostics_item.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} # type: ignore + + def get_inbound_network_dependencies_endpoints( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.InboundEnvironmentEndpointCollection"]: + """Get the network endpoints of all inbound dependencies of an App Service Environment. + + Description for Get the network endpoints of all inbound dependencies of an App Service + Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.InboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_inbound_network_dependencies_endpoints.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('InboundEnvironmentEndpointCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_inbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints'} # type: ignore + + def list_multi_role_pools( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WorkerPoolCollection"]: + """Get all multi-role pools. + + Description for Get all multi-role pools. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pools.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WorkerPoolCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} # type: ignore + + async def get_multi_role_pool( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WorkerPoolResource": + """Get properties of a multi-role pool. + + Description for Get properties of a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_multi_role_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def _create_or_update_multi_role_pool_initial( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> "models.WorkerPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def begin_create_or_update_multi_role_pool( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> AsyncLROPoller["models.WorkerPoolResource"]: + """Create or update a multi-role pool. + + Description for Create or update a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param multi_role_pool_envelope: Properties of the multi-role pool. + :type multi_role_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.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_multi_role_pool_initial( + resource_group_name=resource_group_name, + name=name, + multi_role_pool_envelope=multi_role_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + async def update_multi_role_pool( + self, + resource_group_name: str, + name: str, + multi_role_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> "models.WorkerPoolResource": + """Create or update a multi-role pool. + + Description for Create or update a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param multi_role_pool_envelope: Properties of the multi-role pool. + :type multi_role_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_multi_role_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + def list_multi_role_pool_instance_metric_definitions( + self, + resource_group_name: str, + name: str, + instance: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + + Description for Get metric definitions for a specific instance of a multi-role pool of an App + Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param instance: Name of the instance in the multi-role pool. + :type instance: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} # type: ignore + + def list_multi_role_metric_definitions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a multi-role pool of an App Service Environment. + + Description for Get metric definitions for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} # type: ignore + + def list_multi_role_pool_skus( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SkuInfoCollection"]: + """Get available SKUs for scaling a multi-role pool. + + Description for Get available SKUs for scaling a multi-role pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_pool_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SkuInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} # type: ignore + + def list_multi_role_usages( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.UsageCollection"]: + """Get usage metrics for a multi-role pool of an App Service Environment. + + Description for Get usage metrics for a multi-role pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_multi_role_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('UsageCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} # type: ignore + + async def list_operations( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.Operation"]: + """List all currently running operations on the App Service Environment. + + Description for List all currently running operations on the App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Operation, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.Operation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_operations.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[Operation]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} # type: ignore + + def get_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.OutboundEnvironmentEndpointCollection"]: + """Get the network endpoints of all outbound dependencies of an App Service Environment. + + Description for Get the network endpoints of all outbound dependencies of an App Service + Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.OutboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('OutboundEnvironmentEndpointCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints'} # type: ignore + + async def reboot( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Reboot all machines in an App Service Environment. + + Description for Reboot all machines in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reboot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} # type: ignore + + async def _resume_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._resume_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + async def begin_resume( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Resume an App Service Environment. + + Description for Resume an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.resume.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._resume_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + def list_app_service_plans( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans in an App Service Environment. + + Description for Get all App Service plans in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_app_service_plans.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} # type: ignore + + def list_web_apps( + self, + resource_group_name: str, + name: str, + properties_to_include: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps in an App Service Environment. + + Description for Get all apps in an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param properties_to_include: Comma separated list of app properties to include. + :type properties_to_include: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if properties_to_include is not None: + query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} # type: ignore + + async def _suspend_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.WebAppCollection": + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._suspend_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WebAppCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + async def begin_suspend( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller[AsyncItemPaged["models.WebAppCollection"]]: + """Suspend an App Service Environment. + + Description for Suspend an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.suspend.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._suspend_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return await get_next(next_link) + + return AsyncItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Get global usage metrics of an App Service Environment. + + Description for Get global usage metrics of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} # type: ignore + + def list_worker_pools( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WorkerPoolCollection"]: + """Get all worker pools of an App Service Environment. + + Description for Get all worker pools of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pools.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WorkerPoolCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} # type: ignore + + async def get_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> "models.WorkerPoolResource": + """Get properties of a worker pool. + + Description for Get properties of a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_worker_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def _create_or_update_worker_pool_initial( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> "models.WorkerPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def begin_create_or_update_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> AsyncLROPoller["models.WorkerPoolResource"]: + """Create or update a worker pool. + + Description for Create or update a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param worker_pool_envelope: Properties of the worker pool. + :type worker_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.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_worker_pool_initial( + resource_group_name=resource_group_name, + name=name, + worker_pool_name=worker_pool_name, + worker_pool_envelope=worker_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + async def update_worker_pool( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + worker_pool_envelope: "models.WorkerPoolResource", + **kwargs + ) -> "models.WorkerPoolResource": + """Create or update a worker pool. + + Description for Create or update a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param worker_pool_envelope: Properties of the worker pool. + :type worker_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_worker_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + def list_worker_pool_instance_metric_definitions( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + instance: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + Description for Get metric definitions for a specific instance of a worker pool of an App + Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :param instance: Name of the instance in the worker pool. + :type instance: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_instance_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + 'instance': self._serialize.url("instance", instance, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} # type: ignore + + def list_web_worker_metric_definitions( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceMetricDefinitionCollection"]: + """Get metric definitions for a worker pool of an App Service Environment. + + Description for Get metric definitions for a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_metric_definitions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('ResourceMetricDefinitionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} # type: ignore + + def list_worker_pool_skus( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.SkuInfoCollection"]: + """Get available SKUs for scaling a worker pool. + + Description for Get available SKUs for scaling a worker pool. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_worker_pool_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('SkuInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} # type: ignore + + def list_web_worker_usages( + self, + resource_group_name: str, + name: str, + worker_pool_name: str, + **kwargs + ) -> AsyncIterable["models.UsageCollection"]: + """Get usage metrics for a worker pool of an App Service Environment. + + Description for Get usage metrics for a worker pool of an App Service Environment. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service Environment. + :type name: str + :param worker_pool_name: Name of the worker pool. + :type worker_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_worker_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), + '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: + 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('UsageCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py new file mode 100644 index 000000000000..f7bf2e477dcb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py @@ -0,0 +1,1920 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppServicePlansOperations: + """AppServicePlansOperations 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.web.v2019_08_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 + + def list( + self, + detailed: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans for a subscription. + + Description for Get all App Service plans for a subscription. + + :param detailed: Specify :code:`true` to return all App Service plan properties. + The default is :code:`false`, which returns a subset of the properties. + Retrieval of all properties may increase the API latency. + :type detailed: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if detailed is not None: + query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AppServicePlanCollection"]: + """Get all App Service plans in a resource group. + + Description for Get all App Service plans in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('AppServicePlanCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.AppServicePlan"]: + """Get an App Service plan. + + Description for Get an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlan", + **kwargs + ) -> "models.AppServicePlan": + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_plan, 'AppServicePlan') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlan", + **kwargs + ) -> AsyncLROPoller["models.AppServicePlan"]: + """Creates or updates an App Service Plan. + + Description for Creates or updates an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param app_service_plan: Details of the App Service plan. + :type app_service_plan: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppServicePlan or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + lro_delay = kwargs.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, + name=name, + app_service_plan=app_service_plan, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/serverfarms/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete an App Service plan. + + Description for Delete an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + app_service_plan: "models.AppServicePlanPatchResource", + **kwargs + ) -> "models.AppServicePlan": + """Creates or updates an App Service Plan. + + Description for Creates or updates an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param app_service_plan: Details of the App Service plan. + :type app_service_plan: ~azure.mgmt.web.v2019_08_01.models.AppServicePlanPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + async def list_capabilities( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.Capability"]: + """List all capabilities of an App Service plan. + + Description for List all capabilities of an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Capability, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.Capability] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_capabilities.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[Capability]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} # type: ignore + + async def get_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieve a Hybrid Connection in use in an App Service plan. + + Description for Retrieve a Hybrid Connection in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: Name of the Service Bus relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> None: + """Delete a Hybrid Connection in use in an App Service plan. + + Description for Delete a Hybrid Connection in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: Name of the Service Bus relay. + :type relay_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connection_keys( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnectionKey": + """Get the send key name and value of a Hybrid Connection. + + Description for Get the send key name and value of a Hybrid Connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: The name of the Service Bus namespace. + :type namespace_name: str + :param relay_name: The name of the Service Bus relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore + + def list_web_apps_by_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceCollection"]: + """Get all apps that use a Hybrid Connection in an App Service Plan. + + Description for Get all apps that use a Hybrid Connection in an App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param namespace_name: Name of the Hybrid Connection namespace. + :type namespace_name: str + :param relay_name: Name of the Hybrid Connection relay. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps_by_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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: + 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('ResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} # type: ignore + + async def get_hybrid_connection_plan_limit( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HybridConnectionLimits": + """Get the maximum number of Hybrid Connections allowed in an App Service plan. + + Description for Get the maximum number of Hybrid Connections allowed in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionLimits, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnectionLimits + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnectionLimits', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} # type: ignore + + def list_hybrid_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.HybridConnectionCollection"]: + """Retrieve all Hybrid Connections in use in an App Service plan. + + Description for Retrieve all Hybrid Connections in use in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridConnectionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.HybridConnectionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_hybrid_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('HybridConnectionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} # type: ignore + + async def restart_web_apps( + self, + resource_group_name: str, + name: str, + soft_restart: Optional[bool] = None, + **kwargs + ) -> None: + """Restart all apps in an App Service plan. + + Description for Restart all apps in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param soft_restart: Specify :code:`true` to perform a soft restart, applies the + configuration settings and restarts the apps if necessary. The default is + :code:`false`, which always restarts and reprovisions the apps. + :type soft_restart: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.restart_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} # type: ignore + + def list_web_apps( + self, + resource_group_name: str, + name: str, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps associated with an App Service plan. + + Description for Get all apps associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param skip_token: Skip to a web app in the list of webapps associated with app service plan. + If specified, the resulting list will contain web apps starting from (including) the skipToken. + Otherwise, the resulting list contains web apps from the start of the list. + :type skip_token: str + :param filter: Supported filter: $filter=state eq running. Returns only web apps that are + currently running. + :type filter: str + :param top: List page size. If specified, results are paged. + :type top: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_apps.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} # type: ignore + + async def get_server_farm_skus( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> object: + """Gets all selectable SKUs for a given App Service Plan. + + Description for Gets all selectable SKUs for a given App Service Plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of App Service Plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_server_farm_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets server farm usage information. + + Description for Gets server farm usage information. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of App Service Plan. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} # type: ignore + + async def list_vnets( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Get all Virtual Networks associated with an App Service plan. + + Description for Get all Virtual Networks associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_vnets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_from_server_farm( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> Optional["models.VnetInfo"]: + """Get a Virtual Network associated with an App Service plan. + + Description for Get a Virtual Network associated with an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + **kwargs + ) -> "models.VnetGateway": + """Get a Virtual Network gateway. + + Description for Get a Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vnet_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Update a Virtual Network gateway. + + Description for Update a Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. + :type gateway_name: str + :param connection_envelope: Definition of the gateway. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def list_routes_for_vnet( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> List["models.VnetRoute"]: + """Get all routes that are associated with a Virtual Network in an App Service plan. + + Description for Get all routes that are associated with a Virtual Network in an App Service + plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_routes_for_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetRoute]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} # type: ignore + + async def get_route_for_vnet( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + **kwargs + ) -> Optional[List["models.VnetRoute"]]: + """Get a Virtual Network route in an App Service plan. + + Description for Get a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_route_for_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('[VnetRoute]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def create_or_update_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + route: "models.VnetRoute", + **kwargs + ) -> Optional["models.VnetRoute"]: + """Create or update a Virtual Network route in an App Service plan. + + Description for Create or update a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :param route: Definition of the Virtual Network route. + :type route: ~azure.mgmt.web.v2019_08_01.models.VnetRoute + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(route, 'VnetRoute') + 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, 400, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VnetRoute', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def delete_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + **kwargs + ) -> None: + """Delete a Virtual Network route in an App Service plan. + + Description for Delete a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def update_vnet_route( + self, + resource_group_name: str, + name: str, + vnet_name: str, + route_name: str, + route: "models.VnetRoute", + **kwargs + ) -> Optional["models.VnetRoute"]: + """Create or update a Virtual Network route in an App Service plan. + + Description for Create or update a Virtual Network route in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param route_name: Name of the Virtual Network route. + :type route_name: str + :param route: Definition of the Virtual Network route. + :type route: ~azure.mgmt.web.v2019_08_01.models.VnetRoute + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_route.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'routeName': self._serialize.url("route_name", route_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(route, 'VnetRoute') + 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, 400, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VnetRoute', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore + + async def reboot_worker( + self, + resource_group_name: str, + name: str, + worker_name: str, + **kwargs + ) -> None: + """Reboot a worker machine in an App Service plan. + + Description for Reboot a worker machine in an App Service plan. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the App Service plan. + :type name: str + :param worker_name: Name of worker machine, which typically starts with RD. + :type worker_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reboot_worker.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'workerName': self._serialize.url("worker_name", worker_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py new file mode 100644 index 000000000000..a2630a2addbb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificateRegistrationProviderOperations: + """CertificateRegistrationProviderOperations 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.web.v2019_08_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 + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Description for Implements Csm operations Api to exposes the list of available Csm Apis under + the resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py new file mode 100644 index 000000000000..7c4b86ec7a3a --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py @@ -0,0 +1,424 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates for a subscription. + + Description for Get all certificates for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.CertificateCollection"]: + """Get all certificates in a resource group. + + Description for Get all certificates in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 CertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('CertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.Certificate": + """Get a certificate. + + Description for Get a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.Certificate", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Description for Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2019_08_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'Certificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Delete a certificate. + + Description for Delete a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + certificate_envelope: "models.CertificatePatchResource", + **kwargs + ) -> "models.Certificate": + """Create or update a certificate. + + Description for Create or update a certificate. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the certificate. + :type name: str + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2019_08_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py new file mode 100644 index 000000000000..79f534337ead --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeletedWebAppsOperations: + """DeletedWebAppsOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DeletedWebAppCollection"]: + """Get all deleted apps for a subscription. + + Description for Get all deleted apps for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('DeletedWebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} # type: ignore + + def list_by_location( + self, + location: str, + **kwargs + ) -> AsyncIterable["models.DeletedWebAppCollection"]: + """Get all deleted apps for a subscription at location. + + Description for Get all deleted apps for a subscription at location. + + :param location: + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + '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: + 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('DeletedWebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites'} # type: ignore + + async def get_deleted_web_app_by_location( + self, + location: str, + deleted_site_id: str, + **kwargs + ) -> "models.DeletedSite": + """Get deleted app for a subscription at location. + + Description for Get deleted app for a subscription at location. + + :param location: + :type location: str + :param deleted_site_id: The numeric ID of the deleted app, e.g. 12345. + :type deleted_site_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSite, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DeletedSite + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'deletedSiteId': self._serialize.url("deleted_site_id", deleted_site_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedSite', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted_web_app_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py new file mode 100644 index 000000000000..95bc752dc353 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py @@ -0,0 +1,1708 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticsOperations: + """DiagnosticsOperations 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.web.v2019_08_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 + + def list_hosting_environment_detector_responses( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Hosting Environment Detector Responses. + + Description for List Hosting Environment Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_hosting_environment_detector_responses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} # type: ignore + + async def get_hosting_environment_detector_response( + self, + resource_group_name: str, + name: str, + detector_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get Hosting Environment Detector Response. + + Description for Get Hosting Environment Detector Response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: App Service Environment Name. + :type name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} # type: ignore + + def list_site_detector_responses( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Site Detector Responses. + + Description for List Site Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detector_responses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} # type: ignore + + async def get_site_detector_response( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get site detector response. + + Description for Get site detector response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_detector_response.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} # type: ignore + + def list_site_diagnostic_categories( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticCategoryCollection"]: + """Get Diagnostics Categories. + + Description for Get Diagnostics Categories. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_diagnostic_categories.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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: + 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('DiagnosticCategoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} # type: ignore + + async def get_site_diagnostic_category( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> "models.DiagnosticCategory": + """Get Diagnostics Category. + + Description for Get Diagnostics Category. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_diagnostic_category.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} # type: ignore + + def list_site_analyses( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticAnalysisCollection"]: + """Get Site Analyses. + + Description for Get Site Analyses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_analyses.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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: + 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('DiagnosticAnalysisCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore + + async def get_site_analysis( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + **kwargs + ) -> "models.AnalysisDefinition": + """Get Site Analysis. + + Description for Get Site Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param analysis_name: Analysis Name. + :type analysis_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_analysis.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AnalysisDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore + + async def execute_site_analysis( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Execute Analysis. + + Description for Execute Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param analysis_name: Analysis Resource Name. + :type analysis_name: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.execute_site_analysis.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore + + def list_site_detectors( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detectors. + + Description for Get Detectors. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detectors.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore + + async def get_site_detector( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + detector_name: str, + **kwargs + ) -> "models.DetectorDefinition": + """Get Detector. + + Description for Get Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param detector_name: Detector Name. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_detector.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore + + async def execute_site_detector( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + diagnostic_category: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticDetectorResponse": + """Execute Detector. + + Description for Execute Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.execute_site_detector.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore + + def list_site_detector_responses_slot( + self, + resource_group_name: str, + site_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DetectorResponseCollection"]: + """List Site Detector Responses. + + Description for List Site Detector Responses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detector_responses_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DetectorResponseCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} # type: ignore + + async def get_site_detector_response_slot( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DetectorResponse": + """Get site detector response. + + Description for Get site detector response. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_detector_response_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} # type: ignore + + def list_site_diagnostic_categories_slot( + self, + resource_group_name: str, + site_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticCategoryCollection"]: + """Get Diagnostics Categories. + + Description for Get Diagnostics Categories. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_diagnostic_categories_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticCategoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} # type: ignore + + async def get_site_diagnostic_category_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> "models.DiagnosticCategory": + """Get Diagnostics Category. + + Description for Get Diagnostics Category. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} # type: ignore + + def list_site_analyses_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticAnalysisCollection"]: + """Get Site Analyses. + + Description for Get Site Analyses. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_analyses_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticAnalysisCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore + + async def get_site_analysis_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + slot: str, + **kwargs + ) -> "models.AnalysisDefinition": + """Get Site Analysis. + + Description for Get Site Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param analysis_name: Analysis Name. + :type analysis_name: str + :param slot: Slot - optional. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_analysis_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AnalysisDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore + + async def execute_site_analysis_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + analysis_name: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticAnalysis": + """Execute Analysis. + + Description for Execute Analysis. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param analysis_name: Analysis Resource Name. + :type analysis_name: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.execute_site_analysis_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore + + def list_site_detectors_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DiagnosticDetectorCollection"]: + """Get Detectors. + + Description for Get Detectors. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_detectors_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DiagnosticDetectorCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore + + async def get_site_detector_slot( + self, + resource_group_name: str, + site_name: str, + diagnostic_category: str, + detector_name: str, + slot: str, + **kwargs + ) -> "models.DetectorDefinition": + """Get Detector. + + Description for Get Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param diagnostic_category: Diagnostic Category. + :type diagnostic_category: str + :param detector_name: Detector Name. + :type detector_name: str + :param slot: Slot Name. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_detector_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore + + async def execute_site_detector_slot( + self, + resource_group_name: str, + site_name: str, + detector_name: str, + diagnostic_category: str, + slot: str, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + **kwargs + ) -> "models.DiagnosticDetectorResponse": + """Execute Detector. + + Description for Execute Detector. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site Name. + :type site_name: str + :param detector_name: Detector Resource Name. + :type detector_name: str + :param diagnostic_category: Category Name. + :type diagnostic_category: str + :param slot: Slot Name. + :type slot: str + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. + :type time_grain: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.execute_site_detector_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), + 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') + if time_grain is not None: + query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py new file mode 100644 index 000000000000..44b01ffe35f5 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainRegistrationProviderOperations: + """DomainRegistrationProviderOperations 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.web.v2019_08_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 + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Description for Implements Csm operations Api to exposes the list of available Csm Apis under + the resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py new file mode 100644 index 000000000000..453197e3ddac --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py @@ -0,0 +1,1072 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainsOperations: + """DomainsOperations 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.web.v2019_08_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 + + async def check_availability( + self, + identifier: "models.NameIdentifier", + **kwargs + ) -> "models.DomainAvailabilityCheckResult": + """Check if a domain is available for registration. + + Description for Check if a domain is available for registration. + + :param identifier: Name of the domain. + :type identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainAvailabilityCheckResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainAvailabilityCheckResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailabilityCheckResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_availability.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(identifier, 'NameIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainAvailabilityCheckResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DomainCollection"]: + """Get all domains in a subscription. + + Description for Get all domains 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 DomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('DomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} # type: ignore + + async def get_control_center_sso_request( + self, + **kwargs + ) -> "models.DomainControlCenterSsoRequest": + """Generate a single sign-on request for the domain management portal. + + Description for Generate a single sign-on request for the domain management portal. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainControlCenterSsoRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainControlCenterSsoRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_control_center_sso_request.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainControlCenterSsoRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} # type: ignore + + def list_recommendations( + self, + parameters: "models.DomainRecommendationSearchParameters", + **kwargs + ) -> AsyncIterable["models.NameIdentifierCollection"]: + """Get domain name recommendations based on keywords. + + Description for Get domain name recommendations based on keywords. + + :param parameters: Search parameters for domain name recommendations. + :type parameters: ~azure.mgmt.web.v2019_08_01.models.DomainRecommendationSearchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NameIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.NameIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommendations.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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NameIdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.DomainCollection"]: + """Get all domains in a resource group. + + Description for Get all domains in a resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 DomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('DomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} # type: ignore + + async def get( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> "models.Domain": + """Get a domain. + + Description for Get a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + domain: "models.Domain", + **kwargs + ) -> "models.Domain": + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain, 'Domain') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Domain', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + domain: "models.Domain", + **kwargs + ) -> AsyncLROPoller["models.Domain"]: + """Creates or updates a domain. + + Description for Creates or updates a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain: Domain registration information. + :type domain: ~azure.mgmt.web.v2019_08_01.models.Domain + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.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, + domain_name=domain_name, + domain=domain, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.DomainRegistration/domains/{domainName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + domain_name: str, + force_hard_delete_domain: Optional[bool] = None, + **kwargs + ) -> None: + """Delete a domain. + + Description for Delete a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param force_hard_delete_domain: Specify :code:`true` to delete the domain + immediately. The default is :code:`false` which deletes the domain after 24 hours. + :type force_hard_delete_domain: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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] + if force_hard_delete_domain is not None: + query_parameters['forceHardDeleteDomain'] = self._serialize.query("force_hard_delete_domain", force_hard_delete_domain, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + domain_name: str, + domain: "models.DomainPatchResource", + **kwargs + ) -> "models.Domain": + """Creates or updates a domain. + + Description for Creates or updates a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain: Domain registration information. + :type domain: ~azure.mgmt.web.v2019_08_01.models.DomainPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain, 'DomainPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Domain', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + def list_ownership_identifiers( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> AsyncIterable["models.DomainOwnershipIdentifierCollection"]: + """Lists domain ownership identifiers. + + Description for Lists domain ownership identifiers. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainOwnershipIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_ownership_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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: + 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('DomainOwnershipIdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} # type: ignore + + async def get_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Get ownership identifier for domain. + + Description for Get ownership identifier for domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def create_or_update_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + domain_ownership_identifier: "models.DomainOwnershipIdentifier", + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Description for Creates an ownership identifier for a domain or updates identifier details for + an existing identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def delete_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + **kwargs + ) -> None: + """Delete ownership identifier for domain. + + Description for Delete ownership identifier for domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def update_ownership_identifier( + self, + resource_group_name: str, + domain_name: str, + name: str, + domain_ownership_identifier: "models.DomainOwnershipIdentifier", + **kwargs + ) -> "models.DomainOwnershipIdentifier": + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Description for Creates an ownership identifier for a domain or updates identifier details for + an existing identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of domain. + :type domain_name: str + :param name: Name of identifier. + :type name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore + + async def renew( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> None: + """Renew a domain. + + Description for Renew a domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.renew.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py new file mode 100644 index 000000000000..f4b2a8fddb21 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProviderOperations: + """ProviderOperations 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.web.v2019_08_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 + + def get_available_stacks( + self, + os_type_selected: Optional[Union[str, "models.Enum4"]] = None, + **kwargs + ) -> AsyncIterable["models.ApplicationStackCollection"]: + """Get available application frameworks and their versions. + + Description for Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2019_08_01.models.Enum4 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_available_stacks.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if os_type_selected is not None: + query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} # type: ignore + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.CsmOperationCollection"]: + """Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions. + + Description for Gets all available operations for the Microsoft.Web resource provider. Also + exposes resource metric definitions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.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: + 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('CsmOperationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} # type: ignore + + def get_available_stacks_on_prem( + self, + os_type_selected: Optional[Union[str, "models.Enum5"]] = None, + **kwargs + ) -> AsyncIterable["models.ApplicationStackCollection"]: + """Get available application frameworks and their versions. + + Description for Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2019_08_01.models.Enum5 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_available_stacks_on_prem.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] + if os_type_selected is not None: + query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py new file mode 100644 index 000000000000..30ce944fed3d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py @@ -0,0 +1,1056 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RecommendationsOperations: + """RecommendationsOperations 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.web.v2019_08_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 + + def list( + self, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """List all recommendations for a subscription. + + Description for List all recommendations for a subscription. + + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} # type: ignore + + async def reset_all_filters( + self, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for a subscription. + + Description for Reset all recommendation opt-out settings for a subscription. + + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reset_all_filters.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} # type: ignore + + async def disable_recommendation_for_subscription( + self, + name: str, + **kwargs + ) -> None: + """Disables the specified rule so it will not apply to a subscription in the future. + + Description for Disables the specified rule so it will not apply to a subscription in the + future. + + :param name: Rule name. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} # type: ignore + + def list_history_for_hosting_environment( + self, + resource_group_name: str, + hosting_environment_name: str, + expired_only: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get past recommendations for an app, optionally specified by the time range. + + Description for Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param hosting_environment_name: Name of the hosting environment. + :type hosting_environment_name: str + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. + :type expired_only: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_history_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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] + if expired_only is not None: + query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_history_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory'} # type: ignore + + def list_recommended_rules_for_hosting_environment( + self, + resource_group_name: str, + hosting_environment_name: str, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get all recommendations for an app. + + Description for Get all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param hosting_environment_name: Name of the app. + :type hosting_environment_name: str + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommended_rules_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations'} # type: ignore + + async def disable_all_for_hosting_environment( + self, + resource_group_name: str, + environment_name: str, + hosting_environment_name: str, + **kwargs + ) -> None: + """Disable all recommendations for an app. + + Description for Disable all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param environment_name: Name of the app. + :type environment_name: str + :param hosting_environment_name: + :type hosting_environment_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.disable_all_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_all_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable'} # type: ignore + + async def reset_all_filters_for_hosting_environment( + self, + resource_group_name: str, + environment_name: str, + hosting_environment_name: str, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for an app. + + Description for Reset all recommendation opt-out settings for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param environment_name: Name of the app. + :type environment_name: str + :param hosting_environment_name: + :type hosting_environment_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reset_all_filters_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reset_all_filters_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset'} # type: ignore + + async def get_rule_details_by_hosting_environment( + self, + resource_group_name: str, + hosting_environment_name: str, + name: str, + update_seen: Optional[bool] = None, + recommendation_id: Optional[str] = None, + **kwargs + ) -> "models.RecommendationRule": + """Get a recommendation rule for an app. + + Description for Get a recommendation rule for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param hosting_environment_name: Name of the hosting environment. + :type hosting_environment_name: str + :param name: Name of the recommendation. + :type name: str + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. + :type update_seen: bool + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if update_seen is not None: + query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') + if recommendation_id is not None: + query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecommendationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_rule_details_by_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}'} # type: ignore + + async def disable_recommendation_for_hosting_environment( + self, + resource_group_name: str, + environment_name: str, + name: str, + hosting_environment_name: str, + **kwargs + ) -> None: + """Disables the specific rule for a web site permanently. + + Description for Disables the specific rule for a web site permanently. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param environment_name: Site name. + :type environment_name: str + :param name: Rule name. + :type name: str + :param hosting_environment_name: + :type hosting_environment_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.disable_recommendation_for_hosting_environment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), + '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['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_recommendation_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable'} # type: ignore + + def list_history_for_web_app( + self, + resource_group_name: str, + site_name: str, + expired_only: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get past recommendations for an app, optionally specified by the time range. + + Description for Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. + :type expired_only: bool + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_history_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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] + if expired_only is not None: + query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} # type: ignore + + def list_recommended_rules_for_web_app( + self, + resource_group_name: str, + site_name: str, + featured: Optional[bool] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.RecommendationCollection"]: + """Get all recommendations for an app. + + Description for Get all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. + :type featured: bool + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_recommended_rules_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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] + if featured is not None: + query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} # type: ignore + + async def disable_all_for_web_app( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> None: + """Disable all recommendations for an app. + + Description for Disable all recommendations for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.disable_all_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} # type: ignore + + async def reset_all_filters_for_web_app( + self, + resource_group_name: str, + site_name: str, + **kwargs + ) -> None: + """Reset all recommendation opt-out settings for an app. + + Description for Reset all recommendation opt-out settings for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} # type: ignore + + async def get_rule_details_by_web_app( + self, + resource_group_name: str, + site_name: str, + name: str, + update_seen: Optional[bool] = None, + recommendation_id: Optional[str] = None, + **kwargs + ) -> "models.RecommendationRule": + """Get a recommendation rule for an app. + + Description for Get a recommendation rule for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Name of the app. + :type site_name: str + :param name: Name of the recommendation. + :type name: str + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. + :type update_seen: bool + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if update_seen is not None: + query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') + if recommendation_id is not None: + query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecommendationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} # type: ignore + + async def disable_recommendation_for_site( + self, + resource_group_name: str, + site_name: str, + name: str, + **kwargs + ) -> None: + """Disables the specific rule for a web site permanently. + + Description for Disables the specific rule for a web site permanently. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param site_name: Site name. + :type site_name: str + :param name: Rule name. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.disable_recommendation_for_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'siteName': self._serialize.url("site_name", site_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py new file mode 100644 index 000000000000..18c1fa7a6b5c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py @@ -0,0 +1,453 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceHealthMetadataOperations: + """ResourceHealthMetadataOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """List all ResourceHealthMetadata for all sites in the subscription. + + Description for List all ResourceHealthMetadata for all sites in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """List all ResourceHealthMetadata for all sites in the resource group in the subscription. + + Description for List all ResourceHealthMetadata for all sites in the resource group in the + subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore + + def list_by_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Description for Gets the category of ResourceHealthMetadata to use for the given site as a + collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} # type: ignore + + async def get_by_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.ResourceHealthMetadata": + """Gets the category of ResourceHealthMetadata to use for the given site. + + Description for Gets the category of ResourceHealthMetadata to use for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_by_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} # type: ignore + + def list_by_site_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ResourceHealthMetadataCollection"]: + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Description for Gets the category of ResourceHealthMetadata to use for the given site as a + collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_site_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ResourceHealthMetadataCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} # type: ignore + + async def get_by_site_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.ResourceHealthMetadata": + """Gets the category of ResourceHealthMetadata to use for the given site. + + Description for Gets the category of ResourceHealthMetadata to use for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_by_site_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py new file mode 100644 index 000000000000..dd01139c5fbe --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py @@ -0,0 +1,1769 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StaticSitesOperations: + """StaticSitesOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.StaticSiteCollection"]: + """Get all Static Sites for a subscription. + + Description for Get all Static Sites for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('StaticSiteCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites'} # type: ignore + + def get_static_sites_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.StaticSiteCollection"]: + """Gets all static sites in the specified resource group. + + Description for Gets all static sites in the specified resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :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 StaticSiteCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_static_sites_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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: + 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('StaticSiteCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_static_sites_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites'} # type: ignore + + async def get_static_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StaticSiteARMResource": + """Gets the details of a static site. + + Description for Gets the details of a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_static_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore + + async def create_or_update_static_site( + self, + resource_group_name: str, + name: str, + static_site_envelope: "models.StaticSiteARMResource", + **kwargs + ) -> "models.StaticSiteARMResource": + """Creates a new static site in an existing resource group, or updates an existing static site. + + Description for Creates a new static site in an existing resource group, or updates an existing + static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site to create or update. + :type name: str + :param static_site_envelope: A JSON representation of the staticsite properties. See example. + :type static_site_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_static_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(static_site_envelope, 'StaticSiteARMResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore + + async def delete_static_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes a static site. + + Description for Deletes a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site to delete. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_static_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore + + async def update_static_site( + self, + resource_group_name: str, + name: str, + static_site_envelope: "models.StaticSitePatchResource", + **kwargs + ) -> "models.StaticSiteARMResource": + """Creates a new static site in an existing resource group, or updates an existing static site. + + Description for Creates a new static site in an existing resource group, or updates an existing + static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site to create or update. + :type name: str + :param static_site_envelope: A JSON representation of the staticsite properties. See example. + :type static_site_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_static_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(static_site_envelope, 'StaticSitePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore + + def list_static_site_users( + self, + resource_group_name: str, + name: str, + authprovider: str, + **kwargs + ) -> AsyncIterable["models.StaticSiteUserCollection"]: + """Gets the list of users of a static site. + + Description for Gets the list of users of a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param authprovider: The auth provider for the users. + :type authprovider: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteUserCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteUserCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_static_site_users.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'authprovider': self._serialize.url("authprovider", authprovider, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('StaticSiteUserCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_static_site_users.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/listUsers'} # type: ignore + + async def delete_static_site_user( + self, + resource_group_name: str, + name: str, + authprovider: str, + userid: str, + **kwargs + ) -> None: + """Deletes the user entry from the static site. + + Description for Deletes the user entry from the static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the staticsite. + :type name: str + :param authprovider: The auth provider for this user. + :type authprovider: str + :param userid: The user id of the user. + :type userid: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_static_site_user.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'authprovider': self._serialize.url("authprovider", authprovider, 'str'), + 'userid': self._serialize.url("userid", userid, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_static_site_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}'} # type: ignore + + async def update_static_site_user( + self, + resource_group_name: str, + name: str, + authprovider: str, + userid: str, + static_site_user_envelope: "models.StaticSiteUserARMResource", + **kwargs + ) -> "models.StaticSiteUserARMResource": + """Updates a user entry with the listed roles. + + Description for Updates a user entry with the listed roles. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param authprovider: The auth provider for this user. + :type authprovider: str + :param userid: The user id of the user. + :type userid: str + :param static_site_user_envelope: A JSON representation of the StaticSiteUser properties. See + example. + :type static_site_user_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteUserARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_static_site_user.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'authprovider': self._serialize.url("authprovider", authprovider, 'str'), + 'userid': self._serialize.url("userid", userid, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(static_site_user_envelope, 'StaticSiteUserARMResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StaticSiteUserARMResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_static_site_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}'} # type: ignore + + def get_static_site_builds( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.StaticSiteBuildCollection"]: + """Gets all static site builds for a particular static site. + + Description for Gets all static site builds for a particular static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteBuildCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_static_site_builds.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('StaticSiteBuildCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_static_site_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds'} # type: ignore + + async def get_static_site_build( + self, + resource_group_name: str, + name: str, + pr_id: str, + **kwargs + ) -> "models.StaticSiteBuildARMResource": + """Gets the details of a static site build. + + Description for Gets the details of a static site build. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param pr_id: The stage site identifier. + :type pr_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteBuildARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildARMResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_static_site_build.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'prId': self._serialize.url("pr_id", pr_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StaticSiteBuildARMResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_static_site_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}'} # type: ignore + + async def delete_static_site_build( + self, + resource_group_name: str, + name: str, + pr_id: str, + **kwargs + ) -> None: + """Deletes a static site build. + + Description for Deletes a static site build. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param pr_id: The stage site identifier. + :type pr_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_static_site_build.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'prId': self._serialize.url("pr_id", pr_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_static_site_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}'} # type: ignore + + async def create_or_update_static_site_build_function_app_settings( + self, + resource_group_name: str, + name: str, + pr_id: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Creates or updates the function app settings of a static site build. + + Description for Creates or updates the function app settings of a static site build. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param pr_id: The stage site identifier. + :type pr_id: str + :param app_settings: + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_static_site_build_function_app_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'prId': self._serialize.url("pr_id", pr_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_static_site_build_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/config/functionappsettings'} # type: ignore + + def list_static_site_build_functions( + self, + resource_group_name: str, + name: str, + pr_id: str, + **kwargs + ) -> AsyncIterable["models.StaticSiteFunctionOverviewCollection"]: + """Gets the functions of a particular static site build. + + Description for Gets the functions of a particular static site build. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param pr_id: The stage site identifier. + :type pr_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteFunctionOverviewCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_static_site_build_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'prId': self._serialize.url("pr_id", pr_id, 'str'), + '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: + 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('StaticSiteFunctionOverviewCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_static_site_build_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/functions'} # type: ignore + + async def list_static_site_build_function_app_settings( + self, + resource_group_name: str, + name: str, + pr_id: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of a static site. + + Description for Gets the application settings of a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param pr_id: The stage site identifier. + :type pr_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_static_site_build_function_app_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'prId': self._serialize.url("pr_id", pr_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_static_site_build_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/listFunctionAppSettings'} # type: ignore + + async def create_or_update_static_site_function_app_settings( + self, + resource_group_name: str, + name: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Creates or updates the function app settings of a static site. + + Description for Creates or updates the function app settings of a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param app_settings: + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_static_site_function_app_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_static_site_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/config/functionappsettings'} # type: ignore + + async def create_user_roles_invitation_link( + self, + resource_group_name: str, + name: str, + static_site_user_roles_invitation_envelope: "models.StaticSiteUserInvitationRequestResource", + **kwargs + ) -> "models.StaticSiteUserInvitationResponseResource": + """Creates an invitation link for a user with the role. + + Description for Creates an invitation link for a user with the role. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param static_site_user_roles_invitation_envelope: + :type static_site_user_roles_invitation_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserInvitationRequestResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteUserInvitationResponseResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserInvitationResponseResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserInvitationResponseResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_user_roles_invitation_link.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(static_site_user_roles_invitation_envelope, 'StaticSiteUserInvitationRequestResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StaticSiteUserInvitationResponseResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_user_roles_invitation_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/createUserInvitation'} # type: ignore + + def list_static_site_custom_domains( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.StaticSiteCustomDomainOverviewCollection"]: + """Gets all static site custom domains for a particular static site. + + Description for Gets all static site custom domains for a particular static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site resource to search in. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteCustomDomainOverviewCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_static_site_custom_domains.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('StaticSiteCustomDomainOverviewCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_static_site_custom_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains'} # type: ignore + + async def create_or_update_static_site_custom_domain( + self, + resource_group_name: str, + name: str, + domain_name: str, + **kwargs + ) -> "models.StaticSiteCustomDomainOverviewARMResource": + """Creates a new static site custom domain in an existing resource group and static site. + + Description for Creates a new static site custom domain in an existing resource group and + static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param domain_name: The custom domain to create. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteCustomDomainOverviewARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.create_or_update_static_site_custom_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StaticSiteCustomDomainOverviewARMResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StaticSiteCustomDomainOverviewARMResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_static_site_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}'} # type: ignore + + async def delete_static_site_custom_domain( + self, + resource_group_name: str, + name: str, + domain_name: str, + **kwargs + ) -> None: + """Deletes a custom domain. + + Description for Deletes a custom domain. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param domain_name: The custom domain to delete. + :type domain_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_static_site_custom_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_static_site_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}'} # type: ignore + + async def validate_custom_domain_can_be_added_to_static_site( + self, + resource_group_name: str, + name: str, + domain_name: str, + **kwargs + ) -> None: + """Validates a particular custom domain can be added to a static site. + + Description for Validates a particular custom domain can be added to a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param domain_name: The custom domain to validate. + :type domain_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.validate_custom_domain_can_be_added_to_static_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + validate_custom_domain_can_be_added_to_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}/validate'} # type: ignore + + async def detach_static_site( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Detaches a static site. + + Description for Detaches a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site to detach. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.detach_static_site.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + detach_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/detach'} # type: ignore + + def list_static_site_functions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.StaticSiteFunctionOverviewCollection"]: + """Gets the functions of a static site. + + Description for Gets the functions of a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteFunctionOverviewCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_static_site_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('StaticSiteFunctionOverviewCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_static_site_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/functions'} # type: ignore + + async def list_static_site_function_app_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of a static site. + + Description for Gets the application settings of a static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_static_site_function_app_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_static_site_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listFunctionAppSettings'} # type: ignore + + async def list_static_site_secrets( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Lists the secrets for an existing static site. + + Description for Lists the secrets for an existing static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_static_site_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_static_site_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listSecrets'} # type: ignore + + async def reset_static_site_api_key( + self, + resource_group_name: str, + name: str, + reset_properties_envelope: "models.StaticSiteResetPropertiesARMResource", + **kwargs + ) -> None: + """Resets the api key for an existing static site. + + Description for Resets the api key for an existing static site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the static site. + :type name: str + :param reset_properties_envelope: + :type reset_properties_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteResetPropertiesARMResource + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.reset_static_site_api_key.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(reset_properties_envelope, 'StaticSiteResetPropertiesARMResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reset_static_site_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/resetapikey'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py new file mode 100644 index 000000000000..4fd66a015cb0 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py @@ -0,0 +1,245 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopLevelDomainsOperations: + """TopLevelDomainsOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.TopLevelDomainCollection"]: + """Get all top-level domains supported for registration. + + Description for Get all top-level domains supported for registration. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopLevelDomainCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.TopLevelDomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('TopLevelDomainCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} # type: ignore + + async def get( + self, + name: str, + **kwargs + ) -> "models.TopLevelDomain": + """Get details of a top-level domain. + + Description for Get details of a top-level domain. + + :param name: Name of the top-level domain. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopLevelDomain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TopLevelDomain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopLevelDomain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} # type: ignore + + def list_agreements( + self, + name: str, + agreement_option: "models.TopLevelDomainAgreementOption", + **kwargs + ) -> AsyncIterable["models.TldLegalAgreementCollection"]: + """Gets all legal agreements that user needs to accept before purchasing a domain. + + Description for Gets all legal agreements that user needs to accept before purchasing a domain. + + :param name: Name of the top-level domain. + :type name: str + :param agreement_option: Domain agreement options. + :type agreement_option: ~azure.mgmt.web.v2019_08_01.models.TopLevelDomainAgreementOption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TldLegalAgreementCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.TldLegalAgreementCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_agreements.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TldLegalAgreementCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py new file mode 100644 index 000000000000..0d6329ebb2b1 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py @@ -0,0 +1,27076 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, IO, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebAppsOperations: + """WebAppsOperations 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.web.v2019_08_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 + + def list( + self, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Get all apps for a subscription. + + Description for Get all apps for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + include_slots: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Gets all web, mobile, and API apps in the specified resource group. + + Description for Gets all web, mobile, and API apps in the specified resource group. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param include_slots: Specify :code:`true` to include deployment slots in + results. The default is false, which only gives you the production slot of all apps. + :type include_slots: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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] + if include_slots is not None: + query_parameters['includeSlots'] = self._serialize.query("include_slots", include_slots, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.Site"]: + """Gets the details of a web, mobile, or API app. + + Description for Gets the details of a web, mobile, or API app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + site_envelope: "models.Site", + **kwargs + ) -> "models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'Site') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + site_envelope: "models.Site", + **kwargs + ) -> AsyncLROPoller["models.Site"]: + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.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, + name=name, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + 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.Web/sites/{name}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + name: str, + delete_metrics: Optional[bool] = None, + delete_empty_server_farm: Optional[bool] = None, + **kwargs + ) -> None: + """Deletes a web, mobile, or API app, or one of the deployment slots. + + Description for Deletes a web, mobile, or API app, or one of the deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app to delete. + :type name: str + :param delete_metrics: If true, web app metrics are also deleted. + :type delete_metrics: bool + :param delete_empty_server_farm: Specify false if you want to keep empty App Service plan. By + default, empty App Service plan is deleted. + :type delete_empty_server_farm: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if delete_metrics is not None: + query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') + if delete_empty_server_farm is not None: + query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + site_envelope: "models.SitePatchResource", + **kwargs + ) -> "models.Site": + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'SitePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore + + async def analyze_custom_hostname( + self, + resource_group_name: str, + name: str, + host_name: Optional[str] = None, + **kwargs + ) -> "models.CustomHostnameAnalysisResult": + """Analyze a custom hostname. + + Description for Analyze a custom hostname. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param host_name: Custom hostname. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.analyze_custom_hostname.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if host_name is not None: + query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} # type: ignore + + async def apply_slot_config_to_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + """Applies the configuration settings from the target slot onto the current slot. + + Description for Applies the configuration settings from the target slot onto the current slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.apply_slot_config_to_production.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} # type: ignore + + async def backup( + self, + resource_group_name: str, + name: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Creates a backup of an app. + + Description for Creates a backup of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} # type: ignore + + def list_backups( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Description for Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_backups.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} # type: ignore + + async def get_backup_status( + self, + resource_group_name: str, + name: str, + backup_id: str, + **kwargs + ) -> "models.BackupItem": + """Gets a backup of an app by its ID. + + Description for Gets a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_backup_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore + + async def delete_backup( + self, + resource_group_name: str, + name: str, + backup_id: str, + **kwargs + ) -> None: + """Deletes a backup of an app by its ID. + + Description for Deletes a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore + + async def list_backup_status_secrets( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Description for Gets status of a web app backup that may be in progress, including secrets + associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the + SAS URL for the backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param backup_id: ID of backup. + :type backup_id: str + :param request: Information on backup request. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_backup_status_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} # type: ignore + + async def _restore_initial( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + async def begin_restore( + self, + resource_group_name: str, + name: str, + backup_id: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a specific backup to another app (or deployment slot, if specified). + + Description for Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + async def get_basic_publishing_credentials_policies( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.CsmPublishingCredentialsPoliciesCollection": + """Returns whether Scm basic auth is allowed and whether Ftp is allowed for a given site. + + Description for Returns whether Scm basic auth is allowed and whether Ftp is allowed for a + given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesCollection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_basic_publishing_credentials_policies.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_basic_publishing_credentials_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies'} # type: ignore + + async def get_ftp_allowed( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.CsmPublishingCredentialsPoliciesEntity": + """Returns whether FTP is allowed on the site or not. + + Description for Returns whether FTP is allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ftp_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ftp_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp'} # type: ignore + + async def update_ftp_allowed( + self, + resource_group_name: str, + name: str, + csm_publishing_access_policies_entity: "models.CsmPublishingCredentialsPoliciesEntity", + **kwargs + ) -> "models.CsmPublishingCredentialsPoliciesEntity": + """Updates whether FTP is allowed on the site or not. + + Description for Updates whether FTP is allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param csm_publishing_access_policies_entity: + :type csm_publishing_access_policies_entity: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_ftp_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_ftp_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp'} # type: ignore + + async def get_scm_allowed( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.CsmPublishingCredentialsPoliciesEntity": + """Returns whether Scm basic auth is allowed on the site or not. + + Description for Returns whether Scm basic auth is allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_scm_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_scm_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm'} # type: ignore + + async def update_scm_allowed( + self, + resource_group_name: str, + name: str, + csm_publishing_access_policies_entity: "models.CsmPublishingCredentialsPoliciesEntity", + **kwargs + ) -> "models.CsmPublishingCredentialsPoliciesEntity": + """Updates whether user publishing credentials are allowed on the site or not. + + Description for Updates whether user publishing credentials are allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param csm_publishing_access_policies_entity: + :type csm_publishing_access_policies_entity: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_scm_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_scm_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm'} # type: ignore + + def list_configurations( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigResourceCollection"]: + """List the configurations of an app. + + Description for List the configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configurations.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteConfigResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} # type: ignore + + async def update_application_settings( + self, + resource_group_name: str, + name: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the application settings of an app. + + Description for Replaces the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_application_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} # type: ignore + + async def list_application_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of an app. + + Description for Gets the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_application_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} # type: ignore + + async def update_auth_settings( + self, + resource_group_name: str, + name: str, + site_auth_settings: "models.SiteAuthSettings", + **kwargs + ) -> "models.SiteAuthSettings": + """Updates the Authentication / Authorization settings associated with web app. + + Description for Updates the Authentication / Authorization settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_auth_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} # type: ignore + + async def get_auth_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteAuthSettings": + """Gets the Authentication/Authorization settings of an app. + + Description for Gets the Authentication/Authorization settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_auth_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} # type: ignore + + async def update_azure_storage_accounts( + self, + resource_group_name: str, + name: str, + azure_storage_accounts: "models.AzureStoragePropertyDictionaryResource", + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Updates the Azure storage account configurations of an app. + + Description for Updates the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_azure_storage_accounts.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts'} # type: ignore + + async def list_azure_storage_accounts( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Gets the Azure storage account configurations of an app. + + Description for Gets the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_azure_storage_accounts.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list'} # type: ignore + + async def update_backup_configuration( + self, + resource_group_name: str, + name: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupRequest": + """Updates the backup configuration of an app. + + Description for Updates the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Edited backup configuration. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore + + async def delete_backup_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes the backup configuration of an app. + + Description for Deletes the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore + + async def get_backup_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.BackupRequest": + """Gets the backup configuration of an app. + + Description for Gets the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_backup_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} # type: ignore + + async def get_app_settings_key_vault_references( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.KeyVaultReferenceCollection": + """Gets the config reference app settings and status of an app. + + Description for Gets the config reference app settings and status of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVaultReferenceCollection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyVaultReferenceCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_app_settings_key_vault_references.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('KeyVaultReferenceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_app_settings_key_vault_references.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings'} # type: ignore + + async def get_app_setting_key_vault_reference( + self, + resource_group_name: str, + name: str, + app_setting_key: str, + **kwargs + ) -> "models.KeyVaultReferenceResource": + """Gets the config reference and status of an app. + + Description for Gets the config reference and status of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param app_setting_key: App Setting key name. + :type app_setting_key: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVaultReferenceResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyVaultReferenceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_app_setting_key_vault_reference.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'appSettingKey': self._serialize.url("app_setting_key", app_setting_key, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('KeyVaultReferenceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_app_setting_key_vault_reference.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey}'} # type: ignore + + async def update_connection_strings( + self, + resource_group_name: str, + name: str, + connection_strings: "models.ConnectionStringDictionary", + **kwargs + ) -> "models.ConnectionStringDictionary": + """Replaces the connection strings of an app. + + Description for Replaces the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_connection_strings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} # type: ignore + + async def list_connection_strings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.ConnectionStringDictionary": + """Gets the connection strings of an app. + + Description for Gets the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_connection_strings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} # type: ignore + + async def get_diagnostic_logs_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteLogsConfig": + """Gets the logging configuration of an app. + + Description for Gets the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore + + async def update_diagnostic_logs_config( + self, + resource_group_name: str, + name: str, + site_logs_config: "models.SiteLogsConfig", + **kwargs + ) -> "models.SiteLogsConfig": + """Updates the logging configuration of an app. + + Description for Updates the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore + + async def update_metadata( + self, + resource_group_name: str, + name: str, + metadata: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the metadata of an app. + + Description for Replaces the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_metadata.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(metadata, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} # type: ignore + + async def list_metadata( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the metadata of an app. + + Description for Gets the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_metadata.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} # type: ignore + + async def _list_publishing_credentials_initial( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.User": + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_publishing_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + async def begin_list_publishing_credentials( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncLROPoller["models.User"]: + """Gets the Git/FTP publishing credentials of an app. + + Description for Gets the Git/FTP publishing credentials of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.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._list_publishing_credentials_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore + + async def update_site_push_settings( + self, + resource_group_name: str, + name: str, + push_settings: "models.PushSettings", + **kwargs + ) -> "models.PushSettings": + """Updates the Push settings associated with web app. + + Description for Updates the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param push_settings: Push settings associated with web app. + :type push_settings: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_site_push_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(push_settings, 'PushSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} # type: ignore + + async def list_site_push_settings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PushSettings": + """Gets the Push settings associated with web app. + + Description for Gets the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_site_push_settings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} # type: ignore + + async def list_slot_configuration_names( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SlotConfigNamesResource": + """Gets the names of app settings and connection strings that stick to the slot (not swapped). + + Description for Gets the names of app settings and connection strings that stick to the slot + (not swapped). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_slot_configuration_names.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore + + async def update_slot_configuration_names( + self, + resource_group_name: str, + name: str, + slot_config_names: "models.SlotConfigNamesResource", + **kwargs + ) -> "models.SlotConfigNamesResource": + """Updates the names of application settings and connection string that remain with the slot during swap operation. + + Description for Updates the names of application settings and connection string that remain + with the slot during swap operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_config_names: Names of application settings and connection strings. See example. + :type slot_config_names: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_slot_configuration_names.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore + + async def get_configuration( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. + + Description for Gets the configuration of an app, such as platform version and bitness, default + documents, virtual applications, Always On, etc. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + async def create_or_update_configuration( + self, + resource_group_name: str, + name: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Description for Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + async def update_configuration( + self, + resource_group_name: str, + name: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Description for Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_configuration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore + + def list_configuration_snapshot_info( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigurationSnapshotInfoCollection"]: + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. + + Description for Gets a list of web app configuration snapshots identifiers. Each element of the + list contains a timestamp and the ID of the snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configuration_snapshot_info.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteConfigurationSnapshotInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} # type: ignore + + async def get_configuration_snapshot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets a snapshot of the configuration of an app at a previous point in time. + + Description for Gets a snapshot of the configuration of an app at a previous point in time. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_configuration_snapshot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} # type: ignore + + async def recover_site_configuration_snapshot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + **kwargs + ) -> None: + """Reverts the configuration of an app to a previous snapshot. + + Description for Reverts the configuration of an app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} # type: ignore + + async def get_web_site_container_logs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional[IO]: + """Gets the last lines of docker logs for the given site. + + Description for Gets the last lines of docker logs for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_web_site_container_logs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/octet-stream' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} # type: ignore + + async def get_container_logs_zip( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional[IO]: + """Gets the ZIP archived docker log files for the given site. + + Description for Gets the ZIP archived docker log files for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_container_logs_zip.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/zip' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} # type: ignore + + def list_continuous_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ContinuousWebJobCollection"]: + """List continuous web jobs for an app, or a deployment slot. + + Description for List continuous web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_continuous_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ContinuousWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} # type: ignore + + async def get_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> Optional["models.ContinuousWebJob"]: + """Gets a continuous web job by its ID for an app, or a deployment slot. + + Description for Gets a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore + + async def delete_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Delete a continuous web job by its ID for an app, or a deployment slot. + + Description for Delete a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore + + async def start_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Start a continuous web job for an app, or a deployment slot. + + Description for Start a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.start_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} # type: ignore + + async def stop_continuous_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Stop a continuous web job for an app, or a deployment slot. + + Description for Stop a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_continuous_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} # type: ignore + + def list_deployments( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.DeploymentCollection"]: + """List deployments for an app, or a deployment slot. + + Description for List deployments for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_deployments.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('DeploymentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} # type: ignore + + async def get_deployment( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> "models.Deployment": + """Get a deployment by its ID for an app, or a deployment slot. + + Description for Get a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def create_deployment( + self, + resource_group_name: str, + name: str, + id: str, + deployment: "models.Deployment", + **kwargs + ) -> "models.Deployment": + """Create a deployment for an app, or a deployment slot. + + Description for Create a deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: ID of an existing deployment. + :type id: str + :param deployment: Deployment details. + :type deployment: ~azure.mgmt.web.v2019_08_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def delete_deployment( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> None: + """Delete a deployment by its ID for an app, or a deployment slot. + + Description for Delete a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_deployment.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore + + async def list_deployment_log( + self, + resource_group_name: str, + name: str, + id: str, + **kwargs + ) -> "models.Deployment": + """List deployment log for specific deployment for an app, or a deployment slot. + + Description for List deployment log for specific deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_deployment_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} # type: ignore + + async def discover_backup( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreRequest": + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. + + Description for Discovers an existing app backup that can be restored from a blob in Azure + storage. Use this to get information about the databases stored in a backup. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.discover_backup.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + discover_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup'} # type: ignore + + def list_domain_ownership_identifiers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """Lists ownership identifiers for domain associated with web app. + + Description for Lists ownership identifiers for domain associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_domain_ownership_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} # type: ignore + + async def get_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + **kwargs + ) -> "models.Identifier": + """Get domain ownership identifier for web app. + + Description for Get domain ownership identifier for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def create_or_update_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def delete_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + **kwargs + ) -> None: + """Deletes a domain ownership identifier for a web app. + + Description for Deletes a domain ownership identifier for a web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def update_domain_ownership_identifier( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def get_ms_deploy_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Description for Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ms_deploy_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def _create_ms_deploy_operation_initial( + self, + resource_group_name: str, + name: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def begin_create_ms_deploy_operation( + self, + resource_group_name: str, + name: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Description for Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore + + async def get_ms_deploy_log( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Description for Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ms_deploy_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} # type: ignore + + def list_functions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.FunctionEnvelopeCollection"]: + """List the functions for a web site, or a deployment slot. + + Description for List the functions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('FunctionEnvelopeCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} # type: ignore + + async def get_functions_admin_token( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> str: + """Fetch a short lived token that can be exchanged for a master key. + + Description for Fetch a short lived token that can be exchanged for a master key. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_functions_admin_token.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} # type: ignore + + async def get_function( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> Optional["models.FunctionEnvelope"]: + """Get function information by its ID for web site, or a deployment slot. + + Description for Get function information by its ID for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_function.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def _create_function_initial( + self, + resource_group_name: str, + name: str, + function_name: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> "models.FunctionEnvelope": + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_function_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_function_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def begin_create_function( + self, + resource_group_name: str, + name: str, + function_name: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> AsyncLROPoller["models.FunctionEnvelope"]: + """Create function for web site, or a deployment slot. + + Description for Create function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param function_envelope: Function details. + :type function_envelope: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.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_function_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def delete_function( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> None: + """Delete a function for web site, or a deployment slot. + + Description for Delete a function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_function.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore + + async def create_or_update_function_secret( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a function secret. + + Description for Add or update a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_name: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_function_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def delete_function_secret( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + **kwargs + ) -> None: + """Delete a function secret. + + Description for Delete a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_function_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def list_function_keys( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> "models.StringDictionary": + """Get function keys for a function in a web site, or a deployment slot. + + Description for Get function keys for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_function_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys'} # type: ignore + + async def list_function_secrets( + self, + resource_group_name: str, + name: str, + function_name: str, + **kwargs + ) -> "models.FunctionSecrets": + """Get function secrets for a function in a web site, or a deployment slot. + + Description for Get function secrets for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_function_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} # type: ignore + + async def list_host_keys( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HostKeys": + """Get host secrets for a function app. + + Description for Get host secrets for a function app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_host_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_host_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys'} # type: ignore + + async def list_sync_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """This is to allow calling via powershell and ARM template. + + Description for This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_sync_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + list_sync_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus'} # type: ignore + + async def sync_functions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Description for Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.sync_functions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync'} # type: ignore + + async def create_or_update_host_secret( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a host level secret. + + Description for Add or update a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_name: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore + + async def delete_host_secret( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + **kwargs + ) -> None: + """Delete a host level secret. + + Description for Delete a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_host_secret.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore + + def list_host_name_bindings( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.HostNameBindingCollection"]: + """Get hostname bindings for an app or a deployment slot. + + Description for Get hostname bindings for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_host_name_bindings.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('HostNameBindingCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} # type: ignore + + async def get_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + **kwargs + ) -> "models.HostNameBinding": + """Get the named hostname binding for an app (or deployment slot, if specified). + + Description for Get the named hostname binding for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def create_or_update_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + host_name_binding: "models.HostNameBinding", + **kwargs + ) -> "models.HostNameBinding": + """Creates a hostname binding for an app. + + Description for Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def delete_host_name_binding( + self, + resource_group_name: str, + name: str, + host_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Description for Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_host_name_binding.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore + + async def get_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + Description for Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def create_or_update_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Description for Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + **kwargs + ) -> None: + """Removes a Hybrid Connection from this site. + + Description for Removes a Hybrid Connection from this site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def update_hybrid_connection( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Description for Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_hybrid_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves all Service Bus Hybrid Connections used by this Web App. + + Description for Retrieves all Service Bus Hybrid Connections used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_hybrid_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} # type: ignore + + async def list_relay_service_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Description for Gets hybrid connections configured for an app (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_relay_service_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} # type: ignore + + async def get_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets a hybrid connection configuration by its name. + + Description for Gets a hybrid connection configuration by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection. + :type entity_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def create_or_update_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def delete_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + **kwargs + ) -> None: + """Deletes a relay service connection by its name. + + Description for Deletes a relay service connection by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + async def update_relay_service_connection( + self, + resource_group_name: str, + name: str, + entity_name: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_relay_service_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore + + def list_instance_identifiers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebAppInstanceCollection"]: + """Gets all scale-out instances of an app. + + Description for Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_identifiers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebAppInstanceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} # type: ignore + + async def get_instance_info( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> "models.WebSiteInstanceStatus": + """Gets all scale-out instances of an app. + + Description for Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param instance_id: + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebSiteInstanceStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebSiteInstanceStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_info.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebSiteInstanceStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}'} # type: ignore + + async def get_instance_ms_deploy_status( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Description for Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def _create_instance_ms_deploy_operation_initial( + self, + resource_group_name: str, + name: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def begin_create_instance_ms_deploy_operation( + self, + resource_group_name: str, + name: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Description for Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_instance_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def get_instance_ms_deploy_log( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Description for Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_processes( + self, + resource_group_name: str, + name: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_processes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} # type: ignore + + async def get_instance_process( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def delete_instance_process( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_instance_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def get_instance_process_dump( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_process_dump.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore + + def list_instance_process_modules( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_modules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore + + async def get_instance_process_module( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_process_module.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_instance_process_threads( + self, + resource_group_name: str, + name: str, + process_id: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_threads.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore + + async def is_cloneable( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteCloneability": + """Shows whether an app can be cloned to another resource group or subscription. + + Description for Shows whether an app can be cloned to another resource group or subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.is_cloneable.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteCloneability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} # type: ignore + + def list_site_backups( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Description for Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_backups.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listbackups'} # type: ignore + + async def list_sync_function_triggers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.FunctionSecrets": + """This is to allow calling via powershell and ARM template. + + Description for This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_sync_function_triggers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} # type: ignore + + async def _migrate_storage_initial( + self, + subscription_name: str, + resource_group_name: str, + name: str, + migration_options: "models.StorageMigrationOptions", + **kwargs + ) -> "models.StorageMigrationResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._migrate_storage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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['subscriptionName'] = self._serialize.query("subscription_name", subscription_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _migrate_storage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + async def begin_migrate_storage( + self, + subscription_name: str, + resource_group_name: str, + name: str, + migration_options: "models.StorageMigrationOptions", + **kwargs + ) -> AsyncLROPoller["models.StorageMigrationResponse"]: + """Restores a web app. + + Description for Restores a web app. + + :param subscription_name: Azure subscription. + :type subscription_name: str + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param migration_options: Migration migrationOptions. + :type migration_options: ~azure.mgmt.web.v2019_08_01.models.StorageMigrationOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageMigrationResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.StorageMigrationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + lro_delay = kwargs.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._migrate_storage_initial( + subscription_name=subscription_name, + resource_group_name=resource_group_name, + name=name, + migration_options=migration_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore + + async def _migrate_my_sql_initial( + self, + resource_group_name: str, + name: str, + migration_request_envelope: "models.MigrateMySqlRequest", + **kwargs + ) -> "models.Operation": + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._migrate_my_sql_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _migrate_my_sql_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + async def begin_migrate_my_sql( + self, + resource_group_name: str, + name: str, + migration_request_envelope: "models.MigrateMySqlRequest", + **kwargs + ) -> AsyncLROPoller["models.Operation"]: + """Migrates a local (in-app) MySql database to a remote MySql database. + + Description for Migrates a local (in-app) MySql database to a remote MySql database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param migration_request_envelope: MySql migration options. + :type migration_request_envelope: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Operation or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + lro_delay = kwargs.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._migrate_my_sql_initial( + resource_group_name=resource_group_name, + name=name, + migration_request_envelope=migration_request_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore + + async def get_migrate_my_sql_status( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.MigrateMySqlStatus": + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. + + Description for Returns the status of MySql in app migration, if one is active, and whether or + not MySql in app is enabled. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} # type: ignore + + async def get_swift_virtual_network_connection( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Gets a Swift Virtual Network connection. + + Description for Gets a Swift Virtual Network connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def create_or_update_swift_virtual_network_connection( + self, + resource_group_name: str, + name: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def delete_swift_virtual_network( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes a Swift Virtual Network connection from an app (or deployment slot). + + Description for Deletes a Swift Virtual Network connection from an app (or deployment slot). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_swift_virtual_network.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_swift_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def update_swift_virtual_network_connection( + self, + resource_group_name: str, + name: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore + + async def list_network_features( + self, + resource_group_name: str, + name: str, + view: str, + **kwargs + ) -> Optional["models.NetworkFeatures"]: + """Gets all network features used by the app (or deployment slot, if specified). + + Description for Gets all network features used by the app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param view: The type of view. This can either be "summary" or "detailed". + :type view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_network_features.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'view': self._serialize.url("view", view, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkFeatures', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} # type: ignore + + async def get_network_trace_operation( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_trace_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}'} # type: ignore + + async def start_web_site_network_trace( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> str: + """Start capturing network packets for the site (To be deprecated). + + Description for Start capturing network packets for the site (To be deprecated). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.start_web_site_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} # type: ignore + + async def _start_web_site_network_trace_operation_initial( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_web_site_network_trace_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore + + async def begin_start_web_site_network_trace_operation( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Description for Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_web_site_network_trace_operation_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore + + async def stop_web_site_network_trace( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Description for Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_web_site_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} # type: ignore + + async def get_network_traces( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_traces.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}'} # type: ignore + + async def get_network_trace_operation_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}'} # type: ignore + + async def get_network_traces_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_traces_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}'} # type: ignore + + async def generate_new_site_publishing_password( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Generates a new publishing password for an app (or deployment slot, if specified). + + Description for Generates a new publishing password for an app (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} # type: ignore + + def list_perf_mon_counters( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.PerfMonCounterCollection"]: + """Gets perfmon counters for web app. + + Description for Gets perfmon counters for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_perf_mon_counters.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} # type: ignore + + async def get_site_php_error_log_flag( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SitePhpErrorLogFlag": + """Gets web app's event logs. + + Description for Gets web app's event logs. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} # type: ignore + + async def list_premier_add_ons( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets the premier add-ons of an app. + + Description for Gets the premier add-ons of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_premier_add_ons.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} # type: ignore + + async def get_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets a named add-on of an app. + + Description for Gets a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def add_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + premier_add_on: "models.PremierAddOn", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Description for Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def delete_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + **kwargs + ) -> None: + """Delete a premier add-on from an app. + + Description for Delete a premier add-on from an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def update_premier_add_on( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + premier_add_on: "models.PremierAddOnPatchResource", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Description for Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_premier_add_on.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore + + async def get_private_access( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PrivateAccess": + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. + + Description for Gets data around private site access enablement and authorized Virtual Networks + that can access the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_private_access.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore + + async def put_private_access_vnet( + self, + resource_group_name: str, + name: str, + access: "models.PrivateAccess", + **kwargs + ) -> "models.PrivateAccess": + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. + + Description for Sets data around private site access enablement and authorized Virtual Networks + that can access the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param access: The information for the private access. + :type access: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_private_access_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(access, 'PrivateAccess') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_private_access_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore + + def list_processes( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_processes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} # type: ignore + + async def get_process( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore + + async def delete_process( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_process.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore + + async def get_process_dump( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_process_dump.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} # type: ignore + + def list_process_modules( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_modules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} # type: ignore + + async def get_process_module( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_process_module.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_process_threads( + self, + resource_group_name: str, + name: str, + process_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_threads.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} # type: ignore + + def list_public_certificates( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.PublicCertificateCollection"]: + """Get public certificates for an app or a deployment slot. + + Description for Get public certificates for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_public_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('PublicCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} # type: ignore + + async def get_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + **kwargs + ) -> "models.PublicCertificate": + """Get the named public certificate for an app (or deployment slot, if specified). + + Description for Get the named public certificate for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def create_or_update_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + public_certificate: "models.PublicCertificate", + **kwargs + ) -> "models.PublicCertificate": + """Creates a hostname binding for an app. + + Description for Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(public_certificate, 'PublicCertificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def delete_public_certificate( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Description for Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_public_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def list_publishing_profile_xml_with_secrets( + self, + resource_group_name: str, + name: str, + publishing_profile_options: "models.CsmPublishingProfileOptions", + **kwargs + ) -> IO: + """Gets the publishing profile for an app (or deployment slot, if specified). + + Description for Gets the publishing profile for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} # type: ignore + + async def reset_production_slot_config( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. + + Description for Resets the configuration settings of the current slot if they were previously + modified by calling the API with POST. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reset_production_slot_config.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} # type: ignore + + async def restart( + self, + resource_group_name: str, + name: str, + soft_restart: Optional[bool] = None, + synchronous: Optional[bool] = None, + **kwargs + ) -> None: + """Restarts an app (or deployment slot, if specified). + + Description for Restarts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. + :type soft_restart: bool + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). + :type synchronous: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.restart.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + if synchronous is not None: + query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} # type: ignore + + async def _restore_from_backup_blob_initial( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_backup_blob_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_backup_blob_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore + + async def begin_restore_from_backup_blob( + self, + resource_group_name: str, + name: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores an app from a backup blob in Azure Storage. + + Description for Restores an app from a backup blob in Azure Storage. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_backup_blob_initial( + resource_group_name=resource_group_name, + name=name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore + + async def _restore_from_deleted_app_initial( + self, + resource_group_name: str, + name: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_deleted_app_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_deleted_app_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore + + async def begin_restore_from_deleted_app( + self, + resource_group_name: str, + name: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a deleted web app to this web app. + + Description for Restores a deleted web app to this web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param restore_request: Deleted web app restore information. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_deleted_app_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore + + async def _restore_snapshot_initial( + self, + resource_group_name: str, + name: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_snapshot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_snapshot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore + + async def begin_restore_snapshot( + self, + resource_group_name: str, + name: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a web app from a snapshot. + + Description for Restores a web app from a snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_snapshot_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore + + def list_site_extensions( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SiteExtensionInfoCollection"]: + """Get list of siteextensions for a web site, or a deployment slot. + + Description for Get list of siteextensions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_extensions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SiteExtensionInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} # type: ignore + + async def get_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + """Get site extension information by its ID for a web site, or a deployment slot. + + Description for Get site extension information by its ID for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_extension.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _install_site_extension_initial( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._install_site_extension_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 429]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _install_site_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def begin_install_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> AsyncLROPoller["models.SiteExtensionInfo"]: + """Install site extension on a web site, or a deployment slot. + + Description for Install site extension on a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def delete_site_extension( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + **kwargs + ) -> None: + """Remove a site extension from a web site, or a deployment slot. + + Description for Remove a site extension from a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_site_extension.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _copy_production_slot_initial( + self, + resource_group_name: str, + name: str, + copy_slot_entity: "models.CsmCopySlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._copy_production_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _copy_production_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotcopy'} # type: ignore + + async def begin_copy_production_slot( + self, + resource_group_name: str, + name: str, + copy_slot_entity: "models.CsmCopySlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Copies a deployment slot to another deployment slot of an app. + + Description for Copies a deployment slot to another deployment slot of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param copy_slot_entity: JSON object that contains the target slot name and site config + properties to override the source slot config. See example. + :type copy_slot_entity: ~azure.mgmt.web.v2019_08_01.models.CsmCopySlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._copy_production_slot_initial( + resource_group_name=resource_group_name, + name=name, + copy_slot_entity=copy_slot_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_copy_production_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotcopy'} # type: ignore + + def list_slots( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebAppCollection"]: + """Gets an app's deployment slots. + + Description for Gets an app's deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slots.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} # type: ignore + + async def get_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional["models.Site"]: + """Gets the details of a web, mobile, or API app. + + Description for Gets the details of a web, mobile, or API app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. By default, this API returns the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def _create_or_update_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.Site", + **kwargs + ) -> "models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'Site') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def begin_create_or_update_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.Site", + **kwargs + ) -> AsyncLROPoller["models.Site"]: + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. + :type slot: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.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_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def delete_slot( + self, + resource_group_name: str, + name: str, + slot: str, + delete_metrics: Optional[bool] = None, + delete_empty_server_farm: Optional[bool] = None, + **kwargs + ) -> None: + """Deletes a web, mobile, or API app, or one of the deployment slots. + + Description for Deletes a web, mobile, or API app, or one of the deployment slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app to delete. + :type name: str + :param slot: Name of the deployment slot to delete. By default, the API deletes the production + slot. + :type slot: str + :param delete_metrics: If true, web app metrics are also deleted. + :type delete_metrics: bool + :param delete_empty_server_farm: Specify true if the App Service plan will be empty after app + deletion and you want to delete the empty App Service plan. By default, the empty App Service + plan is not deleted. + :type delete_empty_server_farm: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if delete_metrics is not None: + query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') + if delete_empty_server_farm is not None: + query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def update_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_envelope: "models.SitePatchResource", + **kwargs + ) -> "models.Site": + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. + :type slot: str + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_envelope, 'SitePatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore + + async def analyze_custom_hostname_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: Optional[str] = None, + **kwargs + ) -> "models.CustomHostnameAnalysisResult": + """Analyze a custom hostname. + + Description for Analyze a custom hostname. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param host_name: Custom hostname. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if host_name is not None: + query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} # type: ignore + + async def apply_slot_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + """Applies the configuration settings from the target slot onto the current slot. + + Description for Applies the configuration settings from the target slot onto the current slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} # type: ignore + + async def backup_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Creates a backup of an app. + + Description for Creates a backup of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + backup for the production slot. + :type slot: str + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} # type: ignore + + def list_backups_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Description for Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_backups_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} # type: ignore + + async def get_backup_status_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + **kwargs + ) -> "models.BackupItem": + """Gets a backup of an app by its ID. + + Description for Gets a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a backup + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_backup_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore + + async def delete_backup_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + **kwargs + ) -> None: + """Deletes a backup of an app by its ID. + + Description for Deletes a backup of an app by its ID. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + backup of the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore + + async def list_backup_status_secrets_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupItem": + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Description for Gets status of a web app backup that may be in progress, including secrets + associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the + SAS URL for the backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param backup_id: ID of backup. + :type backup_id: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param request: Information on backup request. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} # type: ignore + + async def _restore_slot_initial( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'backupId': self._serialize.url("backup_id", backup_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + async def begin_restore_slot( + self, + resource_group_name: str, + name: str, + backup_id: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a specific backup to another app (or deployment slot, if specified). + + Description for Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param backup_id: ID of the backup. + :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_slot_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + def list_configurations_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigResourceCollection"]: + """List the configurations of an app. + + Description for List the configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configurations_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteConfigResourceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} # type: ignore + + async def update_application_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + app_settings: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the application settings of an app. + + Description for Replaces the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + application settings for the production slot. + :type slot: str + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_application_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_settings, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} # type: ignore + + async def list_application_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the application settings of an app. + + Description for Gets the application settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + application settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_application_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} # type: ignore + + async def update_auth_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_auth_settings: "models.SiteAuthSettings", + **kwargs + ) -> "models.SiteAuthSettings": + """Updates the Authentication / Authorization settings associated with web app. + + Description for Updates the Authentication / Authorization settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_auth_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} # type: ignore + + async def get_auth_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteAuthSettings": + """Gets the Authentication/Authorization settings of an app. + + Description for Gets the Authentication/Authorization settings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_auth_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} # type: ignore + + async def update_azure_storage_accounts_slot( + self, + resource_group_name: str, + name: str, + slot: str, + azure_storage_accounts: "models.AzureStoragePropertyDictionaryResource", + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Updates the Azure storage account configurations of an app. + + Description for Updates the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. + :type slot: str + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts'} # type: ignore + + async def list_azure_storage_accounts_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.AzureStoragePropertyDictionaryResource": + """Gets the Azure storage account configurations of an app. + + Description for Gets the Azure storage account configurations of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list'} # type: ignore + + async def update_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.BackupRequest", + **kwargs + ) -> "models.BackupRequest": + """Updates the backup configuration of an app. + + Description for Updates the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + backup configuration for the production slot. + :type slot: str + :param request: Edited backup configuration. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'BackupRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore + + async def delete_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes the backup configuration of an app. + + Description for Deletes the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + backup configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore + + async def get_backup_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.BackupRequest": + """Gets the backup configuration of an app. + + Description for Gets the backup configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + backup configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_backup_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BackupRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} # type: ignore + + async def update_connection_strings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_strings: "models.ConnectionStringDictionary", + **kwargs + ) -> "models.ConnectionStringDictionary": + """Replaces the connection strings of an app. + + Description for Replaces the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + connection settings for the production slot. + :type slot: str + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_connection_strings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} # type: ignore + + async def list_connection_strings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.ConnectionStringDictionary": + """Gets the connection strings of an app. + + Description for Gets the connection strings of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + connection settings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_connection_strings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} # type: ignore + + async def get_diagnostic_logs_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteLogsConfig": + """Gets the logging configuration of an app. + + Description for Gets the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + logging configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore + + async def update_diagnostic_logs_config_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_logs_config: "models.SiteLogsConfig", + **kwargs + ) -> "models.SiteLogsConfig": + """Updates the logging configuration of an app. + + Description for Updates the logging configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + logging configuration for the production slot. + :type slot: str + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore + + async def update_metadata_slot( + self, + resource_group_name: str, + name: str, + slot: str, + metadata: "models.StringDictionary", + **kwargs + ) -> "models.StringDictionary": + """Replaces the metadata of an app. + + Description for Replaces the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + metadata for the production slot. + :type slot: str + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_metadata_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(metadata, 'StringDictionary') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} # type: ignore + + async def list_metadata_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Gets the metadata of an app. + + Description for Gets the metadata of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + metadata for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_metadata_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} # type: ignore + + async def _list_publishing_credentials_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.User": + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_publishing_credentials_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + async def begin_list_publishing_credentials_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncLROPoller["models.User"]: + """Gets the Git/FTP publishing credentials of an app. + + Description for Gets the Git/FTP publishing credentials of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing credentials for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.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._list_publishing_credentials_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore + + async def update_site_push_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + push_settings: "models.PushSettings", + **kwargs + ) -> "models.PushSettings": + """Updates the Push settings associated with web app. + + Description for Updates the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param push_settings: Push settings associated with web app. + :type push_settings: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_site_push_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(push_settings, 'PushSettings') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} # type: ignore + + async def list_site_push_settings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PushSettings": + """Gets the Push settings associated with web app. + + Description for Gets the Push settings associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_site_push_settings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PushSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} # type: ignore + + async def get_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. + + Description for Gets the configuration of an app, such as platform version and bitness, default + documents, virtual applications, Always On, etc. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + async def create_or_update_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Description for Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. + :type slot: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + async def update_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_config: "models.SiteConfigResource", + **kwargs + ) -> "models.SiteConfigResource": + """Updates the configuration of an app. + + Description for Updates the configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. + :type slot: str + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_config, 'SiteConfigResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore + + def list_configuration_snapshot_info_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteConfigurationSnapshotInfoCollection"]: + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. + + Description for Gets a list of web app configuration snapshots identifiers. Each element of the + list contains a timestamp and the ID of the snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_configuration_snapshot_info_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteConfigurationSnapshotInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} # type: ignore + + async def get_configuration_snapshot_slot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + slot: str, + **kwargs + ) -> "models.SiteConfigResource": + """Gets a snapshot of the configuration of an app at a previous point in time. + + Description for Gets a snapshot of the configuration of an app at a previous point in time. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} # type: ignore + + async def recover_site_configuration_snapshot_slot( + self, + resource_group_name: str, + name: str, + snapshot_id: str, + slot: str, + **kwargs + ) -> None: + """Reverts the configuration of an app to a previous snapshot. + + Description for Reverts the configuration of an app to a previous snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param snapshot_id: The ID of the snapshot to read. + :type snapshot_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} # type: ignore + + async def get_web_site_container_logs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Gets the last lines of docker logs for the given site. + + Description for Gets the last lines of docker logs for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/octet-stream' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} # type: ignore + + async def get_container_logs_zip_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Gets the ZIP archived docker log files for the given site. + + Description for Gets the ZIP archived docker log files for the given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/zip' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **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 = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} # type: ignore + + def list_continuous_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ContinuousWebJobCollection"]: + """List continuous web jobs for an app, or a deployment slot. + + Description for List continuous web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_continuous_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ContinuousWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} # type: ignore + + async def get_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> Optional["models.ContinuousWebJob"]: + """Gets a continuous web job by its ID for an app, or a deployment slot. + + Description for Gets a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore + + async def delete_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a continuous web job by its ID for an app, or a deployment slot. + + Description for Delete a continuous web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore + + async def start_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Start a continuous web job for an app, or a deployment slot. + + Description for Start a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} # type: ignore + + async def stop_continuous_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Stop a continuous web job for an app, or a deployment slot. + + Description for Stop a continuous web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} # type: ignore + + def list_deployments_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.DeploymentCollection"]: + """List deployments for an app, or a deployment slot. + + Description for List deployments for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_deployments_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('DeploymentCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} # type: ignore + + async def get_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> "models.Deployment": + """Get a deployment by its ID for an app, or a deployment slot. + + Description for Get a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets a deployment + for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def create_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + deployment: "models.Deployment", + **kwargs + ) -> "models.Deployment": + """Create a deployment for an app, or a deployment slot. + + Description for Create a deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: ID of an existing deployment. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API creates a + deployment for the production slot. + :type slot: str + :param deployment: Deployment details. + :type deployment: ~azure.mgmt.web.v2019_08_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def delete_deployment_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> None: + """Delete a deployment by its ID for an app, or a deployment slot. + + Description for Delete a deployment by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: Deployment ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_deployment_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore + + async def list_deployment_log_slot( + self, + resource_group_name: str, + name: str, + id: str, + slot: str, + **kwargs + ) -> "models.Deployment": + """List deployment log for specific deployment for an app, or a deployment slot. + + Description for List deployment log for specific deployment for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_deployment_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} # type: ignore + + async def discover_backup_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> "models.RestoreRequest": + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. + + Description for Discovers an existing app backup that can be restored from a blob in Azure + storage. Use this to get information about the databases stored in a backup. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will perform + discovery for the production slot. + :type slot: str + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.discover_backup_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestoreRequest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + discover_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup'} # type: ignore + + def list_domain_ownership_identifiers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """Lists ownership identifiers for domain associated with web app. + + Description for Lists ownership identifiers for domain associated with web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_domain_ownership_identifiers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} # type: ignore + + async def get_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + **kwargs + ) -> "models.Identifier": + """Get domain ownership identifier for web app. + + Description for Get domain ownership identifier for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def create_or_update_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def delete_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a domain ownership identifier for a web app. + + Description for Deletes a domain ownership identifier for a web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def update_domain_ownership_identifier_slot( + self, + resource_group_name: str, + name: str, + domain_ownership_identifier_name: str, + slot: str, + domain_ownership_identifier: "models.Identifier", + **kwargs + ) -> "models.Identifier": + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param domain_ownership_identifier_name: Name of domain ownership identifier. + :type domain_ownership_identifier_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Identifier', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore + + async def get_ms_deploy_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Description for Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def _create_ms_deploy_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def begin_create_ms_deploy_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Description for Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore + + async def get_ms_deploy_log_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Description for Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_functions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.FunctionEnvelopeCollection"]: + """List the functions for a web site, or a deployment slot. + + Description for List the functions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_functions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('FunctionEnvelopeCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} # type: ignore + + async def get_functions_admin_token_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> str: + """Fetch a short lived token that can be exchanged for a master key. + + Description for Fetch a short lived token that can be exchanged for a master key. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} # type: ignore + + async def get_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> Optional["models.FunctionEnvelope"]: + """Get function information by its ID for web site, or a deployment slot. + + Description for Get function information by its ID for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_function_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def _create_instance_function_slot_initial( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> "models.FunctionEnvelope": + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_function_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def begin_create_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + function_envelope: "models.FunctionEnvelope", + **kwargs + ) -> AsyncLROPoller["models.FunctionEnvelope"]: + """Create function for web site, or a deployment slot. + + Description for Create function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :param function_envelope: Function details. + :type function_envelope: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.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_instance_function_slot_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + slot=slot, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def delete_instance_function_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a function for web site, or a deployment slot. + + Description for Delete a function for web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_instance_function_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore + + async def create_or_update_function_secret_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + slot: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a function secret. + + Description for Add or update a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def delete_function_secret_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + key_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a function secret. + + Description for Delete a function secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: The name of the function. + :type function_name: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_function_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore + + async def list_function_keys_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> "models.StringDictionary": + """Get function keys for a function in a web site, or a deployment slot. + + Description for Get function keys for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_function_keys_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StringDictionary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys'} # type: ignore + + async def list_function_secrets_slot( + self, + resource_group_name: str, + name: str, + function_name: str, + slot: str, + **kwargs + ) -> "models.FunctionSecrets": + """Get function secrets for a function in a web site, or a deployment slot. + + Description for Get function secrets for a function in a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param function_name: Function name. + :type function_name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_function_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'functionName': self._serialize.url("function_name", function_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} # type: ignore + + async def list_host_keys_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.HostKeys": + """Get host secrets for a function app. + + Description for Get host secrets for a function app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_host_keys_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_host_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys'} # type: ignore + + async def list_sync_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """This is to allow calling via powershell and ARM template. + + Description for This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_sync_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + list_sync_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus'} # type: ignore + + async def sync_functions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Description for Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.sync_functions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync'} # type: ignore + + async def create_or_update_host_secret_slot( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + slot: str, + key: "models.KeyInfo", + **kwargs + ) -> "models.KeyInfo": + """Add or update a host level secret. + + Description for Add or update a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: str + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(key, 'KeyInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KeyInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore + + async def delete_host_secret_slot( + self, + resource_group_name: str, + name: str, + key_type: str, + key_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a host level secret. + + Description for Delete a host level secret. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param key_type: The type of host key. + :type key_type: str + :param key_name: The name of the key. + :type key_name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_host_secret_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'keyType': self._serialize.url("key_type", key_type, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore + + def list_host_name_bindings_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.HostNameBindingCollection"]: + """Get hostname bindings for an app or a deployment slot. + + Description for Get hostname bindings for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_host_name_bindings_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('HostNameBindingCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} # type: ignore + + async def get_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: str, + **kwargs + ) -> "models.HostNameBinding": + """Get the named hostname binding for an app (or deployment slot, if specified). + + Description for Get the named hostname binding for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. + :type slot: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def create_or_update_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + host_name: str, + slot: str, + host_name_binding: "models.HostNameBinding", + **kwargs + ) -> "models.HostNameBinding": + """Creates a hostname binding for an app. + + Description for Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param host_name: Hostname in the hostname binding. + :type host_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. + :type slot: str + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HostNameBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def delete_host_name_binding_slot( + self, + resource_group_name: str, + name: str, + slot: str, + host_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Description for Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param host_name: Hostname in the hostname binding. + :type host_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore + + async def get_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + Description for Retrieves a specific Service Bus Hybrid Connection used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def create_or_update_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Description for Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def delete_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + **kwargs + ) -> None: + """Removes a Hybrid Connection from this site. + + Description for Removes a Hybrid Connection from this site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def update_hybrid_connection_slot( + self, + resource_group_name: str, + name: str, + namespace_name: str, + relay_name: str, + slot: str, + connection_envelope: "models.HybridConnection", + **kwargs + ) -> "models.HybridConnection": + """Creates a new Hybrid Connection using a Service Bus relay. + + Description for Creates a new Hybrid Connection using a Service Bus relay. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param namespace_name: The namespace for this hybrid connection. + :type namespace_name: str + :param relay_name: The relay name for this hybrid connection. + :type relay_name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'relayName': self._serialize.url("relay_name", relay_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'HybridConnection') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore + + async def list_hybrid_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.HybridConnection": + """Retrieves all Service Bus Hybrid Connections used by this Web App. + + Description for Retrieves all Service Bus Hybrid Connections used by this Web App. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HybridConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} # type: ignore + + async def list_relay_service_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Description for Gets hybrid connections configured for an app (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get hybrid + connections for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} # type: ignore + + async def get_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Gets a hybrid connection configuration by its name. + + Description for Gets a hybrid connection configuration by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a hybrid + connection for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def create_or_update_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. + :type slot: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def delete_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a relay service connection by its name. + + Description for Deletes a relay service connection by its name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + hybrid connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + async def update_relay_service_connection_slot( + self, + resource_group_name: str, + name: str, + entity_name: str, + slot: str, + connection_envelope: "models.RelayServiceConnectionEntity", + **kwargs + ) -> "models.RelayServiceConnectionEntity": + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param entity_name: Name of the hybrid connection configuration. + :type entity_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. + :type slot: str + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'entityName': self._serialize.url("entity_name", entity_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore + + def list_instance_identifiers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.WebAppInstanceCollection"]: + """Gets all scale-out instances of an app. + + Description for Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_identifiers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('WebAppInstanceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} # type: ignore + + async def get_instance_info_slot( + self, + resource_group_name: str, + name: str, + instance_id: str, + slot: str, + **kwargs + ) -> "models.WebSiteInstanceStatus": + """Gets all scale-out instances of an app. + + Description for Gets all scale-out instances of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param instance_id: + :type instance_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebSiteInstanceStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebSiteInstanceStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_info_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebSiteInstanceStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}'} # type: ignore + + async def get_instance_ms_deploy_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> "models.MSDeployStatus": + """Get the status of the last MSDeploy operation. + + Description for Get the status of the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def _create_instance_ms_deploy_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> Optional["models.MSDeployStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(ms_deploy, 'MSDeploy') + 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 [201, 409]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_instance_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def begin_create_instance_ms_deploy_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + ms_deploy: "models.MSDeploy", + **kwargs + ) -> AsyncLROPoller["models.MSDeployStatus"]: + """Invoke the MSDeploy web app extension. + + Description for Invoke the MSDeploy web app extension. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :param ms_deploy: Details of MSDeploy operation. + :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.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_instance_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore + + async def get_instance_ms_deploy_log_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.MSDeployLog"]: + """Get the MSDeploy Log for the last MSDeploy operation. + + Description for Get the MSDeploy Log for the last MSDeploy operation. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param instance_id: ID of web app instance. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MSDeployLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore + + def list_instance_processes_slot( + self, + resource_group_name: str, + name: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_processes_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} # type: ignore + + async def get_instance_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def delete_instance_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_instance_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore + + async def get_instance_process_dump_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore + + def list_instance_process_modules_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_modules_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore + + async def get_instance_process_module_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + slot: str, + instance_id: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_instance_process_module_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_instance_process_threads_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + instance_id: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_instance_process_threads_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore + + async def is_cloneable_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteCloneability": + """Shows whether an app can be cloned to another resource group or subscription. + + Description for Shows whether an app can be cloned to another resource group or subscription. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. By default, this API returns information on the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.is_cloneable_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteCloneability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} # type: ignore + + def list_site_backups_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.BackupItemCollection"]: + """Gets existing backups of an app. + + Description for Gets existing backups of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_backups_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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.post(url, query_parameters, header_parameters) + else: + 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('BackupItemCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listbackups'} # type: ignore + + async def list_sync_function_triggers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.FunctionSecrets": + """This is to allow calling via powershell and ARM template. + + Description for This is to allow calling via powershell and ARM template. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FunctionSecrets', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} # type: ignore + + async def get_migrate_my_sql_status_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.MigrateMySqlStatus": + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. + + Description for Returns the status of MySql in app migration, if one is active, and whether or + not MySql in app is enabled. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} # type: ignore + + async def get_swift_virtual_network_connection_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Gets a Swift Virtual Network connection. + + Description for Gets a Swift Virtual Network connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def create_or_update_swift_virtual_network_connection_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def delete_swift_virtual_network_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a Swift Virtual Network connection from an app (or deployment slot). + + Description for Deletes a Swift Virtual Network connection from an app (or deployment slot). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_swift_virtual_network_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_swift_virtual_network_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def update_swift_virtual_network_connection_slot( + self, + resource_group_name: str, + name: str, + slot: str, + connection_envelope: "models.SwiftVirtualNetwork", + **kwargs + ) -> "models.SwiftVirtualNetwork": + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not + in use by another App Service Plan other than the one this App is in. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore + + async def list_network_features_slot( + self, + resource_group_name: str, + name: str, + view: str, + slot: str, + **kwargs + ) -> Optional["models.NetworkFeatures"]: + """Gets all network features used by the app (or deployment slot, if specified). + + Description for Gets all network features used by the app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param view: The type of view. This can either be "summary" or "detailed". + :type view: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get network + features for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_network_features_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'view': self._serialize.url("view", view, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkFeatures', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} # type: ignore + + async def get_network_trace_operation_slot( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}'} # type: ignore + + async def start_web_site_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> str: + """Start capturing network packets for the site (To be deprecated). + + Description for Start capturing network packets for the site (To be deprecated). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} # type: ignore + + async def _start_web_site_network_trace_operation_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_web_site_network_trace_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore + + async def begin_start_web_site_network_trace_operation_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Description for Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_web_site_network_trace_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore + + async def stop_web_site_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Description for Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} # type: ignore + + async def get_network_traces_slot( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_traces_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}'} # type: ignore + + async def get_network_trace_operation_slot_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_trace_operation_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}'} # type: ignore + + async def get_network_traces_slot_v2( + self, + resource_group_name: str, + name: str, + operation_id: str, + slot: str, + **kwargs + ) -> List["models.NetworkTrace"]: + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param operation_id: GUID of the operation. + :type operation_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_traces_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}'} # type: ignore + + async def generate_new_site_publishing_password_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Generates a new publishing password for an app (or deployment slot, if specified). + + Description for Generates a new publishing password for an app (or deployment slot, if + specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API generate a new + publishing password for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} # type: ignore + + def list_perf_mon_counters_slot( + self, + resource_group_name: str, + name: str, + slot: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.PerfMonCounterCollection"]: + """Gets perfmon counters for web app. + + Description for Gets perfmon counters for web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_perf_mon_counters_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} # type: ignore + + async def get_site_php_error_log_flag_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SitePhpErrorLogFlag": + """Gets web app's event logs. + + Description for Gets web app's event logs. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} # type: ignore + + async def list_premier_add_ons_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets the premier add-ons of an app. + + Description for Gets the premier add-ons of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + premier add-ons for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} # type: ignore + + async def get_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + **kwargs + ) -> "models.PremierAddOn": + """Gets a named add-on of an app. + + Description for Gets a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named add-on for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def add_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + premier_add_on: "models.PremierAddOn", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Description for Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. + :type slot: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def delete_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a premier add-on from an app. + + Description for Delete a premier add-on from an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + named add-on for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def update_premier_add_on_slot( + self, + resource_group_name: str, + name: str, + premier_add_on_name: str, + slot: str, + premier_add_on: "models.PremierAddOnPatchResource", + **kwargs + ) -> "models.PremierAddOn": + """Updates a named add-on of an app. + + Description for Updates a named add-on of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param premier_add_on_name: Add-on name. + :type premier_add_on_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. + :type slot: str + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_premier_add_on_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PremierAddOn', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore + + async def get_private_access_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.PrivateAccess": + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. + + Description for Gets data around private site access enablement and authorized Virtual Networks + that can access the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_private_access_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_access_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore + + async def put_private_access_vnet_slot( + self, + resource_group_name: str, + name: str, + slot: str, + access: "models.PrivateAccess", + **kwargs + ) -> "models.PrivateAccess": + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. + + Description for Sets data around private site access enablement and authorized Virtual Networks + that can access the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for the web app. + :type slot: str + :param access: The information for the private access. + :type access: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(access, 'PrivateAccess') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateAccess', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_private_access_vnet_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore + + async def get_private_endpoint_connection( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "models.PrivateEndpointConnectionResource": + """Gets a private endpoint connection. + + Description for Gets a private endpoint connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the site. + :type name: str + :param private_endpoint_connection_name: + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_private_endpoint_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _approve_or_reject_private_endpoint_connection_initial( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + private_endpoint_wrapper: "models.PrivateLinkConnectionApprovalRequestResource", + **kwargs + ) -> "models.PrivateEndpointConnectionResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._approve_or_reject_private_endpoint_connection_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_wrapper, 'PrivateLinkConnectionApprovalRequestResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _approve_or_reject_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_approve_or_reject_private_endpoint_connection( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + private_endpoint_wrapper: "models.PrivateLinkConnectionApprovalRequestResource", + **kwargs + ) -> AsyncLROPoller["models.PrivateEndpointConnectionResource"]: + """Approves or rejects a private endpoint connection. + + Description for Approves or rejects a private endpoint connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the site. + :type name: str + :param private_endpoint_connection_name: + :type private_endpoint_connection_name: str + :param private_endpoint_wrapper: + :type private_endpoint_wrapper: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionApprovalRequestResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] + lro_delay = kwargs.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._approve_or_reject_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_wrapper=private_endpoint_wrapper, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_approve_or_reject_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_private_endpoint_connection_initial( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> object: + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._delete_private_endpoint_connection_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 204: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete_private_endpoint_connection( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Deletes a private endpoint connection. + + Description for Deletes a private endpoint connection. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the site. + :type name: str + :param private_endpoint_connection_name: + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.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_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def get_private_link_resources( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.PrivateLinkResourcesWrapper": + """Gets the private link resources. + + Description for Gets the private link resources. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the site. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesWrapper, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkResourcesWrapper + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesWrapper"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesWrapper', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateLinkResources'} # type: ignore + + def list_processes_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessInfoCollection"]: + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_processes_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} # type: ignore + + async def get_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore + + async def delete_process_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> None: + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_process_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore + + async def get_process_dump_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> Optional[IO]: + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_process_dump_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} # type: ignore + + def list_process_modules_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessModuleInfoCollection"]: + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_modules_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessModuleInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} # type: ignore + + async def get_process_module_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + base_address: str, + slot: str, + **kwargs + ) -> Optional["models.ProcessModuleInfo"]: + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param base_address: Module base address. + :type base_address: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_process_module_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'baseAddress': self._serialize.url("base_address", base_address, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} # type: ignore + + def list_process_threads_slot( + self, + resource_group_name: str, + name: str, + process_id: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.ProcessThreadInfoCollection"]: + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param process_id: PID. + :type process_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_process_threads_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'processId': self._serialize.url("process_id", process_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('ProcessThreadInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} # type: ignore + + def list_public_certificates_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.PublicCertificateCollection"]: + """Get public certificates for an app or a deployment slot. + + Description for Get public certificates for an app or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_public_certificates_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('PublicCertificateCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} # type: ignore + + async def get_public_certificate_slot( + self, + resource_group_name: str, + name: str, + slot: str, + public_certificate_name: str, + **kwargs + ) -> "models.PublicCertificate": + """Get the named public certificate for an app (or deployment slot, if specified). + + Description for Get the named public certificate for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. + :type slot: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def create_or_update_public_certificate_slot( + self, + resource_group_name: str, + name: str, + public_certificate_name: str, + slot: str, + public_certificate: "models.PublicCertificate", + **kwargs + ) -> "models.PublicCertificate": + """Creates a hostname binding for an app. + + Description for Creates a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param public_certificate_name: Public certificate name. + :type public_certificate_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. + :type slot: str + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(public_certificate, 'PublicCertificate') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublicCertificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def delete_public_certificate_slot( + self, + resource_group_name: str, + name: str, + slot: str, + public_certificate_name: str, + **kwargs + ) -> None: + """Deletes a hostname binding for an app. + + Description for Deletes a hostname binding for an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. + :type slot: str + :param public_certificate_name: Public certificate name. + :type public_certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_public_certificate_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore + + async def list_publishing_profile_xml_with_secrets_slot( + self, + resource_group_name: str, + name: str, + slot: str, + publishing_profile_options: "models.CsmPublishingProfileOptions", + **kwargs + ) -> IO: + """Gets the publishing profile for an app (or deployment slot, if specified). + + Description for Gets the publishing profile for an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing profile for the production slot. + :type slot: str + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} # type: ignore + + async def reset_slot_configuration_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. + + Description for Resets the configuration settings of the current slot if they were previously + modified by calling the API with POST. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API resets + configuration settings for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} # type: ignore + + async def restart_slot( + self, + resource_group_name: str, + name: str, + slot: str, + soft_restart: Optional[bool] = None, + synchronous: Optional[bool] = None, + **kwargs + ) -> None: + """Restarts an app (or deployment slot, if specified). + + Description for Restarts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restart the + production slot. + :type slot: str + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. + :type soft_restart: bool + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). + :type synchronous: bool + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.restart_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if soft_restart is not None: + query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') + if synchronous is not None: + query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} # type: ignore + + async def _restore_from_backup_blob_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_backup_blob_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'RestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_backup_blob_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore + + async def begin_restore_from_backup_blob_slot( + self, + resource_group_name: str, + name: str, + slot: str, + request: "models.RestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores an app from a backup blob in Azure Storage. + + Description for Restores an app from a backup blob in Azure Storage. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str + :param request: Information on restore request . + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_backup_blob_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore + + async def _restore_from_deleted_app_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_from_deleted_app_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_deleted_app_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore + + async def begin_restore_from_deleted_app_slot( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.DeletedAppRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a deleted web app to this web app. + + Description for Restores a deleted web app to this web app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param restore_request: Deleted web app restore information. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_from_deleted_app_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore + + async def _restore_snapshot_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restore_snapshot_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_snapshot_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore + + async def begin_restore_snapshot_slot( + self, + resource_group_name: str, + name: str, + slot: str, + restore_request: "models.SnapshotRestoreRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Restores a web app from a snapshot. + + Description for Restores a web app from a snapshot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._restore_snapshot_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore + + def list_site_extensions_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SiteExtensionInfoCollection"]: + """Get list of siteextensions for a web site, or a deployment slot. + + Description for Get list of siteextensions for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_extensions_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SiteExtensionInfoCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} # type: ignore + + async def get_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + """Get site extension information by its ID for a web site, or a deployment slot. + + Description for Get site extension information by its ID for a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_site_extension_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _install_site_extension_slot_initial( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> Optional["models.SiteExtensionInfo"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 429]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _install_site_extension_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def begin_install_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> AsyncLROPoller["models.SiteExtensionInfo"]: + """Install site extension on a web site, or a deployment slot. + + Description for Install site extension on a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.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._install_site_extension_slot_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def delete_site_extension_slot( + self, + resource_group_name: str, + name: str, + site_extension_id: str, + slot: str, + **kwargs + ) -> None: + """Remove a site extension from a web site, or a deployment slot. + + Description for Remove a site extension from a web site, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param site_extension_id: Site extension name. + :type site_extension_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_site_extension_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore + + async def _copy_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + copy_slot_entity: "models.CsmCopySlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._copy_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _copy_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotcopy'} # type: ignore + + async def begin_copy_slot( + self, + resource_group_name: str, + name: str, + slot: str, + copy_slot_entity: "models.CsmCopySlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Copies a deployment slot to another deployment slot of an app. + + Description for Copies a deployment slot to another deployment slot of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param copy_slot_entity: JSON object that contains the target slot name and site config + properties to override the source slot config. See example. + :type copy_slot_entity: ~azure.mgmt.web.v2019_08_01.models.CsmCopySlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._copy_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + copy_slot_entity=copy_slot_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_copy_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotcopy'} # type: ignore + + def list_slot_differences_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncIterable["models.SlotDifferenceCollection"]: + """Get the difference in configuration settings between two web app slots. + + Description for Get the difference in configuration settings between two web app slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slot_differences_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} # type: ignore + + async def _swap_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._swap_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _swap_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + async def begin_swap_slot( + self, + resource_group_name: str, + name: str, + slot: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Swaps two deployment slots of an app. + + Description for Swaps two deployment slots of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. + :type slot: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._swap_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + def list_snapshots_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user. + + Description for Returns all Snapshots to the user. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :param slot: Website Slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} # type: ignore + + def list_snapshots_from_dr_secondary_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user from DRSecondary endpoint. + + Description for Returns all Snapshots to the user from DRSecondary endpoint. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :param slot: Website Slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_from_dr_secondary_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr'} # type: ignore + + async def get_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> "models.SiteSourceControl": + """Gets the source control configuration of an app. + + Description for Gets the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + source control configuration for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def _create_or_update_source_control_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_source_control_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def begin_create_or_update_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> AsyncLROPoller["models.SiteSourceControl"]: + """Updates the source control configuration of an app. + + Description for Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. + :type slot: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.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_source_control_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def delete_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Deletes the source control configuration of an app. + + Description for Deletes the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + source control configuration for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def update_source_control_slot( + self, + resource_group_name: str, + name: str, + slot: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + """Updates the source control configuration of an app. + + Description for Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. + :type slot: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore + + async def start_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Starts an app (or deployment slot, if specified). + + Description for Starts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will start the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.start_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} # type: ignore + + async def _start_network_trace_slot_initial( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_network_trace_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore + + async def begin_start_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Description for Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_network_trace_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore + + async def stop_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stops an app (or deployment slot, if specified). + + Description for Stops an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will stop the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} # type: ignore + + async def stop_network_trace_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Description for Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param slot: The name of the slot for this web app. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_network_trace_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace'} # type: ignore + + async def sync_repository_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Sync web app repository. + + Description for Sync web app repository. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.sync_repository_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} # type: ignore + + async def sync_function_triggers_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Description for Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.sync_function_triggers_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} # type: ignore + + def list_triggered_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.TriggeredWebJobCollection"]: + """List triggered web jobs for an app, or a deployment slot. + + Description for List triggered web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('TriggeredWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} # type: ignore + + async def get_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> Optional["models.TriggeredWebJob"]: + """Gets a triggered web job by its ID for an app, or a deployment slot. + + Description for Gets a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore + + async def delete_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Delete a triggered web job by its ID for an app, or a deployment slot. + + Description for Delete a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes web job + for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore + + def list_triggered_web_job_history_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.TriggeredJobHistoryCollection"]: + """List a triggered web job's history for an app, or a deployment slot. + + Description for List a triggered web job's history for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_job_history_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('TriggeredJobHistoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} # type: ignore + + async def get_triggered_web_job_history_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + id: str, + slot: str, + **kwargs + ) -> Optional["models.TriggeredJobHistory"]: + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Description for Gets a triggered web job's history by its ID for an app, , or a deployment + slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param id: History ID. + :type id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore + + async def run_triggered_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> None: + """Run a triggered web job for an app, or a deployment slot. + + Description for Run a triggered web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} # type: ignore + + def list_usages_slot( + self, + resource_group_name: str, + name: str, + slot: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets the quota usage information of an app (or deployment slot, if specified). + + Description for Gets the quota usage information of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get quota + information of the production slot. + :type slot: str + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} # type: ignore + + async def list_vnet_connections_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Gets the virtual networks the app (or deployment slot) is connected to. + + Description for Gets the virtual networks the app (or deployment slot) is connected to. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get virtual + network connections for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_vnet_connections_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + **kwargs + ) -> "models.VnetInfo": + """Gets a virtual network the app (or deployment slot) is connected to by name. + + Description for Gets a virtual network the app (or deployment slot) is connected to by name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named virtual network for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def create_or_update_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def delete_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + **kwargs + ) -> None: + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Description for Deletes a connection from an app (or deployment slot to a named virtual + network. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. + :type slot: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def update_vnet_connection_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + slot: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. + :type slot: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + **kwargs + ) -> Optional["models.VnetGateway"]: + """Gets an app's Virtual Network gateway. + + Description for Gets an app's Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def create_or_update_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. + :type slot: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_connection_gateway_slot( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + slot: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. + :type slot: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + def list_web_jobs_slot( + self, + resource_group_name: str, + name: str, + slot: str, + **kwargs + ) -> AsyncIterable["models.WebJobCollection"]: + """List webjobs for an app, or a deployment slot. + + Description for List webjobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_jobs_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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: + 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('WebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} # type: ignore + + async def get_web_job_slot( + self, + resource_group_name: str, + name: str, + web_job_name: str, + slot: str, + **kwargs + ) -> "models.WebJob": + """Get webjob information for an app, or a deployment slot. + + Description for Get webjob information for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of the web job. + :type web_job_name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. + :type slot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_web_job_slot.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'slot': self._serialize.url("slot", slot, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} # type: ignore + + def list_slot_differences_from_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncIterable["models.SlotDifferenceCollection"]: + """Get the difference in configuration settings between two web app slots. + + Description for Get the difference in configuration settings between two web app slots. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_slot_differences_from_production.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} # type: ignore + + async def _swap_slot_with_production_initial( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _swap_slot_with_production_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + async def begin_swap_slot_with_production( + self, + resource_group_name: str, + name: str, + slot_swap_entity: "models.CsmSlotEntity", + **kwargs + ) -> AsyncLROPoller[None]: + """Swaps two deployment slots of an app. + + Description for Swaps two deployment slots of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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: + """ + 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._swap_slot_with_production_initial( + resource_group_name=resource_group_name, + name=name, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + def list_snapshots( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user. + + Description for Returns all Snapshots to the user. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} # type: ignore + + def list_snapshots_from_dr_secondary( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.SnapshotCollection"]: + """Returns all Snapshots to the user from DRSecondary endpoint. + + Description for Returns all Snapshots to the user from DRSecondary endpoint. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Website Name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_snapshots_from_dr_secondary.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('SnapshotCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr'} # type: ignore + + async def get_source_control( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> "models.SiteSourceControl": + """Gets the source control configuration of an app. + + Description for Gets the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def _create_or_update_source_control_initial( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_source_control_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def begin_create_or_update_source_control( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> AsyncLROPoller["models.SiteSourceControl"]: + """Updates the source control configuration of an app. + + Description for Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.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_source_control_initial( + resource_group_name=resource_group_name, + name=name, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def delete_source_control( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Deletes the source control configuration of an app. + + Description for Deletes the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def update_source_control( + self, + resource_group_name: str, + name: str, + site_source_control: "models.SiteSourceControl", + **kwargs + ) -> "models.SiteSourceControl": + """Updates the source control configuration of an app. + + Description for Updates the source control configuration of an app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + 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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore + + async def start( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Starts an app (or deployment slot, if specified). + + Description for Starts an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.start.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} # type: ignore + + async def _start_network_trace_initial( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> List["models.NetworkTrace"]: + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self._start_network_trace_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if duration_in_seconds is not None: + query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') + if max_frame_length is not None: + query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') + if sas_url is not None: + query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _start_network_trace_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore + + async def begin_start_network_trace( + self, + resource_group_name: str, + name: str, + duration_in_seconds: Optional[int] = None, + max_frame_length: Optional[int] = None, + sas_url: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[List["models.NetworkTrace"]]: + """Start capturing network packets for the site. + + Description for Start capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type name: str + :param duration_in_seconds: The duration to keep capturing in seconds. + :type duration_in_seconds: int + :param max_frame_length: The maximum frame length in bytes (Optional). + :type max_frame_length: int + :param sas_url: The Blob URL to store capture file. + :type sas_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.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_network_trace_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore + + async def stop( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stops an app (or deployment slot, if specified). + + Description for Stops an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} # type: ignore + + async def stop_network_trace( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Stop ongoing capturing network packets for the site. + + Description for Stop ongoing capturing network packets for the site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: The name of the web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.stop_network_trace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + stop_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace'} # type: ignore + + async def sync_repository( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Sync web app repository. + + Description for Sync web app repository. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of web app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.sync_repository.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} # type: ignore + + async def sync_function_triggers( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> None: + """Syncs function trigger metadata to the management database. + + Description for Syncs function trigger metadata to the management database. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.sync_function_triggers.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} # type: ignore + + def list_triggered_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.TriggeredWebJobCollection"]: + """List triggered web jobs for an app, or a deployment slot. + + Description for List triggered web jobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('TriggeredWebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} # type: ignore + + async def get_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> Optional["models.TriggeredWebJob"]: + """Gets a triggered web job by its ID for an app, or a deployment slot. + + Description for Gets a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore + + async def delete_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Delete a triggered web job by its ID for an app, or a deployment slot. + + Description for Delete a triggered web job by its ID for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore + + def list_triggered_web_job_history( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> AsyncIterable["models.TriggeredJobHistoryCollection"]: + """List a triggered web job's history for an app, or a deployment slot. + + Description for List a triggered web job's history for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_triggered_web_job_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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: + 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('TriggeredJobHistoryCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} # type: ignore + + async def get_triggered_web_job_history( + self, + resource_group_name: str, + name: str, + web_job_name: str, + id: str, + **kwargs + ) -> Optional["models.TriggeredJobHistory"]: + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Description for Gets a triggered web job's history by its ID for an app, , or a deployment + slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_name: str + :param id: History ID. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_triggered_web_job_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + 'id': self._serialize.url("id", id, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore + + async def run_triggered_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> None: + """Run a triggered web job for an app, or a deployment slot. + + Description for Run a triggered web job for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of Web Job. + :type web_job_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.run_triggered_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} # type: ignore + + def list_usages( + self, + resource_group_name: str, + name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.CsmUsageQuotaCollection"]: + """Gets the quota usage information of an app (or deployment slot, if specified). + + Description for Gets the quota usage information of an app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} # type: ignore + + async def list_vnet_connections( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> List["models.VnetInfo"]: + """Gets the virtual networks the app (or deployment slot) is connected to. + + Description for Gets the virtual networks the app (or deployment slot) is connected to. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_vnet_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VnetInfo]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} # type: ignore + + async def get_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> "models.VnetInfo": + """Gets a virtual network the app (or deployment slot) is connected to by name. + + Description for Gets a virtual network the app (or deployment slot) is connected to by name. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def create_or_update_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def delete_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + **kwargs + ) -> None: + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Description for Deletes a connection from an app (or deployment slot to a named virtual + network. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the virtual network. + :type vnet_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.delete_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def update_vnet_connection( + self, + resource_group_name: str, + name: str, + vnet_name: str, + connection_envelope: "models.VnetInfo", + **kwargs + ) -> "models.VnetInfo": + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of an existing Virtual Network. + :type vnet_name: str + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetInfo') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore + + async def get_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + **kwargs + ) -> Optional["models.VnetGateway"]: + """Gets an app's Virtual Network gateway. + + Description for Gets an app's Virtual Network gateway. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def create_or_update_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + async def update_vnet_connection_gateway( + self, + resource_group_name: str, + name: str, + vnet_name: str, + gateway_name: str, + connection_envelope: "models.VnetGateway", + **kwargs + ) -> "models.VnetGateway": + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param vnet_name: Name of the Virtual Network. + :type vnet_name: str + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". + :type gateway_name: str + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection_envelope, 'VnetGateway') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore + + def list_web_jobs( + self, + resource_group_name: str, + name: str, + **kwargs + ) -> AsyncIterable["models.WebJobCollection"]: + """List webjobs for an app, or a deployment slot. + + Description for List webjobs for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_web_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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: + 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('WebJobCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} # type: ignore + + async def get_web_job( + self, + resource_group_name: str, + name: str, + web_job_name: str, + **kwargs + ) -> "models.WebJob": + """Get webjob information for an app, or a deployment slot. + + Description for Get webjob information for an app, or a deployment slot. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Site name. + :type name: str + :param web_job_name: Name of the web job. + :type web_job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_web_job.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WebJob', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py new file mode 100644 index 000000000000..dab54cc131fc --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py @@ -0,0 +1,1018 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebSiteManagementClientOperationsMixin: + + async def get_publishing_user( + self, + **kwargs + ) -> "models.User": + """Gets publishing user. + + Description for Gets publishing user. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_publishing_user.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'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore + + async def update_publishing_user( + self, + user_details: "models.User", + **kwargs + ) -> "models.User": + """Updates publishing user. + + Description for Updates publishing user. + + :param user_details: Details of publishing user. + :type user_details: ~azure.mgmt.web.v2019_08_01.models.User + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_publishing_user.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_details, 'User') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore + + def list_source_controls( + self, + **kwargs + ) -> AsyncIterable["models.SourceControlCollection"]: + """Gets the source controls available for Azure websites. + + Description for Gets the source controls available for Azure websites. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_source_controls.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: + 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('SourceControlCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} # type: ignore + + async def get_source_control( + self, + source_control_type: str, + **kwargs + ) -> "models.SourceControl": + """Gets source control token. + + Description for Gets source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore + + async def update_source_control( + self, + source_control_type: str, + request_message: "models.SourceControl", + **kwargs + ) -> "models.SourceControl": + """Updates source control token. + + Description for Updates source control token. + + :param source_control_type: Type of source control. + :type source_control_type: str + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_source_control.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request_message, 'SourceControl') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore + + def list_billing_meters( + self, + billing_location: Optional[str] = None, + os_type: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.BillingMeterCollection"]: + """Gets a list of meters for a given location. + + Description for Gets a list of meters for a given location. + + :param billing_location: Azure Location of billable resource. + :type billing_location: str + :param os_type: App Service OS type meters used for. + :type os_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_billing_meters.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] + if billing_location is not None: + query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') + if os_type is not None: + query_parameters['osType'] = self._serialize.query("os_type", os_type, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BillingMeterCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_billing_meters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} # type: ignore + + async def check_name_availability( + self, + name: str, + type: Union[str, "models.CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ) -> "models.ResourceNameAvailability": + """Check if a resource name is available. + + Description for Check if a resource name is available. + + :param name: Resource name to verify. + :type name: str + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes + :param is_fqdn: Is fully qualified domain name. + :type is_fqdn: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceNameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} # type: ignore + + async def get_subscription_deployment_locations( + self, + **kwargs + ) -> "models.DeploymentLocations": + """Gets list of available geo regions plus ministamps. + + Description for Gets list of available geo regions plus ministamps. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_subscription_deployment_locations.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentLocations', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} # type: ignore + + def list_geo_regions( + self, + sku: Optional[Union[str, "models.SkuName"]] = None, + linux_workers_enabled: Optional[bool] = None, + xenon_workers_enabled: Optional[bool] = None, + linux_dynamic_workers_enabled: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.GeoRegionCollection"]: + """Get a list of available geographical regions. + + Description for Get a list of available geographical regions. + + :param sku: Name of SKU used to filter the regions. + :type sku: str or ~azure.mgmt.web.v2019_08_01.models.SkuName + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. + :type linux_workers_enabled: bool + :param xenon_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Xenon workers. + :type xenon_workers_enabled: bool + :param linux_dynamic_workers_enabled: Specify :code:`true` if you want to filter + to only regions that support Linux Consumption Workers. + :type linux_dynamic_workers_enabled: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_geo_regions.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] + if sku is not None: + query_parameters['sku'] = self._serialize.query("sku", sku, 'str') + if linux_workers_enabled is not None: + query_parameters['linuxWorkersEnabled'] = self._serialize.query("linux_workers_enabled", linux_workers_enabled, 'bool') + if xenon_workers_enabled is not None: + query_parameters['xenonWorkersEnabled'] = self._serialize.query("xenon_workers_enabled", xenon_workers_enabled, 'bool') + if linux_dynamic_workers_enabled is not None: + query_parameters['linuxDynamicWorkersEnabled'] = self._serialize.query("linux_dynamic_workers_enabled", linux_dynamic_workers_enabled, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GeoRegionCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} # type: ignore + + def list_site_identifiers_assigned_to_host_name( + self, + name_identifier: "models.NameIdentifier", + **kwargs + ) -> AsyncIterable["models.IdentifierCollection"]: + """List all apps that are assigned to a hostname. + + Description for List all apps that are assigned to a hostname. + + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_site_identifiers_assigned_to_host_name.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') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} # type: ignore + + def list_premier_add_on_offers( + self, + **kwargs + ) -> AsyncIterable["models.PremierAddOnOfferCollection"]: + """List all premier add-on offers. + + Description for List all premier add-on offers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_premier_add_on_offers.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: + 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('PremierAddOnOfferCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} # type: ignore + + async def list_skus( + self, + **kwargs + ) -> "models.SkuInfos": + """List all SKUs. + + Description for List all SKUs. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.list_skus.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SkuInfos', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} # type: ignore + + async def verify_hosting_environment_vnet( + self, + parameters: "models.VnetParameters", + **kwargs + ) -> "models.VnetValidationFailureDetails": + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + + Description for Verifies if this VNET is compatible with an App Service Environment by + analyzing the Network Security Group rules. + + :param parameters: VNET information. + :type parameters: ~azure.mgmt.web.v2019_08_01.models.VnetParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.verify_hosting_environment_vnet.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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VnetParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VnetValidationFailureDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} # type: ignore + + async def move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Move resources between resource groups. + + Description for Move resources between resource groups. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.move.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} # type: ignore + + async def validate( + self, + resource_group_name: str, + validate_request: "models.ValidateRequest", + **kwargs + ) -> "models.ValidateResponse": + """Validate if a resource can be created. + + Description for Validate if a resource can be created. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param validate_request: Request with the resources to validate. + :type validate_request: ~azure.mgmt.web.v2019_08_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_request, 'ValidateRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ValidateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} # type: ignore + + async def validate_move( + self, + resource_group_name: str, + move_resource_envelope: "models.CsmMoveResourceEnvelope", + **kwargs + ) -> None: + """Validate whether a resource can be moved. + + Description for Validate whether a resource can be moved. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_move.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/__init__.py index 20fd72f8964f..8f9f743bcffc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: @@ -18,19 +15,24 @@ from ._models_py3 import ApiDefinitionInfo from ._models_py3 import ApiKVReference from ._models_py3 import ApiManagementConfig - from ._models_py3 import ApplicationLogsConfig - from ._models_py3 import ApplicationStack - from ._models_py3 import ApplicationStackResource from ._models_py3 import AppServiceCertificate + from ._models_py3 import AppServiceCertificateCollection from ._models_py3 import AppServiceCertificateOrder + from ._models_py3 import AppServiceCertificateOrderCollection from ._models_py3 import AppServiceCertificateOrderPatchResource from ._models_py3 import AppServiceCertificatePatchResource from ._models_py3 import AppServiceCertificateResource from ._models_py3 import AppServiceEnvironment + from ._models_py3 import AppServiceEnvironmentCollection from ._models_py3 import AppServiceEnvironmentPatchResource from ._models_py3 import AppServiceEnvironmentResource from ._models_py3 import AppServicePlan + from ._models_py3 import AppServicePlanCollection from ._models_py3 import AppServicePlanPatchResource + from ._models_py3 import ApplicationLogsConfig + from ._models_py3 import ApplicationStack + from ._models_py3 import ApplicationStackCollection + from ._models_py3 import ApplicationStackResource from ._models_py3 import ArmIdWrapper from ._models_py3 import AutoHealActions from ._models_py3 import AutoHealCustomAction @@ -42,19 +44,23 @@ from ._models_py3 import AzureStoragePropertyDictionaryResource from ._models_py3 import AzureTableStorageApplicationLogsConfig from ._models_py3 import BackupItem + from ._models_py3 import BackupItemCollection from ._models_py3 import BackupRequest from ._models_py3 import BackupSchedule from ._models_py3 import BillingMeter + from ._models_py3 import BillingMeterCollection from ._models_py3 import Capability from ._models_py3 import Certificate + from ._models_py3 import CertificateCollection from ._models_py3 import CertificateDetails from ._models_py3 import CertificateEmail from ._models_py3 import CertificateOrderAction from ._models_py3 import CertificatePatchResource from ._models_py3 import CloningInfo - from ._models_py3 import ConnectionStringDictionary + from ._models_py3 import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties from ._models_py3 import ConnStringInfo from ._models_py3 import ConnStringValueTypePair + from ._models_py3 import ConnectionStringDictionary from ._models_py3 import Contact from ._models_py3 import ContainerCpuStatistics from ._models_py3 import ContainerCpuUsage @@ -63,42 +69,55 @@ from ._models_py3 import ContainerNetworkInterfaceStatistics from ._models_py3 import ContainerThrottlingData from ._models_py3 import ContinuousWebJob + from ._models_py3 import ContinuousWebJobCollection from ._models_py3 import CorsSettings from ._models_py3 import CsmCopySlotEntity from ._models_py3 import CsmMoveResourceEnvelope + from ._models_py3 import CsmOperationCollection from ._models_py3 import CsmOperationDescription from ._models_py3 import CsmOperationDescriptionProperties from ._models_py3 import CsmOperationDisplay + from ._models_py3 import CsmPublishingCredentialsPoliciesCollection + from ._models_py3 import CsmPublishingCredentialsPoliciesEntity from ._models_py3 import CsmPublishingProfileOptions from ._models_py3 import CsmSlotEntity from ._models_py3 import CsmUsageQuota + from ._models_py3 import CsmUsageQuotaCollection from ._models_py3 import CustomHostnameAnalysisResult - from ._models_py3 import DatabaseBackupSetting from ._models_py3 import DataSource from ._models_py3 import DataTableResponseColumn from ._models_py3 import DataTableResponseObject - from ._models_py3 import DefaultErrorResponse, DefaultErrorResponseException + from ._models_py3 import DatabaseBackupSetting + from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem from ._models_py3 import DeletedAppRestoreRequest from ._models_py3 import DeletedSite + from ._models_py3 import DeletedWebAppCollection from ._models_py3 import Deployment + from ._models_py3 import DeploymentCollection from ._models_py3 import DeploymentLocations from ._models_py3 import DetectorAbnormalTimePeriod from ._models_py3 import DetectorDefinition from ._models_py3 import DetectorInfo from ._models_py3 import DetectorResponse + from ._models_py3 import DetectorResponseCollection from ._models_py3 import DiagnosticAnalysis + from ._models_py3 import DiagnosticAnalysisCollection from ._models_py3 import DiagnosticCategory + from ._models_py3 import DiagnosticCategoryCollection from ._models_py3 import DiagnosticData + from ._models_py3 import DiagnosticDetectorCollection from ._models_py3 import DiagnosticDetectorResponse from ._models_py3 import DiagnosticMetricSample from ._models_py3 import DiagnosticMetricSet from ._models_py3 import Dimension from ._models_py3 import Domain from ._models_py3 import DomainAvailabilityCheckResult + from ._models_py3 import DomainCollection from ._models_py3 import DomainControlCenterSsoRequest from ._models_py3 import DomainOwnershipIdentifier + from ._models_py3 import DomainOwnershipIdentifierCollection from ._models_py3 import DomainPatchResource from ._models_py3 import DomainPurchaseConsent from ._models_py3 import DomainRecommendationSearchParameters @@ -110,51 +129,60 @@ from ._models_py3 import FileSystemApplicationLogsConfig from ._models_py3 import FileSystemHttpLogsConfig from ._models_py3 import FunctionEnvelope + from ._models_py3 import FunctionEnvelopeCollection from ._models_py3 import FunctionSecrets from ._models_py3 import GeoRegion + from ._models_py3 import GeoRegionCollection from ._models_py3 import GlobalCsmSkuDescription from ._models_py3 import HandlerMapping - from ._models_py3 import HostingEnvironmentDeploymentInfo - from ._models_py3 import HostingEnvironmentDiagnostics - from ._models_py3 import HostingEnvironmentProfile from ._models_py3 import HostKeys from ._models_py3 import HostName from ._models_py3 import HostNameBinding + from ._models_py3 import HostNameBindingCollection from ._models_py3 import HostNameSslState + from ._models_py3 import HostingEnvironmentDeploymentInfo + from ._models_py3 import HostingEnvironmentDiagnostics + from ._models_py3 import HostingEnvironmentProfile from ._models_py3 import HttpLogsConfig from ._models_py3 import HybridConnection + from ._models_py3 import HybridConnectionCollection from ._models_py3 import HybridConnectionKey from ._models_py3 import HybridConnectionLimits from ._models_py3 import Identifier + from ._models_py3 import IdentifierCollection from ._models_py3 import InboundEnvironmentEndpoint + from ._models_py3 import InboundEnvironmentEndpointCollection from ._models_py3 import IpSecurityRestriction from ._models_py3 import KeyInfo from ._models_py3 import KeyVaultReferenceCollection from ._models_py3 import KeyVaultReferenceResource from ._models_py3 import LocalizableString from ._models_py3 import LogSpecification + from ._models_py3 import MSDeploy + from ._models_py3 import MSDeployLog + from ._models_py3 import MSDeployLogEntry + from ._models_py3 import MSDeployStatus from ._models_py3 import ManagedServiceIdentity - from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue from ._models_py3 import MetricAvailability from ._models_py3 import MetricSpecification from ._models_py3 import MigrateMySqlRequest from ._models_py3 import MigrateMySqlStatus - from ._models_py3 import MSDeploy - from ._models_py3 import MSDeployLog - from ._models_py3 import MSDeployLogEntry - from ._models_py3 import MSDeployStatus from ._models_py3 import NameIdentifier + from ._models_py3 import NameIdentifierCollection from ._models_py3 import NameValuePair from ._models_py3 import NetworkAccessControlEntry from ._models_py3 import NetworkFeatures from ._models_py3 import NetworkTrace from ._models_py3 import Operation from ._models_py3 import OutboundEnvironmentEndpoint + from ._models_py3 import OutboundEnvironmentEndpointCollection + from ._models_py3 import PerfMonCounterCollection from ._models_py3 import PerfMonResponse from ._models_py3 import PerfMonSample from ._models_py3 import PerfMonSet from ._models_py3 import PremierAddOn from ._models_py3 import PremierAddOnOffer + from ._models_py3 import PremierAddOnOfferCollection from ._models_py3 import PremierAddOnPatchResource from ._models_py3 import PrivateAccess from ._models_py3 import PrivateAccessSubnet @@ -166,13 +194,18 @@ from ._models_py3 import PrivateLinkResourceProperties from ._models_py3 import PrivateLinkResourcesWrapper from ._models_py3 import ProcessInfo + from ._models_py3 import ProcessInfoCollection from ._models_py3 import ProcessModuleInfo + from ._models_py3 import ProcessModuleInfoCollection from ._models_py3 import ProcessThreadInfo + from ._models_py3 import ProcessThreadInfoCollection from ._models_py3 import ProxyOnlyResource from ._models_py3 import PublicCertificate + from ._models_py3 import PublicCertificateCollection from ._models_py3 import PushSettings from ._models_py3 import RampUpRule from ._models_py3 import Recommendation + from ._models_py3 import RecommendationCollection from ._models_py3 import RecommendationRule from ._models_py3 import ReissueCertificateOrderRequest from ._models_py3 import RelayServiceConnectionEntity @@ -180,9 +213,12 @@ from ._models_py3 import RenewCertificateOrderRequest from ._models_py3 import RequestsBasedTrigger from ._models_py3 import Resource + from ._models_py3 import ResourceCollection from ._models_py3 import ResourceHealthMetadata + from ._models_py3 import ResourceHealthMetadataCollection from ._models_py3 import ResourceMetricAvailability from ._models_py3 import ResourceMetricDefinition + from ._models_py3 import ResourceMetricDefinitionCollection from ._models_py3 import ResourceNameAvailability from ._models_py3 import ResourceNameAvailabilityRequest from ._models_py3 import ResponseMetaData @@ -194,8 +230,11 @@ from ._models_py3 import SiteCloneabilityCriterion from ._models_py3 import SiteConfig from ._models_py3 import SiteConfigResource + from ._models_py3 import SiteConfigResourceCollection from ._models_py3 import SiteConfigurationSnapshotInfo + from ._models_py3 import SiteConfigurationSnapshotInfoCollection from ._models_py3 import SiteExtensionInfo + from ._models_py3 import SiteExtensionInfoCollection from ._models_py3 import SiteInstance from ._models_py3 import SiteLimits from ._models_py3 import SiteLogsConfig @@ -208,27 +247,37 @@ from ._models_py3 import SkuCapacity from ._models_py3 import SkuDescription from ._models_py3 import SkuInfo + from ._models_py3 import SkuInfoCollection from ._models_py3 import SkuInfos from ._models_py3 import SlotConfigNamesResource from ._models_py3 import SlotDifference + from ._models_py3 import SlotDifferenceCollection from ._models_py3 import SlotSwapStatus from ._models_py3 import SlowRequestsBasedTrigger from ._models_py3 import Snapshot + from ._models_py3 import SnapshotCollection from ._models_py3 import SnapshotRecoverySource from ._models_py3 import SnapshotRestoreRequest from ._models_py3 import Solution from ._models_py3 import SourceControl + from ._models_py3 import SourceControlCollection from ._models_py3 import StackMajorVersion from ._models_py3 import StackMinorVersion from ._models_py3 import StampCapacity + from ._models_py3 import StampCapacityCollection from ._models_py3 import StaticSiteARMResource from ._models_py3 import StaticSiteBuildARMResource + from ._models_py3 import StaticSiteBuildCollection from ._models_py3 import StaticSiteBuildProperties + from ._models_py3 import StaticSiteCollection from ._models_py3 import StaticSiteCustomDomainOverviewARMResource + from ._models_py3 import StaticSiteCustomDomainOverviewCollection from ._models_py3 import StaticSiteFunctionOverviewARMResource + from ._models_py3 import StaticSiteFunctionOverviewCollection from ._models_py3 import StaticSitePatchResource from ._models_py3 import StaticSiteResetPropertiesARMResource from ._models_py3 import StaticSiteUserARMResource + from ._models_py3 import StaticSiteUserCollection from ._models_py3 import StaticSiteUserInvitationRequestResource from ._models_py3 import StaticSiteUserInvitationResponseResource from ._models_py3 import StatusCodesBasedTrigger @@ -237,12 +286,17 @@ from ._models_py3 import StringDictionary from ._models_py3 import SwiftVirtualNetwork from ._models_py3 import TldLegalAgreement + from ._models_py3 import TldLegalAgreementCollection from ._models_py3 import TopLevelDomain from ._models_py3 import TopLevelDomainAgreementOption + from ._models_py3 import TopLevelDomainCollection from ._models_py3 import TriggeredJobHistory + from ._models_py3 import TriggeredJobHistoryCollection from ._models_py3 import TriggeredJobRun from ._models_py3 import TriggeredWebJob + from ._models_py3 import TriggeredWebJobCollection from ._models_py3 import Usage + from ._models_py3 import UsageCollection from ._models_py3 import User from ._models_py3 import ValidateRequest from ._models_py3 import ValidateResponse @@ -258,393 +312,402 @@ from ._models_py3 import VnetValidationFailureDetails from ._models_py3 import VnetValidationTestFailure from ._models_py3 import WebAppCollection + from ._models_py3 import WebAppInstanceCollection from ._models_py3 import WebJob + from ._models_py3 import WebJobCollection from ._models_py3 import WebSiteInstanceStatus from ._models_py3 import WorkerPool + from ._models_py3 import WorkerPoolCollection from ._models_py3 import WorkerPoolResource except (SyntaxError, ImportError): - from ._models import AbnormalTimePeriod - from ._models import Address - from ._models import AddressResponse - from ._models import AnalysisData - from ._models import AnalysisDefinition - from ._models import ApiDefinitionInfo - from ._models import ApiKVReference - from ._models import ApiManagementConfig - from ._models import ApplicationLogsConfig - from ._models import ApplicationStack - from ._models import ApplicationStackResource - from ._models import AppServiceCertificate - from ._models import AppServiceCertificateOrder - from ._models import AppServiceCertificateOrderPatchResource - from ._models import AppServiceCertificatePatchResource - from ._models import AppServiceCertificateResource - from ._models import AppServiceEnvironment - from ._models import AppServiceEnvironmentPatchResource - from ._models import AppServiceEnvironmentResource - from ._models import AppServicePlan - from ._models import AppServicePlanPatchResource - from ._models import ArmIdWrapper - from ._models import AutoHealActions - from ._models import AutoHealCustomAction - from ._models import AutoHealRules - from ._models import AutoHealTriggers - from ._models import AzureBlobStorageApplicationLogsConfig - from ._models import AzureBlobStorageHttpLogsConfig - from ._models import AzureStorageInfoValue - from ._models import AzureStoragePropertyDictionaryResource - from ._models import AzureTableStorageApplicationLogsConfig - from ._models import BackupItem - from ._models import BackupRequest - from ._models import BackupSchedule - from ._models import BillingMeter - from ._models import Capability - from ._models import Certificate - from ._models import CertificateDetails - from ._models import CertificateEmail - from ._models import CertificateOrderAction - from ._models import CertificatePatchResource - from ._models import CloningInfo - from ._models import ConnectionStringDictionary - from ._models import ConnStringInfo - from ._models import ConnStringValueTypePair - from ._models import Contact - from ._models import ContainerCpuStatistics - from ._models import ContainerCpuUsage - from ._models import ContainerInfo - from ._models import ContainerMemoryStatistics - from ._models import ContainerNetworkInterfaceStatistics - from ._models import ContainerThrottlingData - from ._models import ContinuousWebJob - from ._models import CorsSettings - from ._models import CsmCopySlotEntity - from ._models import CsmMoveResourceEnvelope - from ._models import CsmOperationDescription - from ._models import CsmOperationDescriptionProperties - from ._models import CsmOperationDisplay - from ._models import CsmPublishingProfileOptions - from ._models import CsmSlotEntity - from ._models import CsmUsageQuota - from ._models import CustomHostnameAnalysisResult - from ._models import DatabaseBackupSetting - from ._models import DataSource - from ._models import DataTableResponseColumn - from ._models import DataTableResponseObject - from ._models import DefaultErrorResponse, DefaultErrorResponseException - from ._models import DefaultErrorResponseError - from ._models import DefaultErrorResponseErrorDetailsItem - from ._models import DeletedAppRestoreRequest - from ._models import DeletedSite - from ._models import Deployment - from ._models import DeploymentLocations - from ._models import DetectorAbnormalTimePeriod - from ._models import DetectorDefinition - from ._models import DetectorInfo - from ._models import DetectorResponse - from ._models import DiagnosticAnalysis - from ._models import DiagnosticCategory - from ._models import DiagnosticData - from ._models import DiagnosticDetectorResponse - from ._models import DiagnosticMetricSample - from ._models import DiagnosticMetricSet - from ._models import Dimension - from ._models import Domain - from ._models import DomainAvailabilityCheckResult - from ._models import DomainControlCenterSsoRequest - from ._models import DomainOwnershipIdentifier - from ._models import DomainPatchResource - from ._models import DomainPurchaseConsent - from ._models import DomainRecommendationSearchParameters - from ._models import EnabledConfig - from ._models import EndpointDependency - from ._models import EndpointDetail - from ._models import ErrorEntity - from ._models import Experiments - from ._models import FileSystemApplicationLogsConfig - from ._models import FileSystemHttpLogsConfig - from ._models import FunctionEnvelope - from ._models import FunctionSecrets - from ._models import GeoRegion - from ._models import GlobalCsmSkuDescription - from ._models import HandlerMapping - from ._models import HostingEnvironmentDeploymentInfo - from ._models import HostingEnvironmentDiagnostics - from ._models import HostingEnvironmentProfile - from ._models import HostKeys - from ._models import HostName - from ._models import HostNameBinding - from ._models import HostNameSslState - from ._models import HttpLogsConfig - from ._models import HybridConnection - from ._models import HybridConnectionKey - from ._models import HybridConnectionLimits - from ._models import Identifier - from ._models import InboundEnvironmentEndpoint - from ._models import IpSecurityRestriction - from ._models import KeyInfo - from ._models import KeyVaultReferenceCollection - from ._models import KeyVaultReferenceResource - from ._models import LocalizableString - from ._models import LogSpecification - from ._models import ManagedServiceIdentity - from ._models import ManagedServiceIdentityUserAssignedIdentitiesValue - from ._models import MetricAvailability - from ._models import MetricSpecification - from ._models import MigrateMySqlRequest - from ._models import MigrateMySqlStatus - from ._models import MSDeploy - from ._models import MSDeployLog - from ._models import MSDeployLogEntry - from ._models import MSDeployStatus - from ._models import NameIdentifier - from ._models import NameValuePair - from ._models import NetworkAccessControlEntry - from ._models import NetworkFeatures - from ._models import NetworkTrace - from ._models import Operation - from ._models import OutboundEnvironmentEndpoint - from ._models import PerfMonResponse - from ._models import PerfMonSample - from ._models import PerfMonSet - from ._models import PremierAddOn - from ._models import PremierAddOnOffer - from ._models import PremierAddOnPatchResource - from ._models import PrivateAccess - from ._models import PrivateAccessSubnet - from ._models import PrivateAccessVirtualNetwork - from ._models import PrivateEndpointConnectionResource - from ._models import PrivateLinkConnectionApprovalRequestResource - from ._models import PrivateLinkConnectionState - from ._models import PrivateLinkResource - from ._models import PrivateLinkResourceProperties - from ._models import PrivateLinkResourcesWrapper - from ._models import ProcessInfo - from ._models import ProcessModuleInfo - from ._models import ProcessThreadInfo - from ._models import ProxyOnlyResource - from ._models import PublicCertificate - from ._models import PushSettings - from ._models import RampUpRule - from ._models import Recommendation - from ._models import RecommendationRule - from ._models import ReissueCertificateOrderRequest - from ._models import RelayServiceConnectionEntity - from ._models import Rendering - from ._models import RenewCertificateOrderRequest - from ._models import RequestsBasedTrigger - from ._models import Resource - from ._models import ResourceHealthMetadata - from ._models import ResourceMetricAvailability - from ._models import ResourceMetricDefinition - from ._models import ResourceNameAvailability - from ._models import ResourceNameAvailabilityRequest - from ._models import ResponseMetaData - from ._models import RestoreRequest - from ._models import ServiceSpecification - from ._models import Site - from ._models import SiteAuthSettings - from ._models import SiteCloneability - from ._models import SiteCloneabilityCriterion - from ._models import SiteConfig - from ._models import SiteConfigResource - from ._models import SiteConfigurationSnapshotInfo - from ._models import SiteExtensionInfo - from ._models import SiteInstance - from ._models import SiteLimits - from ._models import SiteLogsConfig - from ._models import SiteMachineKey - from ._models import SitePatchResource - from ._models import SitePhpErrorLogFlag - from ._models import SiteSeal - from ._models import SiteSealRequest - from ._models import SiteSourceControl - from ._models import SkuCapacity - from ._models import SkuDescription - from ._models import SkuInfo - from ._models import SkuInfos - from ._models import SlotConfigNamesResource - from ._models import SlotDifference - from ._models import SlotSwapStatus - from ._models import SlowRequestsBasedTrigger - from ._models import Snapshot - from ._models import SnapshotRecoverySource - from ._models import SnapshotRestoreRequest - from ._models import Solution - from ._models import SourceControl - from ._models import StackMajorVersion - from ._models import StackMinorVersion - from ._models import StampCapacity - from ._models import StaticSiteARMResource - from ._models import StaticSiteBuildARMResource - from ._models import StaticSiteBuildProperties - from ._models import StaticSiteCustomDomainOverviewARMResource - from ._models import StaticSiteFunctionOverviewARMResource - from ._models import StaticSitePatchResource - from ._models import StaticSiteResetPropertiesARMResource - from ._models import StaticSiteUserARMResource - from ._models import StaticSiteUserInvitationRequestResource - from ._models import StaticSiteUserInvitationResponseResource - from ._models import StatusCodesBasedTrigger - from ._models import StorageMigrationOptions - from ._models import StorageMigrationResponse - from ._models import StringDictionary - from ._models import SwiftVirtualNetwork - from ._models import TldLegalAgreement - from ._models import TopLevelDomain - from ._models import TopLevelDomainAgreementOption - from ._models import TriggeredJobHistory - from ._models import TriggeredJobRun - from ._models import TriggeredWebJob - from ._models import Usage - from ._models import User - from ._models import ValidateRequest - from ._models import ValidateResponse - from ._models import ValidateResponseError - from ._models import VirtualApplication - from ._models import VirtualDirectory - from ._models import VirtualIPMapping - from ._models import VirtualNetworkProfile - from ._models import VnetGateway - from ._models import VnetInfo - from ._models import VnetParameters - from ._models import VnetRoute - from ._models import VnetValidationFailureDetails - from ._models import VnetValidationTestFailure - from ._models import WebAppCollection - from ._models import WebJob - from ._models import WebSiteInstanceStatus - from ._models import WorkerPool - from ._models import WorkerPoolResource -from ._paged_models import AnalysisDefinitionPaged -from ._paged_models import ApplicationStackResourcePaged -from ._paged_models import AppServiceCertificateOrderPaged -from ._paged_models import AppServiceCertificateResourcePaged -from ._paged_models import AppServiceEnvironmentResourcePaged -from ._paged_models import AppServicePlanPaged -from ._paged_models import BackupItemPaged -from ._paged_models import BillingMeterPaged -from ._paged_models import CertificatePaged -from ._paged_models import ContinuousWebJobPaged -from ._paged_models import CsmOperationDescriptionPaged -from ._paged_models import CsmUsageQuotaPaged -from ._paged_models import DeletedSitePaged -from ._paged_models import DeploymentPaged -from ._paged_models import DetectorDefinitionPaged -from ._paged_models import DetectorResponsePaged -from ._paged_models import DiagnosticCategoryPaged -from ._paged_models import DomainOwnershipIdentifierPaged -from ._paged_models import DomainPaged -from ._paged_models import FunctionEnvelopePaged -from ._paged_models import GeoRegionPaged -from ._paged_models import HostNameBindingPaged -from ._paged_models import HybridConnectionPaged -from ._paged_models import IdentifierPaged -from ._paged_models import InboundEnvironmentEndpointPaged -from ._paged_models import NameIdentifierPaged -from ._paged_models import OutboundEnvironmentEndpointPaged -from ._paged_models import PerfMonResponsePaged -from ._paged_models import PremierAddOnOfferPaged -from ._paged_models import ProcessInfoPaged -from ._paged_models import ProcessModuleInfoPaged -from ._paged_models import ProcessThreadInfoPaged -from ._paged_models import PublicCertificatePaged -from ._paged_models import RecommendationPaged -from ._paged_models import ResourceHealthMetadataPaged -from ._paged_models import ResourceMetricDefinitionPaged -from ._paged_models import SiteConfigResourcePaged -from ._paged_models import SiteConfigurationSnapshotInfoPaged -from ._paged_models import SiteExtensionInfoPaged -from ._paged_models import SiteInstancePaged -from ._paged_models import SitePaged -from ._paged_models import SkuInfoPaged -from ._paged_models import SlotDifferencePaged -from ._paged_models import SnapshotPaged -from ._paged_models import SourceControlPaged -from ._paged_models import StampCapacityPaged -from ._paged_models import StaticSiteARMResourcePaged -from ._paged_models import StaticSiteBuildARMResourcePaged -from ._paged_models import StaticSiteCustomDomainOverviewARMResourcePaged -from ._paged_models import StaticSiteFunctionOverviewARMResourcePaged -from ._paged_models import StaticSiteUserARMResourcePaged -from ._paged_models import StrPaged -from ._paged_models import TldLegalAgreementPaged -from ._paged_models import TopLevelDomainPaged -from ._paged_models import TriggeredJobHistoryPaged -from ._paged_models import TriggeredWebJobPaged -from ._paged_models import UsagePaged -from ._paged_models import WebJobPaged -from ._paged_models import WorkerPoolResourcePaged + from ._models import AbnormalTimePeriod # type: ignore + from ._models import Address # type: ignore + from ._models import AddressResponse # type: ignore + from ._models import AnalysisData # type: ignore + from ._models import AnalysisDefinition # type: ignore + from ._models import ApiDefinitionInfo # type: ignore + from ._models import ApiKVReference # type: ignore + from ._models import ApiManagementConfig # type: ignore + from ._models import AppServiceCertificate # type: ignore + from ._models import AppServiceCertificateCollection # type: ignore + from ._models import AppServiceCertificateOrder # type: ignore + from ._models import AppServiceCertificateOrderCollection # type: ignore + from ._models import AppServiceCertificateOrderPatchResource # type: ignore + from ._models import AppServiceCertificatePatchResource # type: ignore + from ._models import AppServiceCertificateResource # type: ignore + from ._models import AppServiceEnvironment # type: ignore + from ._models import AppServiceEnvironmentCollection # type: ignore + from ._models import AppServiceEnvironmentPatchResource # type: ignore + from ._models import AppServiceEnvironmentResource # type: ignore + from ._models import AppServicePlan # type: ignore + from ._models import AppServicePlanCollection # type: ignore + from ._models import AppServicePlanPatchResource # type: ignore + from ._models import ApplicationLogsConfig # type: ignore + from ._models import ApplicationStack # type: ignore + from ._models import ApplicationStackCollection # type: ignore + from ._models import ApplicationStackResource # type: ignore + from ._models import ArmIdWrapper # type: ignore + from ._models import AutoHealActions # type: ignore + from ._models import AutoHealCustomAction # type: ignore + from ._models import AutoHealRules # type: ignore + from ._models import AutoHealTriggers # type: ignore + from ._models import AzureBlobStorageApplicationLogsConfig # type: ignore + from ._models import AzureBlobStorageHttpLogsConfig # type: ignore + from ._models import AzureStorageInfoValue # type: ignore + from ._models import AzureStoragePropertyDictionaryResource # type: ignore + from ._models import AzureTableStorageApplicationLogsConfig # type: ignore + from ._models import BackupItem # type: ignore + from ._models import BackupItemCollection # type: ignore + from ._models import BackupRequest # type: ignore + from ._models import BackupSchedule # type: ignore + from ._models import BillingMeter # type: ignore + from ._models import BillingMeterCollection # type: ignore + from ._models import Capability # type: ignore + from ._models import Certificate # type: ignore + from ._models import CertificateCollection # type: ignore + from ._models import CertificateDetails # type: ignore + from ._models import CertificateEmail # type: ignore + from ._models import CertificateOrderAction # type: ignore + from ._models import CertificatePatchResource # type: ignore + from ._models import CloningInfo # type: ignore + from ._models import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import ConnStringInfo # type: ignore + from ._models import ConnStringValueTypePair # type: ignore + from ._models import ConnectionStringDictionary # type: ignore + from ._models import Contact # type: ignore + from ._models import ContainerCpuStatistics # type: ignore + from ._models import ContainerCpuUsage # type: ignore + from ._models import ContainerInfo # type: ignore + from ._models import ContainerMemoryStatistics # type: ignore + from ._models import ContainerNetworkInterfaceStatistics # type: ignore + from ._models import ContainerThrottlingData # type: ignore + from ._models import ContinuousWebJob # type: ignore + from ._models import ContinuousWebJobCollection # type: ignore + from ._models import CorsSettings # type: ignore + from ._models import CsmCopySlotEntity # type: ignore + from ._models import CsmMoveResourceEnvelope # type: ignore + from ._models import CsmOperationCollection # type: ignore + from ._models import CsmOperationDescription # type: ignore + from ._models import CsmOperationDescriptionProperties # type: ignore + from ._models import CsmOperationDisplay # type: ignore + from ._models import CsmPublishingCredentialsPoliciesCollection # type: ignore + from ._models import CsmPublishingCredentialsPoliciesEntity # type: ignore + from ._models import CsmPublishingProfileOptions # type: ignore + from ._models import CsmSlotEntity # type: ignore + from ._models import CsmUsageQuota # type: ignore + from ._models import CsmUsageQuotaCollection # type: ignore + from ._models import CustomHostnameAnalysisResult # type: ignore + from ._models import DataSource # type: ignore + from ._models import DataTableResponseColumn # type: ignore + from ._models import DataTableResponseObject # type: ignore + from ._models import DatabaseBackupSetting # type: ignore + from ._models import DefaultErrorResponse # type: ignore + from ._models import DefaultErrorResponseError # type: ignore + from ._models import DefaultErrorResponseErrorDetailsItem # type: ignore + from ._models import DeletedAppRestoreRequest # type: ignore + from ._models import DeletedSite # type: ignore + from ._models import DeletedWebAppCollection # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentCollection # type: ignore + from ._models import DeploymentLocations # type: ignore + from ._models import DetectorAbnormalTimePeriod # type: ignore + from ._models import DetectorDefinition # type: ignore + from ._models import DetectorInfo # type: ignore + from ._models import DetectorResponse # type: ignore + from ._models import DetectorResponseCollection # type: ignore + from ._models import DiagnosticAnalysis # type: ignore + from ._models import DiagnosticAnalysisCollection # type: ignore + from ._models import DiagnosticCategory # type: ignore + from ._models import DiagnosticCategoryCollection # type: ignore + from ._models import DiagnosticData # type: ignore + from ._models import DiagnosticDetectorCollection # type: ignore + from ._models import DiagnosticDetectorResponse # type: ignore + from ._models import DiagnosticMetricSample # type: ignore + from ._models import DiagnosticMetricSet # type: ignore + from ._models import Dimension # type: ignore + from ._models import Domain # type: ignore + from ._models import DomainAvailabilityCheckResult # type: ignore + from ._models import DomainCollection # type: ignore + from ._models import DomainControlCenterSsoRequest # type: ignore + from ._models import DomainOwnershipIdentifier # type: ignore + from ._models import DomainOwnershipIdentifierCollection # type: ignore + from ._models import DomainPatchResource # type: ignore + from ._models import DomainPurchaseConsent # type: ignore + from ._models import DomainRecommendationSearchParameters # type: ignore + from ._models import EnabledConfig # type: ignore + from ._models import EndpointDependency # type: ignore + from ._models import EndpointDetail # type: ignore + from ._models import ErrorEntity # type: ignore + from ._models import Experiments # type: ignore + from ._models import FileSystemApplicationLogsConfig # type: ignore + from ._models import FileSystemHttpLogsConfig # type: ignore + from ._models import FunctionEnvelope # type: ignore + from ._models import FunctionEnvelopeCollection # type: ignore + from ._models import FunctionSecrets # type: ignore + from ._models import GeoRegion # type: ignore + from ._models import GeoRegionCollection # type: ignore + from ._models import GlobalCsmSkuDescription # type: ignore + from ._models import HandlerMapping # type: ignore + from ._models import HostKeys # type: ignore + from ._models import HostName # type: ignore + from ._models import HostNameBinding # type: ignore + from ._models import HostNameBindingCollection # type: ignore + from ._models import HostNameSslState # type: ignore + from ._models import HostingEnvironmentDeploymentInfo # type: ignore + from ._models import HostingEnvironmentDiagnostics # type: ignore + from ._models import HostingEnvironmentProfile # type: ignore + from ._models import HttpLogsConfig # type: ignore + from ._models import HybridConnection # type: ignore + from ._models import HybridConnectionCollection # type: ignore + from ._models import HybridConnectionKey # type: ignore + from ._models import HybridConnectionLimits # type: ignore + from ._models import Identifier # type: ignore + from ._models import IdentifierCollection # type: ignore + from ._models import InboundEnvironmentEndpoint # type: ignore + from ._models import InboundEnvironmentEndpointCollection # type: ignore + from ._models import IpSecurityRestriction # type: ignore + from ._models import KeyInfo # type: ignore + from ._models import KeyVaultReferenceCollection # type: ignore + from ._models import KeyVaultReferenceResource # type: ignore + from ._models import LocalizableString # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import MSDeploy # type: ignore + from ._models import MSDeployLog # type: ignore + from ._models import MSDeployLogEntry # type: ignore + from ._models import MSDeployStatus # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import MetricAvailability # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MigrateMySqlRequest # type: ignore + from ._models import MigrateMySqlStatus # type: ignore + from ._models import NameIdentifier # type: ignore + from ._models import NameIdentifierCollection # type: ignore + from ._models import NameValuePair # type: ignore + from ._models import NetworkAccessControlEntry # type: ignore + from ._models import NetworkFeatures # type: ignore + from ._models import NetworkTrace # type: ignore + from ._models import Operation # type: ignore + from ._models import OutboundEnvironmentEndpoint # type: ignore + from ._models import OutboundEnvironmentEndpointCollection # type: ignore + from ._models import PerfMonCounterCollection # type: ignore + from ._models import PerfMonResponse # type: ignore + from ._models import PerfMonSample # type: ignore + from ._models import PerfMonSet # type: ignore + from ._models import PremierAddOn # type: ignore + from ._models import PremierAddOnOffer # type: ignore + from ._models import PremierAddOnOfferCollection # type: ignore + from ._models import PremierAddOnPatchResource # type: ignore + from ._models import PrivateAccess # type: ignore + from ._models import PrivateAccessSubnet # type: ignore + from ._models import PrivateAccessVirtualNetwork # type: ignore + from ._models import PrivateEndpointConnectionResource # type: ignore + from ._models import PrivateLinkConnectionApprovalRequestResource # type: ignore + from ._models import PrivateLinkConnectionState # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceProperties # type: ignore + from ._models import PrivateLinkResourcesWrapper # type: ignore + from ._models import ProcessInfo # type: ignore + from ._models import ProcessInfoCollection # type: ignore + from ._models import ProcessModuleInfo # type: ignore + from ._models import ProcessModuleInfoCollection # type: ignore + from ._models import ProcessThreadInfo # type: ignore + from ._models import ProcessThreadInfoCollection # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import PublicCertificate # type: ignore + from ._models import PublicCertificateCollection # type: ignore + from ._models import PushSettings # type: ignore + from ._models import RampUpRule # type: ignore + from ._models import Recommendation # type: ignore + from ._models import RecommendationCollection # type: ignore + from ._models import RecommendationRule # type: ignore + from ._models import ReissueCertificateOrderRequest # type: ignore + from ._models import RelayServiceConnectionEntity # type: ignore + from ._models import Rendering # type: ignore + from ._models import RenewCertificateOrderRequest # type: ignore + from ._models import RequestsBasedTrigger # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceCollection # type: ignore + from ._models import ResourceHealthMetadata # type: ignore + from ._models import ResourceHealthMetadataCollection # type: ignore + from ._models import ResourceMetricAvailability # type: ignore + from ._models import ResourceMetricDefinition # type: ignore + from ._models import ResourceMetricDefinitionCollection # type: ignore + from ._models import ResourceNameAvailability # type: ignore + from ._models import ResourceNameAvailabilityRequest # type: ignore + from ._models import ResponseMetaData # type: ignore + from ._models import RestoreRequest # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Site # type: ignore + from ._models import SiteAuthSettings # type: ignore + from ._models import SiteCloneability # type: ignore + from ._models import SiteCloneabilityCriterion # type: ignore + from ._models import SiteConfig # type: ignore + from ._models import SiteConfigResource # type: ignore + from ._models import SiteConfigResourceCollection # type: ignore + from ._models import SiteConfigurationSnapshotInfo # type: ignore + from ._models import SiteConfigurationSnapshotInfoCollection # type: ignore + from ._models import SiteExtensionInfo # type: ignore + from ._models import SiteExtensionInfoCollection # type: ignore + from ._models import SiteInstance # type: ignore + from ._models import SiteLimits # type: ignore + from ._models import SiteLogsConfig # type: ignore + from ._models import SiteMachineKey # type: ignore + from ._models import SitePatchResource # type: ignore + from ._models import SitePhpErrorLogFlag # type: ignore + from ._models import SiteSeal # type: ignore + from ._models import SiteSealRequest # type: ignore + from ._models import SiteSourceControl # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import SkuInfo # type: ignore + from ._models import SkuInfoCollection # type: ignore + from ._models import SkuInfos # type: ignore + from ._models import SlotConfigNamesResource # type: ignore + from ._models import SlotDifference # type: ignore + from ._models import SlotDifferenceCollection # type: ignore + from ._models import SlotSwapStatus # type: ignore + from ._models import SlowRequestsBasedTrigger # type: ignore + from ._models import Snapshot # type: ignore + from ._models import SnapshotCollection # type: ignore + from ._models import SnapshotRecoverySource # type: ignore + from ._models import SnapshotRestoreRequest # type: ignore + from ._models import Solution # type: ignore + from ._models import SourceControl # type: ignore + from ._models import SourceControlCollection # type: ignore + from ._models import StackMajorVersion # type: ignore + from ._models import StackMinorVersion # type: ignore + from ._models import StampCapacity # type: ignore + from ._models import StampCapacityCollection # type: ignore + from ._models import StaticSiteARMResource # type: ignore + from ._models import StaticSiteBuildARMResource # type: ignore + from ._models import StaticSiteBuildCollection # type: ignore + from ._models import StaticSiteBuildProperties # type: ignore + from ._models import StaticSiteCollection # type: ignore + from ._models import StaticSiteCustomDomainOverviewARMResource # type: ignore + from ._models import StaticSiteCustomDomainOverviewCollection # type: ignore + from ._models import StaticSiteFunctionOverviewARMResource # type: ignore + from ._models import StaticSiteFunctionOverviewCollection # type: ignore + from ._models import StaticSitePatchResource # type: ignore + from ._models import StaticSiteResetPropertiesARMResource # type: ignore + from ._models import StaticSiteUserARMResource # type: ignore + from ._models import StaticSiteUserCollection # type: ignore + from ._models import StaticSiteUserInvitationRequestResource # type: ignore + from ._models import StaticSiteUserInvitationResponseResource # type: ignore + from ._models import StatusCodesBasedTrigger # type: ignore + from ._models import StorageMigrationOptions # type: ignore + from ._models import StorageMigrationResponse # type: ignore + from ._models import StringDictionary # type: ignore + from ._models import SwiftVirtualNetwork # type: ignore + from ._models import TldLegalAgreement # type: ignore + from ._models import TldLegalAgreementCollection # type: ignore + from ._models import TopLevelDomain # type: ignore + from ._models import TopLevelDomainAgreementOption # type: ignore + from ._models import TopLevelDomainCollection # type: ignore + from ._models import TriggeredJobHistory # type: ignore + from ._models import TriggeredJobHistoryCollection # type: ignore + from ._models import TriggeredJobRun # type: ignore + from ._models import TriggeredWebJob # type: ignore + from ._models import TriggeredWebJobCollection # type: ignore + from ._models import Usage # type: ignore + from ._models import UsageCollection # type: ignore + from ._models import User # type: ignore + from ._models import ValidateRequest # type: ignore + from ._models import ValidateResponse # type: ignore + from ._models import ValidateResponseError # type: ignore + from ._models import VirtualApplication # type: ignore + from ._models import VirtualDirectory # type: ignore + from ._models import VirtualIPMapping # type: ignore + from ._models import VirtualNetworkProfile # type: ignore + from ._models import VnetGateway # type: ignore + from ._models import VnetInfo # type: ignore + from ._models import VnetParameters # type: ignore + from ._models import VnetRoute # type: ignore + from ._models import VnetValidationFailureDetails # type: ignore + from ._models import VnetValidationTestFailure # type: ignore + from ._models import WebAppCollection # type: ignore + from ._models import WebAppInstanceCollection # type: ignore + from ._models import WebJob # type: ignore + from ._models import WebJobCollection # type: ignore + from ._models import WebSiteInstanceStatus # type: ignore + from ._models import WorkerPool # type: ignore + from ._models import WorkerPoolCollection # type: ignore + from ._models import WorkerPoolResource # type: ignore + from ._web_site_management_client_enums import ( - KeyVaultSecretStatus, - CertificateProductType, - ProvisioningState, - CertificateOrderStatus, - CertificateOrderActionType, - RouteType, - ManagedServiceIdentityType, - IpFilterTag, + AccessControlEntryAction, + AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem, + AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem, + AppServicePlanRestrictions, AutoHealActionType, - ConnectionStringType, - ScmType, - ManagedPipelineMode, - SiteLoadBalancing, - SupportedTlsVersions, - FtpsState, - SslState, - HostType, - UsageState, - SiteAvailabilityState, - RedundancyMode, - StatusOptions, - DomainStatus, AzureResourceType, + AzureStorageState, + AzureStorageType, + BackupItemStatus, + BackupRestoreOperationType, + BuildStatus, + BuiltInAuthenticationProvider, + CertificateOrderActionType, + CertificateOrderStatus, + CertificateProductType, + Channels, + CheckNameResourceTypes, + CloneAbilityResult, + ComputeModeOptions, + ConnectionStringType, + ContinuousWebJobStatus, CustomHostNameDnsRecordType, - HostNameType, + DatabaseType, DnsType, + DnsVerificationTestResult, + DomainPatchResourcePropertiesDomainNotRenewableReasonsItem, + DomainPropertiesDomainNotRenewableReasonsItem, + DomainStatus, DomainType, + Enum4, + Enum5, + FrequencyUnit, + FtpsState, + HostNameType, + HostType, HostingEnvironmentStatus, + InAvailabilityReasonType, InternalLoadBalancingMode, - ComputeModeOptions, - WorkerSizeOptions, - AccessControlEntryAction, - OperationStatus, + IpFilterTag, IssueType, - SolutionType, - RenderingType, - ResourceScopeType, - NotificationLevel, - Channels, - AppServicePlanRestrictions, - InAvailabilityReasonType, - CheckNameResourceTypes, - ValidateResourceTypes, - ResolveStatus, - ConfigReferenceSource, - ConfigReferenceLocation, + KeyVaultSecretStatus, LogLevel, - AzureStorageType, - AzureStorageState, - BackupItemStatus, - DatabaseType, - FrequencyUnit, - ContinuousWebJobStatus, - WebJobType, - PublishingProfileFormat, - DnsVerificationTestResult, MSDeployLogEntryType, MSDeployProvisioningState, + ManagedPipelineMode, + ManagedServiceIdentityType, MySqlMigrationType, + NotificationLevel, + OperationStatus, + ProvisioningState, PublicCertificateLocation, - BackupRestoreOperationType, - UnauthenticatedClientAction, - BuiltInAuthenticationProvider, - CloneAbilityResult, + PublishingProfileFormat, + RedundancyMode, + RenderingType, + ResolveStatus, + ResourceScopeType, + RouteType, + ScmType, + SiteAvailabilityState, SiteExtensionType, - TriggeredWebJobStatus, + SiteLoadBalancing, SiteRuntimeState, - BuildStatus, - TriggerTypes, SkuName, + SolutionType, + SslState, + StatusOptions, + SupportedTlsVersions, + TriggerTypes, + TriggeredWebJobStatus, + UnauthenticatedClientAction, + UsageState, + ValidateResourceTypes, + WebJobType, + WorkerSizeOptions, ) __all__ = [ @@ -656,19 +719,24 @@ 'ApiDefinitionInfo', 'ApiKVReference', 'ApiManagementConfig', - 'ApplicationLogsConfig', - 'ApplicationStack', - 'ApplicationStackResource', 'AppServiceCertificate', + 'AppServiceCertificateCollection', 'AppServiceCertificateOrder', + 'AppServiceCertificateOrderCollection', 'AppServiceCertificateOrderPatchResource', 'AppServiceCertificatePatchResource', 'AppServiceCertificateResource', 'AppServiceEnvironment', + 'AppServiceEnvironmentCollection', 'AppServiceEnvironmentPatchResource', 'AppServiceEnvironmentResource', 'AppServicePlan', + 'AppServicePlanCollection', 'AppServicePlanPatchResource', + 'ApplicationLogsConfig', + 'ApplicationStack', + 'ApplicationStackCollection', + 'ApplicationStackResource', 'ArmIdWrapper', 'AutoHealActions', 'AutoHealCustomAction', @@ -680,19 +748,23 @@ 'AzureStoragePropertyDictionaryResource', 'AzureTableStorageApplicationLogsConfig', 'BackupItem', + 'BackupItemCollection', 'BackupRequest', 'BackupSchedule', 'BillingMeter', + 'BillingMeterCollection', 'Capability', 'Certificate', + 'CertificateCollection', 'CertificateDetails', 'CertificateEmail', 'CertificateOrderAction', 'CertificatePatchResource', 'CloningInfo', - 'ConnectionStringDictionary', + 'Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties', 'ConnStringInfo', 'ConnStringValueTypePair', + 'ConnectionStringDictionary', 'Contact', 'ContainerCpuStatistics', 'ContainerCpuUsage', @@ -701,42 +773,55 @@ 'ContainerNetworkInterfaceStatistics', 'ContainerThrottlingData', 'ContinuousWebJob', + 'ContinuousWebJobCollection', 'CorsSettings', 'CsmCopySlotEntity', 'CsmMoveResourceEnvelope', + 'CsmOperationCollection', 'CsmOperationDescription', 'CsmOperationDescriptionProperties', 'CsmOperationDisplay', + 'CsmPublishingCredentialsPoliciesCollection', + 'CsmPublishingCredentialsPoliciesEntity', 'CsmPublishingProfileOptions', 'CsmSlotEntity', 'CsmUsageQuota', + 'CsmUsageQuotaCollection', 'CustomHostnameAnalysisResult', - 'DatabaseBackupSetting', 'DataSource', 'DataTableResponseColumn', 'DataTableResponseObject', - 'DefaultErrorResponse', 'DefaultErrorResponseException', + 'DatabaseBackupSetting', + 'DefaultErrorResponse', 'DefaultErrorResponseError', 'DefaultErrorResponseErrorDetailsItem', 'DeletedAppRestoreRequest', 'DeletedSite', + 'DeletedWebAppCollection', 'Deployment', + 'DeploymentCollection', 'DeploymentLocations', 'DetectorAbnormalTimePeriod', 'DetectorDefinition', 'DetectorInfo', 'DetectorResponse', + 'DetectorResponseCollection', 'DiagnosticAnalysis', + 'DiagnosticAnalysisCollection', 'DiagnosticCategory', + 'DiagnosticCategoryCollection', 'DiagnosticData', + 'DiagnosticDetectorCollection', 'DiagnosticDetectorResponse', 'DiagnosticMetricSample', 'DiagnosticMetricSet', 'Dimension', 'Domain', 'DomainAvailabilityCheckResult', + 'DomainCollection', 'DomainControlCenterSsoRequest', 'DomainOwnershipIdentifier', + 'DomainOwnershipIdentifierCollection', 'DomainPatchResource', 'DomainPurchaseConsent', 'DomainRecommendationSearchParameters', @@ -748,51 +833,60 @@ 'FileSystemApplicationLogsConfig', 'FileSystemHttpLogsConfig', 'FunctionEnvelope', + 'FunctionEnvelopeCollection', 'FunctionSecrets', 'GeoRegion', + 'GeoRegionCollection', 'GlobalCsmSkuDescription', 'HandlerMapping', - 'HostingEnvironmentDeploymentInfo', - 'HostingEnvironmentDiagnostics', - 'HostingEnvironmentProfile', 'HostKeys', 'HostName', 'HostNameBinding', + 'HostNameBindingCollection', 'HostNameSslState', + 'HostingEnvironmentDeploymentInfo', + 'HostingEnvironmentDiagnostics', + 'HostingEnvironmentProfile', 'HttpLogsConfig', 'HybridConnection', + 'HybridConnectionCollection', 'HybridConnectionKey', 'HybridConnectionLimits', 'Identifier', + 'IdentifierCollection', 'InboundEnvironmentEndpoint', + 'InboundEnvironmentEndpointCollection', 'IpSecurityRestriction', 'KeyInfo', 'KeyVaultReferenceCollection', 'KeyVaultReferenceResource', 'LocalizableString', 'LogSpecification', + 'MSDeploy', + 'MSDeployLog', + 'MSDeployLogEntry', + 'MSDeployStatus', 'ManagedServiceIdentity', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', 'MetricAvailability', 'MetricSpecification', 'MigrateMySqlRequest', 'MigrateMySqlStatus', - 'MSDeploy', - 'MSDeployLog', - 'MSDeployLogEntry', - 'MSDeployStatus', 'NameIdentifier', + 'NameIdentifierCollection', 'NameValuePair', 'NetworkAccessControlEntry', 'NetworkFeatures', 'NetworkTrace', 'Operation', 'OutboundEnvironmentEndpoint', + 'OutboundEnvironmentEndpointCollection', + 'PerfMonCounterCollection', 'PerfMonResponse', 'PerfMonSample', 'PerfMonSet', 'PremierAddOn', 'PremierAddOnOffer', + 'PremierAddOnOfferCollection', 'PremierAddOnPatchResource', 'PrivateAccess', 'PrivateAccessSubnet', @@ -804,13 +898,18 @@ 'PrivateLinkResourceProperties', 'PrivateLinkResourcesWrapper', 'ProcessInfo', + 'ProcessInfoCollection', 'ProcessModuleInfo', + 'ProcessModuleInfoCollection', 'ProcessThreadInfo', + 'ProcessThreadInfoCollection', 'ProxyOnlyResource', 'PublicCertificate', + 'PublicCertificateCollection', 'PushSettings', 'RampUpRule', 'Recommendation', + 'RecommendationCollection', 'RecommendationRule', 'ReissueCertificateOrderRequest', 'RelayServiceConnectionEntity', @@ -818,9 +917,12 @@ 'RenewCertificateOrderRequest', 'RequestsBasedTrigger', 'Resource', + 'ResourceCollection', 'ResourceHealthMetadata', + 'ResourceHealthMetadataCollection', 'ResourceMetricAvailability', 'ResourceMetricDefinition', + 'ResourceMetricDefinitionCollection', 'ResourceNameAvailability', 'ResourceNameAvailabilityRequest', 'ResponseMetaData', @@ -832,8 +934,11 @@ 'SiteCloneabilityCriterion', 'SiteConfig', 'SiteConfigResource', + 'SiteConfigResourceCollection', 'SiteConfigurationSnapshotInfo', + 'SiteConfigurationSnapshotInfoCollection', 'SiteExtensionInfo', + 'SiteExtensionInfoCollection', 'SiteInstance', 'SiteLimits', 'SiteLogsConfig', @@ -846,27 +951,37 @@ 'SkuCapacity', 'SkuDescription', 'SkuInfo', + 'SkuInfoCollection', 'SkuInfos', 'SlotConfigNamesResource', 'SlotDifference', + 'SlotDifferenceCollection', 'SlotSwapStatus', 'SlowRequestsBasedTrigger', 'Snapshot', + 'SnapshotCollection', 'SnapshotRecoverySource', 'SnapshotRestoreRequest', 'Solution', 'SourceControl', + 'SourceControlCollection', 'StackMajorVersion', 'StackMinorVersion', 'StampCapacity', + 'StampCapacityCollection', 'StaticSiteARMResource', 'StaticSiteBuildARMResource', + 'StaticSiteBuildCollection', 'StaticSiteBuildProperties', + 'StaticSiteCollection', 'StaticSiteCustomDomainOverviewARMResource', + 'StaticSiteCustomDomainOverviewCollection', 'StaticSiteFunctionOverviewARMResource', + 'StaticSiteFunctionOverviewCollection', 'StaticSitePatchResource', 'StaticSiteResetPropertiesARMResource', 'StaticSiteUserARMResource', + 'StaticSiteUserCollection', 'StaticSiteUserInvitationRequestResource', 'StaticSiteUserInvitationResponseResource', 'StatusCodesBasedTrigger', @@ -875,12 +990,17 @@ 'StringDictionary', 'SwiftVirtualNetwork', 'TldLegalAgreement', + 'TldLegalAgreementCollection', 'TopLevelDomain', 'TopLevelDomainAgreementOption', + 'TopLevelDomainCollection', 'TriggeredJobHistory', + 'TriggeredJobHistoryCollection', 'TriggeredJobRun', 'TriggeredWebJob', + 'TriggeredWebJobCollection', 'Usage', + 'UsageCollection', 'User', 'ValidateRequest', 'ValidateResponse', @@ -896,137 +1016,85 @@ 'VnetValidationFailureDetails', 'VnetValidationTestFailure', 'WebAppCollection', + 'WebAppInstanceCollection', 'WebJob', + 'WebJobCollection', 'WebSiteInstanceStatus', 'WorkerPool', + 'WorkerPoolCollection', 'WorkerPoolResource', - 'AppServiceCertificateOrderPaged', - 'AppServiceCertificateResourcePaged', - 'CsmOperationDescriptionPaged', - 'DomainPaged', - 'NameIdentifierPaged', - 'DomainOwnershipIdentifierPaged', - 'TopLevelDomainPaged', - 'TldLegalAgreementPaged', - 'CertificatePaged', - 'DeletedSitePaged', - 'DetectorResponsePaged', - 'DiagnosticCategoryPaged', - 'AnalysisDefinitionPaged', - 'DetectorDefinitionPaged', - 'ApplicationStackResourcePaged', - 'RecommendationPaged', - 'SourceControlPaged', - 'BillingMeterPaged', - 'GeoRegionPaged', - 'IdentifierPaged', - 'PremierAddOnOfferPaged', - 'SitePaged', - 'BackupItemPaged', - 'SiteConfigResourcePaged', - 'SiteConfigurationSnapshotInfoPaged', - 'ContinuousWebJobPaged', - 'DeploymentPaged', - 'FunctionEnvelopePaged', - 'HostNameBindingPaged', - 'SiteInstancePaged', - 'ProcessInfoPaged', - 'ProcessModuleInfoPaged', - 'ProcessThreadInfoPaged', - 'PerfMonResponsePaged', - 'PublicCertificatePaged', - 'SiteExtensionInfoPaged', - 'SlotDifferencePaged', - 'SnapshotPaged', - 'TriggeredWebJobPaged', - 'TriggeredJobHistoryPaged', - 'CsmUsageQuotaPaged', - 'WebJobPaged', - 'StaticSiteARMResourcePaged', - 'StaticSiteUserARMResourcePaged', - 'StaticSiteBuildARMResourcePaged', - 'StaticSiteFunctionOverviewARMResourcePaged', - 'StaticSiteCustomDomainOverviewARMResourcePaged', - 'AppServiceEnvironmentResourcePaged', - 'StampCapacityPaged', - 'InboundEnvironmentEndpointPaged', - 'WorkerPoolResourcePaged', - 'ResourceMetricDefinitionPaged', - 'SkuInfoPaged', - 'UsagePaged', - 'OutboundEnvironmentEndpointPaged', - 'AppServicePlanPaged', - 'StrPaged', - 'HybridConnectionPaged', - 'ResourceHealthMetadataPaged', - 'KeyVaultSecretStatus', - 'CertificateProductType', - 'ProvisioningState', - 'CertificateOrderStatus', - 'CertificateOrderActionType', - 'RouteType', - 'ManagedServiceIdentityType', - 'IpFilterTag', + 'AccessControlEntryAction', + 'AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem', + 'AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem', + 'AppServicePlanRestrictions', 'AutoHealActionType', - 'ConnectionStringType', - 'ScmType', - 'ManagedPipelineMode', - 'SiteLoadBalancing', - 'SupportedTlsVersions', - 'FtpsState', - 'SslState', - 'HostType', - 'UsageState', - 'SiteAvailabilityState', - 'RedundancyMode', - 'StatusOptions', - 'DomainStatus', 'AzureResourceType', + 'AzureStorageState', + 'AzureStorageType', + 'BackupItemStatus', + 'BackupRestoreOperationType', + 'BuildStatus', + 'BuiltInAuthenticationProvider', + 'CertificateOrderActionType', + 'CertificateOrderStatus', + 'CertificateProductType', + 'Channels', + 'CheckNameResourceTypes', + 'CloneAbilityResult', + 'ComputeModeOptions', + 'ConnectionStringType', + 'ContinuousWebJobStatus', 'CustomHostNameDnsRecordType', - 'HostNameType', + 'DatabaseType', 'DnsType', + 'DnsVerificationTestResult', + 'DomainPatchResourcePropertiesDomainNotRenewableReasonsItem', + 'DomainPropertiesDomainNotRenewableReasonsItem', + 'DomainStatus', 'DomainType', + 'Enum4', + 'Enum5', + 'FrequencyUnit', + 'FtpsState', + 'HostNameType', + 'HostType', 'HostingEnvironmentStatus', + 'InAvailabilityReasonType', 'InternalLoadBalancingMode', - 'ComputeModeOptions', - 'WorkerSizeOptions', - 'AccessControlEntryAction', - 'OperationStatus', + 'IpFilterTag', 'IssueType', - 'SolutionType', - 'RenderingType', - 'ResourceScopeType', - 'NotificationLevel', - 'Channels', - 'AppServicePlanRestrictions', - 'InAvailabilityReasonType', - 'CheckNameResourceTypes', - 'ValidateResourceTypes', - 'ResolveStatus', - 'ConfigReferenceSource', - 'ConfigReferenceLocation', + 'KeyVaultSecretStatus', 'LogLevel', - 'AzureStorageType', - 'AzureStorageState', - 'BackupItemStatus', - 'DatabaseType', - 'FrequencyUnit', - 'ContinuousWebJobStatus', - 'WebJobType', - 'PublishingProfileFormat', - 'DnsVerificationTestResult', 'MSDeployLogEntryType', 'MSDeployProvisioningState', + 'ManagedPipelineMode', + 'ManagedServiceIdentityType', 'MySqlMigrationType', + 'NotificationLevel', + 'OperationStatus', + 'ProvisioningState', 'PublicCertificateLocation', - 'BackupRestoreOperationType', - 'UnauthenticatedClientAction', - 'BuiltInAuthenticationProvider', - 'CloneAbilityResult', + 'PublishingProfileFormat', + 'RedundancyMode', + 'RenderingType', + 'ResolveStatus', + 'ResourceScopeType', + 'RouteType', + 'ScmType', + 'SiteAvailabilityState', 'SiteExtensionType', - 'TriggeredWebJobStatus', + 'SiteLoadBalancing', 'SiteRuntimeState', - 'BuildStatus', - 'TriggerTypes', 'SkuName', + 'SolutionType', + 'SslState', + 'StatusOptions', + 'SupportedTlsVersions', + 'TriggerTypes', + 'TriggeredWebJobStatus', + 'UnauthenticatedClientAction', + 'UsageState', + 'ValidateResourceTypes', + 'WebJobType', + 'WorkerSizeOptions', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models.py index 2879e5e11a0b..a13d737ac147 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models.py @@ -1,29 +1,25 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AbnormalTimePeriod(Model): +class AbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period identified in diagnosis. - :param start_time: Start time of the downtime - :type start_time: datetime - :param end_time: End time of the downtime - :type end_time: datetime - :param events: List of Possible Cause of downtime - :type events: - list[~azure.mgmt.web.v2019_08_01.models.DetectorAbnormalTimePeriod] - :param solutions: List of proposed solutions + :param start_time: Start time of the downtime. + :type start_time: ~datetime.datetime + :param end_time: End time of the downtime. + :type end_time: ~datetime.datetime + :param events: List of Possible Cause of downtime. + :type events: list[~azure.mgmt.web.v2019_08_01.models.DetectorAbnormalTimePeriod] + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2019_08_01.models.Solution] """ @@ -34,7 +30,10 @@ class AbnormalTimePeriod(Model): 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AbnormalTimePeriod, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -42,7 +41,7 @@ def __init__(self, **kwargs): self.solutions = kwargs.get('solutions', None) -class Address(Model): +class Address(msrest.serialization.Model): """Address information for domain registration. All required parameters must be populated in order to send to Azure. @@ -78,22 +77,23 @@ class Address(Model): 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Address, self).__init__(**kwargs) - self.address1 = kwargs.get('address1', None) + self.address1 = kwargs['address1'] self.address2 = kwargs.get('address2', None) - self.city = kwargs.get('city', None) - self.country = kwargs.get('country', None) - self.postal_code = kwargs.get('postal_code', None) - self.state = kwargs.get('state', None) + self.city = kwargs['city'] + self.country = kwargs['country'] + self.postal_code = kwargs['postal_code'] + self.state = kwargs['state'] -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -118,7 +118,10 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -129,8 +132,7 @@ def __init__(self, **kwargs): class AddressResponse(ProxyOnlyResource): """Describes main public IP address and any extra virtual IPs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -142,15 +144,13 @@ class AddressResponse(ProxyOnlyResource): :vartype type: str :param service_ip_address: Main public virtual IP. :type service_ip_address: str - :param internal_ip_address: Virtual Network internal IP address of the App - Service Environment if it is in internal load-balancing mode. + :param internal_ip_address: Virtual Network internal IP address of the App Service Environment + if it is in internal load-balancing mode. :type internal_ip_address: str - :param outbound_ip_addresses: IP addresses appearing on outbound - connections. + :param outbound_ip_addresses: IP addresses appearing on outbound connections. :type outbound_ip_addresses: list[str] :param vip_mappings: Additional virtual IPs. - :type vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :type vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] """ _validation = { @@ -170,7 +170,10 @@ class AddressResponse(ProxyOnlyResource): 'vip_mappings': {'key': 'properties.vipMappings', 'type': '[VirtualIPMapping]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AddressResponse, self).__init__(**kwargs) self.service_ip_address = kwargs.get('service_ip_address', None) self.internal_ip_address = kwargs.get('internal_ip_address', None) @@ -178,22 +181,19 @@ def __init__(self, **kwargs): self.vip_mappings = kwargs.get('vip_mappings', None) -class AnalysisData(Model): +class AnalysisData(msrest.serialization.Model): """Class Representing Detector Evidence used for analysis. - :param source: Name of the Detector + :param source: Name of the Detector. :type source: str - :param detector_definition: Detector Definition - :type detector_definition: - ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition - :param metrics: Source Metrics - :type metrics: - list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] - :param data: Additional Source Data + :param detector_definition: Detector Definition. + :type detector_definition: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :param metrics: Source Metrics. + :type metrics: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] + :param data: Additional Source Data. :type data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] - :param detector_meta_data: Detector Meta Data - :type detector_meta_data: - ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData + :param detector_meta_data: Detector Meta Data. + :type detector_meta_data: ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData """ _attribute_map = { @@ -204,7 +204,10 @@ class AnalysisData(Model): 'detector_meta_data': {'key': 'detectorMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnalysisData, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.detector_definition = kwargs.get('detector_definition', None) @@ -216,8 +219,7 @@ def __init__(self, **kwargs): class AnalysisDefinition(ProxyOnlyResource): """Definition of Analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -227,7 +229,7 @@ class AnalysisDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the Analysis + :ivar description: Description of the Analysis. :vartype description: str """ @@ -246,12 +248,15 @@ class AnalysisDefinition(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnalysisDefinition, self).__init__(**kwargs) self.description = None -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -262,19 +267,24 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = kwargs.get('url', None) -class ApiKVReference(Model): +class ApiKVReference(msrest.serialization.Model): """Description of site key vault references. + Variables are only populated by the server, and will be ignored when sending a request. + :param reference: :type reference: str - :param status: Possible values include: 'Initialized', 'Resolved', - 'InvalidSyntax', 'MSINotEnabled', 'VaultNotFound', 'SecretNotFound', - 'SecretVersionNotFound', 'AccessToKeyVaultDenied', 'OtherReasons' + :param status: Possible values include: "Initialized", "Resolved", "InvalidSyntax", + "MSINotEnabled", "VaultNotFound", "SecretNotFound", "SecretVersionNotFound", + "AccessToKeyVaultDenied", "OtherReasons". :type status: str or ~azure.mgmt.web.v2019_08_01.models.ResolveStatus :param vault_name: :type vault_name: str @@ -282,33 +292,41 @@ class ApiKVReference(Model): :type secret_name: str :param secret_version: :type secret_version: str - :param identity_type: Possible values include: 'None', 'SystemAssigned', - 'UserAssigned' - :type identity_type: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType + :param identity_type: Type of managed service identity. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type identity_type: str or ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType :param details: :type details: str - :param source: Possible values include: 'KeyVault' - :type source: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceSource - :param location: Possible values include: 'ApplicationSetting' - :type location: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceLocation + :ivar source: Default value: "KeyVault". + :vartype source: str + :ivar location: Default value: "ApplicationSetting". + :vartype location: str """ + _validation = { + 'source': {'constant': True}, + 'location': {'constant': True}, + } + _attribute_map = { 'reference': {'key': 'reference', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'ResolveStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'vault_name': {'key': 'vaultName', 'type': 'str'}, 'secret_name': {'key': 'secretName', 'type': 'str'}, 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - 'identity_type': {'key': 'identityType', 'type': 'ManagedServiceIdentityType'}, + 'identity_type': {'key': 'identityType', 'type': 'str'}, 'details': {'key': 'details', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'ConfigReferenceSource'}, - 'location': {'key': 'location', 'type': 'ConfigReferenceLocation'}, + 'source': {'key': 'source', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + source = "KeyVault" + location = "ApplicationSetting" + + def __init__( + self, + **kwargs + ): super(ApiKVReference, self).__init__(**kwargs) self.reference = kwargs.get('reference', None) self.status = kwargs.get('status', None) @@ -317,11 +335,9 @@ def __init__(self, **kwargs): self.secret_version = kwargs.get('secret_version', None) self.identity_type = kwargs.get('identity_type', None) self.details = kwargs.get('details', None) - self.source = kwargs.get('source', None) - self.location = kwargs.get('location', None) -class ApiManagementConfig(Model): +class ApiManagementConfig(msrest.serialization.Model): """Azure API management (APIM) configuration linked to the app. :param id: APIM-Api Identifier. @@ -332,19 +348,20 @@ class ApiManagementConfig(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiManagementConfig, self).__init__(**kwargs) self.id = kwargs.get('id', None) -class ApplicationLogsConfig(Model): +class ApplicationLogsConfig(msrest.serialization.Model): """Application logs configuration. :param file_system: Application logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2019_08_01.models.FileSystemApplicationLogsConfig - :param azure_table_storage: Application logs to azure table storage - configuration. + :type file_system: ~azure.mgmt.web.v2019_08_01.models.FileSystemApplicationLogsConfig + :param azure_table_storage: Application logs to azure table storage configuration. :type azure_table_storage: ~azure.mgmt.web.v2019_08_01.models.AzureTableStorageApplicationLogsConfig :param azure_blob_storage: Application logs to blob storage configuration. @@ -358,14 +375,17 @@ class ApplicationLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageApplicationLogsConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationLogsConfig, self).__init__(**kwargs) self.file_system = kwargs.get('file_system', None) self.azure_table_storage = kwargs.get('azure_table_storage', None) self.azure_blob_storage = kwargs.get('azure_blob_storage', None) -class ApplicationStack(Model): +class ApplicationStack(msrest.serialization.Model): """Application stack. :param name: Application stack name. @@ -375,11 +395,9 @@ class ApplicationStack(Model): :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] """ _attribute_map = { @@ -390,7 +408,10 @@ class ApplicationStack(Model): 'frameworks': {'key': 'frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationStack, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -399,11 +420,42 @@ def __init__(self, **kwargs): self.frameworks = kwargs.get('frameworks', None) +class ApplicationStackCollection(msrest.serialization.Model): + """Collection of Application Stacks. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ApplicationStackResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationStackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationStackCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ApplicationStackResource(ProxyOnlyResource): """ARM resource for a ApplicationStack. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -413,18 +465,16 @@ class ApplicationStackResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param application_stack_resource_name: Application stack name. - :type application_stack_resource_name: str + :param name_properties_name: Application stack name. + :type name_properties_name: str :param display: Application stack display name. :type display: str :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] """ _validation = { @@ -438,40 +488,40 @@ class ApplicationStackResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'application_stack_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'display': {'key': 'properties.display', 'type': 'str'}, 'dependency': {'key': 'properties.dependency', 'type': 'str'}, 'major_versions': {'key': 'properties.majorVersions', 'type': '[StackMajorVersion]'}, 'frameworks': {'key': 'properties.frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationStackResource, self).__init__(**kwargs) - self.application_stack_resource_name = kwargs.get('application_stack_resource_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.display = kwargs.get('display', None) self.dependency = kwargs.get('dependency', None) self.major_versions = kwargs.get('major_versions', None) self.frameworks = kwargs.get('frameworks', None) -class AppServiceCertificate(Model): +class AppServiceCertificate(msrest.serialization.Model): """Key Vault container for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -481,21 +531,55 @@ class AppServiceCertificate(Model): _attribute_map = { 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificate, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) self.provisioning_state = None -class Resource(Model): +class AppServiceCertificateCollection(msrest.serialization.Model): + """Collection of certificate order certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceCertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -509,7 +593,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -529,12 +613,15 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.type = None self.tags = kwargs.get('tags', None) @@ -542,8 +629,7 @@ def __init__(self, **kwargs): class AppServiceCertificateOrder(Resource): """SSL certificate purchase order. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -557,63 +643,54 @@ class AppServiceCertificateOrder(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2019_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -623,7 +700,6 @@ class AppServiceCertificateOrder(Resource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -649,10 +725,10 @@ class AppServiceCertificateOrder(Resource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -665,7 +741,10 @@ class AppServiceCertificateOrder(Resource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateOrder, self).__init__(**kwargs) self.certificates = kwargs.get('certificates', None) self.distinguished_name = kwargs.get('distinguished_name', None) @@ -688,14 +767,43 @@ def __init__(self, **kwargs): self.next_auto_renewal_time_stamp = None -class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): - """ARM resource for a certificate order that is purchased through Azure. +class AppServiceCertificateOrderCollection(msrest.serialization.Model): + """Collection of certificate orders. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateOrder]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceCertificateOrderCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): + """ARM resource for a certificate order that is purchased through Azure. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -705,60 +813,51 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2019_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -767,7 +866,6 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -791,10 +889,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -807,7 +905,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateOrderPatchResource, self).__init__(**kwargs) self.certificates = kwargs.get('certificates', None) self.distinguished_name = kwargs.get('distinguished_name', None) @@ -831,11 +932,9 @@ def __init__(self, **kwargs): class AppServiceCertificatePatchResource(ProxyOnlyResource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -849,14 +948,12 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -873,10 +970,13 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificatePatchResource, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) @@ -884,11 +984,9 @@ def __init__(self, **kwargs): class AppServiceCertificateResource(Resource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -902,20 +1000,18 @@ class AppServiceCertificateResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -935,71 +1031,66 @@ class AppServiceCertificateResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceCertificateResource, self).__init__(**kwargs) self.key_vault_id = kwargs.get('key_vault_id', None) self.key_vault_secret_name = kwargs.get('key_vault_secret_name', None) self.provisioning_state = None -class AppServiceEnvironment(Model): +class AppServiceEnvironment(msrest.serialization.Model): """Description of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param name: Required. Name of the App Service Environment. :type name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param location: Required. Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :type virtual_network: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2019_08_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Required. Description of worker pools with worker size IDs, VM sizes, and + number of workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2019_08_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1007,35 +1098,29 @@ class AppServiceEnvironment(Model): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2019_08_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1043,34 +1128,31 @@ class AppServiceEnvironment(Model): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1101,13 +1183,13 @@ class AppServiceEnvironment(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, 'vnet_name': {'key': 'vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'workerPools', 'type': '[WorkerPool]'}, @@ -1140,20 +1222,23 @@ class AppServiceEnvironment(Model): 'ssl_cert_key_vault_secret_name': {'key': 'sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironment, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.location = kwargs.get('location', None) + self.name = kwargs['name'] + self.location = kwargs['location'] self.provisioning_state = None self.status = None self.vnet_name = kwargs.get('vnet_name', None) self.vnet_resource_group_name = kwargs.get('vnet_resource_group_name', None) self.vnet_subnet_name = kwargs.get('vnet_subnet_name', None) - self.virtual_network = kwargs.get('virtual_network', None) + self.virtual_network = kwargs['virtual_network'] self.internal_load_balancing_mode = kwargs.get('internal_load_balancing_mode', None) self.multi_size = kwargs.get('multi_size', None) self.multi_role_count = kwargs.get('multi_role_count', None) - self.worker_pools = kwargs.get('worker_pools', None) + self.worker_pools = kwargs['worker_pools'] self.ipssl_address_count = kwargs.get('ipssl_address_count', None) self.database_edition = None self.database_service_objective = None @@ -1183,14 +1268,43 @@ def __init__(self, **kwargs): self.ssl_cert_key_vault_secret_name = kwargs.get('ssl_cert_key_vault_secret_name', None) -class AppServiceEnvironmentPatchResource(ProxyOnlyResource): - """ARM resource for a app service environment. +class AppServiceEnvironmentCollection(msrest.serialization.Model): + """Collection of App Service Environments. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServiceEnvironmentCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class AppServiceEnvironmentPatchResource(ProxyOnlyResource): + """ARM resource for a app service environment. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -1199,54 +1313,46 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_environment_patch_resource_name: Required. Name of the - App Service Environment. - :type app_service_environment_patch_resource_name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location: Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2019_08_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2019_08_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1254,35 +1360,29 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2019_08_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1290,34 +1390,31 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1325,12 +1422,8 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_environment_patch_resource_name': {'required': True}, - 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1353,15 +1446,15 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_environment_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1394,9 +1487,12 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironmentPatchResource, self).__init__(**kwargs) - self.app_service_environment_patch_resource_name = kwargs.get('app_service_environment_patch_resource_name', None) + self.name_properties_name = kwargs.get('name_properties_name', None) self.location = kwargs.get('location', None) self.provisioning_state = None self.status = None @@ -1440,8 +1536,7 @@ def __init__(self, **kwargs): class AppServiceEnvironmentResource(Resource): """App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1455,56 +1550,48 @@ class AppServiceEnvironmentResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_environment_resource_name: Required. Name of the App - Service Environment. - :type app_service_environment_resource_name: str - :param app_service_environment_resource_location: Required. Location of - the App Service Environment, e.g. "West US". - :type app_service_environment_resource_location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location_properties_location: Location of the App Service Environment, e.g. "West US". + :type location_properties_location: str + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2019_08_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2019_08_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1512,35 +1599,29 @@ class AppServiceEnvironmentResource(Resource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2019_08_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1548,34 +1629,31 @@ class AppServiceEnvironmentResource(Resource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1584,12 +1662,8 @@ class AppServiceEnvironmentResource(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_environment_resource_name': {'required': True}, - 'app_service_environment_resource_location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1614,15 +1688,15 @@ class AppServiceEnvironmentResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_environment_resource_name': {'key': 'properties.name', 'type': 'str'}, - 'app_service_environment_resource_location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1655,10 +1729,13 @@ class AppServiceEnvironmentResource(Resource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServiceEnvironmentResource, self).__init__(**kwargs) - self.app_service_environment_resource_name = kwargs.get('app_service_environment_resource_name', None) - self.app_service_environment_resource_location = kwargs.get('app_service_environment_resource_location', None) + self.name_properties_name = kwargs.get('name_properties_name', None) + self.location_properties_location = kwargs.get('location_properties_location', None) self.provisioning_state = None self.status = None self.vnet_name = kwargs.get('vnet_name', None) @@ -1701,8 +1778,7 @@ def __init__(self, **kwargs): class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1716,66 +1792,59 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState """ _validation = { @@ -1799,8 +1868,9 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1817,12 +1887,15 @@ class AppServicePlan(Resource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlan, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None self.subscription = None @@ -1842,14 +1915,44 @@ def __init__(self, **kwargs): self.target_worker_count = kwargs.get('target_worker_count', None) self.target_worker_size_id = kwargs.get('target_worker_size_id', None) self.provisioning_state = None - self.sku = kwargs.get('sku', None) + + +class AppServicePlanCollection(msrest.serialization.Model): + """Collection of App Service plans. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServicePlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppServicePlanCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None class AppServicePlanPatchResource(ProxyOnlyResource): """ARM resource for a app service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1859,62 +1962,56 @@ class AppServicePlanPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: This needs to set to :code:`true` when creating a Linux App + Service Plan, along with :code:`kind` set to :code:`Linux`. It should + be :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState """ _validation = { @@ -1936,7 +2033,7 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1953,10 +2050,13 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppServicePlanPatchResource, self).__init__(**kwargs) self.worker_tier_name = kwargs.get('worker_tier_name', None) self.status = None @@ -1979,11 +2079,10 @@ def __init__(self, **kwargs): self.provisioning_state = None -class ArmIdWrapper(Model): +class ArmIdWrapper(msrest.serialization.Model): """A wrapper for an ARM resource id. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: :vartype id: str @@ -1997,42 +2096,46 @@ class ArmIdWrapper(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ArmIdWrapper, self).__init__(**kwargs) self.id = None -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2019_08_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2019_08_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2019_08_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2019_08_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) self.custom_action = kwargs.get('custom_action', None) self.min_process_execution_time = kwargs.get('min_process_execution_time', None) -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -2045,17 +2148,19 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = kwargs.get('exe', None) self.parameters = kwargs.get('parameters', None) -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2019_08_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2019_08_01.models.AutoHealActions @@ -2066,13 +2171,16 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = kwargs.get('triggers', None) self.actions = kwargs.get('actions', None) -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -2080,11 +2188,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2019_08_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2019_08_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2019_08_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2019_08_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -2094,7 +2200,10 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = kwargs.get('requests', None) self.private_bytes_in_kb = kwargs.get('private_bytes_in_kb', None) @@ -2102,14 +2211,13 @@ def __init__(self, **kwargs): self.slow_requests = kwargs.get('slow_requests', None) -class AzureBlobStorageApplicationLogsConfig(Model): +class AzureBlobStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs azure blob storage configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2019_08_01.models.LogLevel - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. @@ -2118,30 +2226,32 @@ class AzureBlobStorageApplicationLogsConfig(Model): """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureBlobStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = kwargs.get('level', None) self.sas_url = kwargs.get('sas_url', None) self.retention_in_days = kwargs.get('retention_in_days', None) -class AzureBlobStorageHttpLogsConfig(Model): +class AzureBlobStorageHttpLogsConfig(msrest.serialization.Model): """Http logs to azure blob storage configuration. - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -2151,37 +2261,34 @@ class AzureBlobStorageHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureBlobStorageHttpLogsConfig, self).__init__(**kwargs) self.sas_url = kwargs.get('sas_url', None) self.retention_in_days = kwargs.get('retention_in_days', None) self.enabled = kwargs.get('enabled', None) -class AzureStorageInfoValue(Model): - """Azure Files or Blob Storage access information value for dictionary - storage. +class AzureStorageInfoValue(msrest.serialization.Model): + """Azure Files or Blob Storage access information value for dictionary storage. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of storage. Possible values include: 'AzureFiles', - 'AzureBlob' + :param type: Type of storage. Possible values include: "AzureFiles", "AzureBlob". :type type: str or ~azure.mgmt.web.v2019_08_01.models.AzureStorageType :param account_name: Name of the storage account. :type account_name: str - :param share_name: Name of the file share (container name, for Blob - storage). + :param share_name: Name of the file share (container name, for Blob storage). :type share_name: str :param access_key: Access key for the storage account. :type access_key: str - :param mount_path: Path to mount the storage within the site's runtime - environment. + :param mount_path: Path to mount the storage within the site's runtime environment. :type mount_path: str - :ivar state: State of the storage account. Possible values include: 'Ok', - 'InvalidCredentials', 'InvalidShare' - :vartype state: str or - ~azure.mgmt.web.v2019_08_01.models.AzureStorageState + :ivar state: State of the storage account. Possible values include: "Ok", "InvalidCredentials", + "InvalidShare". + :vartype state: str or ~azure.mgmt.web.v2019_08_01.models.AzureStorageState """ _validation = { @@ -2189,15 +2296,18 @@ class AzureStorageInfoValue(Model): } _attribute_map = { - 'type': {'key': 'type', 'type': 'AzureStorageType'}, + 'type': {'key': 'type', 'type': 'str'}, 'account_name': {'key': 'accountName', 'type': 'str'}, 'share_name': {'key': 'shareName', 'type': 'str'}, 'access_key': {'key': 'accessKey', 'type': 'str'}, 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'AzureStorageState'}, + 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureStorageInfoValue, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.account_name = kwargs.get('account_name', None) @@ -2210,8 +2320,7 @@ def __init__(self, **kwargs): class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): """AzureStorageInfo dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2222,8 +2331,7 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AzureStorageInfoValue] + :type properties: dict[str, ~azure.mgmt.web.v2019_08_01.models.AzureStorageInfoValue] """ _validation = { @@ -2240,21 +2348,23 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{AzureStorageInfoValue}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureStoragePropertyDictionaryResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class AzureTableStorageApplicationLogsConfig(Model): +class AzureTableStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs to Azure table storage configuration. All required parameters must be populated in order to send to Azure. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2019_08_01.models.LogLevel - :param sas_url: Required. SAS URL to an Azure table with add/query/delete - permissions. + :param sas_url: Required. SAS URL to an Azure table with add/query/delete permissions. :type sas_url: str """ @@ -2263,21 +2373,23 @@ class AzureTableStorageApplicationLogsConfig(Model): } _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureTableStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = kwargs.get('level', None) - self.sas_url = kwargs.get('sas_url', None) + self.sas_url = kwargs['sas_url'] class BackupItem(ProxyOnlyResource): """Backup description. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2289,40 +2401,35 @@ class BackupItem(ProxyOnlyResource): :vartype type: str :ivar backup_id: Id of the backup. :vartype backup_id: int - :ivar storage_account_url: SAS URL for the storage account container which - contains this backup. + :ivar storage_account_url: SAS URL for the storage account container which contains this + backup. :vartype storage_account_url: str :ivar blob_name: Name of the blob which contains data for this backup. :vartype blob_name: str - :ivar backup_item_name: Name of this backup. - :vartype backup_item_name: str - :ivar status: Backup status. Possible values include: 'InProgress', - 'Failed', 'Succeeded', 'TimedOut', 'Created', 'Skipped', - 'PartiallySucceeded', 'DeleteInProgress', 'DeleteFailed', 'Deleted' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.BackupItemStatus + :ivar name_properties_name: Name of this backup. + :vartype name_properties_name: str + :ivar status: Backup status. Possible values include: "InProgress", "Failed", "Succeeded", + "TimedOut", "Created", "Skipped", "PartiallySucceeded", "DeleteInProgress", "DeleteFailed", + "Deleted". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.BackupItemStatus :ivar size_in_bytes: Size of the backup in bytes. :vartype size_in_bytes: long :ivar created: Timestamp of the backup creation. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar log: Details regarding this backup. Might contain an error message. :vartype log: str :ivar databases: List of databases included in the backup. - :vartype databases: - list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] - :ivar scheduled: True if this backup has been created due to a schedule - being triggered. + :vartype databases: list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] + :ivar scheduled: True if this backup has been created due to a schedule being triggered. :vartype scheduled: bool - :ivar last_restore_time_stamp: Timestamp of a last restore operation which - used this backup. - :vartype last_restore_time_stamp: datetime + :ivar last_restore_time_stamp: Timestamp of a last restore operation which used this backup. + :vartype last_restore_time_stamp: ~datetime.datetime :ivar finished_time_stamp: Timestamp when this backup finished. - :vartype finished_time_stamp: datetime - :ivar correlation_id: Unique correlation identifier. Please use this along - with the timestamp while communicating with Azure support. + :vartype finished_time_stamp: ~datetime.datetime + :ivar correlation_id: Unique correlation identifier. Please use this along with the timestamp + while communicating with Azure support. :vartype correlation_id: str - :ivar website_size_in_bytes: Size of the original web app which has been - backed up. + :ivar website_size_in_bytes: Size of the original web app which has been backed up. :vartype website_size_in_bytes: long """ @@ -2333,7 +2440,7 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'readonly': True}, 'storage_account_url': {'readonly': True}, 'blob_name': {'readonly': True}, - 'backup_item_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'status': {'readonly': True}, 'size_in_bytes': {'readonly': True}, 'created': {'readonly': True}, @@ -2354,8 +2461,8 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'key': 'properties.id', 'type': 'int'}, 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'blob_name': {'key': 'properties.blobName', 'type': 'str'}, - 'backup_item_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'BackupItemStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, 'created': {'key': 'properties.created', 'type': 'iso-8601'}, 'log': {'key': 'properties.log', 'type': 'str'}, @@ -2367,12 +2474,15 @@ class BackupItem(ProxyOnlyResource): 'website_size_in_bytes': {'key': 'properties.websiteSizeInBytes', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupItem, self).__init__(**kwargs) self.backup_id = None self.storage_account_url = None self.blob_name = None - self.backup_item_name = None + self.name_properties_name = None self.status = None self.size_in_bytes = None self.created = None @@ -2385,14 +2495,43 @@ def __init__(self, **kwargs): self.website_size_in_bytes = None -class BackupRequest(ProxyOnlyResource): - """Description of a backup which will be performed. +class BackupItemCollection(msrest.serialization.Model): + """Collection of backup items. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.BackupItem] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BackupItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BackupItemCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class BackupRequest(ProxyOnlyResource): + """Description of a backup which will be performed. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2403,24 +2542,21 @@ class BackupRequest(ProxyOnlyResource): :vartype type: str :param backup_name: Name of the backup. :type backup_name: str - :param enabled: True if the backup schedule is enabled (must be included - in that case), false if the backup schedule should be disabled. + :param enabled: True if the backup schedule is enabled (must be included in that case), false + if the backup schedule should be disabled. :type enabled: bool - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str - :param backup_schedule: Schedule for the backup if it is executed - periodically. + :param backup_schedule: Schedule for the backup if it is executed periodically. :type backup_schedule: ~azure.mgmt.web.v2019_08_01.models.BackupSchedule :param databases: Databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] + :type databases: list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, } _attribute_map = { @@ -2435,7 +2571,10 @@ class BackupRequest(ProxyOnlyResource): 'databases': {'key': 'properties.databases', 'type': '[DatabaseBackupSetting]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupRequest, self).__init__(**kwargs) self.backup_name = kwargs.get('backup_name', None) self.enabled = kwargs.get('enabled', None) @@ -2444,36 +2583,29 @@ def __init__(self, **kwargs): self.databases = kwargs.get('databases', None) -class BackupSchedule(Model): - """Description of a backup schedule. Describes how often should be the backup - performed and what should be the retention policy. +class BackupSchedule(msrest.serialization.Model): + """Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param frequency_interval: Required. How often the backup should be - executed (e.g. for weekly backup, this should be set to 7 and - FrequencyUnit should be set to Day). Default value: 7 . + :param frequency_interval: Required. How often the backup should be executed (e.g. for weekly + backup, this should be set to 7 and FrequencyUnit should be set to Day). :type frequency_interval: int - :param frequency_unit: Required. The unit of time for how often the backup - should be executed (e.g. for weekly backup, this should be set to Day and - FrequencyInterval should be set to 7). Possible values include: 'Day', - 'Hour'. Default value: "Day" . - :type frequency_unit: str or - ~azure.mgmt.web.v2019_08_01.models.FrequencyUnit - :param keep_at_least_one_backup: Required. True if the retention policy - should always keep at least one backup in the storage account, regardless - how old it is; false otherwise. Default value: True . + :param frequency_unit: Required. The unit of time for how often the backup should be executed + (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). + Possible values include: "Day", "Hour". Default value: "Day". + :type frequency_unit: str or ~azure.mgmt.web.v2019_08_01.models.FrequencyUnit + :param keep_at_least_one_backup: Required. True if the retention policy should always keep at + least one backup in the storage account, regardless how old it is; false otherwise. :type keep_at_least_one_backup: bool - :param retention_period_in_days: Required. After how many days backups - should be deleted. Default value: 30 . + :param retention_period_in_days: Required. After how many days backups should be deleted. :type retention_period_in_days: int :param start_time: When the schedule should start working. - :type start_time: datetime + :type start_time: ~datetime.datetime :ivar last_execution_time: Last time when this schedule was triggered. - :vartype last_execution_time: datetime + :vartype last_execution_time: ~datetime.datetime """ _validation = { @@ -2486,14 +2618,17 @@ class BackupSchedule(Model): _attribute_map = { 'frequency_interval': {'key': 'frequencyInterval', 'type': 'int'}, - 'frequency_unit': {'key': 'frequencyUnit', 'type': 'FrequencyUnit'}, + 'frequency_unit': {'key': 'frequencyUnit', 'type': 'str'}, 'keep_at_least_one_backup': {'key': 'keepAtLeastOneBackup', 'type': 'bool'}, 'retention_period_in_days': {'key': 'retentionPeriodInDays', 'type': 'int'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupSchedule, self).__init__(**kwargs) self.frequency_interval = kwargs.get('frequency_interval', 7) self.frequency_unit = kwargs.get('frequency_unit', "Day") @@ -2504,11 +2639,9 @@ def __init__(self, **kwargs): class BillingMeter(ProxyOnlyResource): - """App Service billing entity that contains information about meter which the - Azure billing system utilizes to charge users for services. + """App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2518,17 +2651,17 @@ class BillingMeter(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param meter_id: Meter GUID onboarded in Commerce + :param meter_id: Meter GUID onboarded in Commerce. :type meter_id: str - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param short_name: Short Name from App Service Azure pricing Page + :param short_name: Short Name from App Service Azure pricing Page. :type short_name: str - :param friendly_name: Friendly name of the meter + :param friendly_name: Friendly name of the meter. :type friendly_name: str - :param resource_type: App Service ResourceType meter used for + :param resource_type: App Service ResourceType meter used for. :type resource_type: str - :param os_type: App Service OS type meter used for + :param os_type: App Service OS type meter used for. :type os_type: str """ @@ -2551,7 +2684,10 @@ class BillingMeter(ProxyOnlyResource): 'os_type': {'key': 'properties.osType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BillingMeter, self).__init__(**kwargs) self.meter_id = kwargs.get('meter_id', None) self.billing_location = kwargs.get('billing_location', None) @@ -2561,7 +2697,39 @@ def __init__(self, **kwargs): self.os_type = kwargs.get('os_type', None) -class Capability(Model): +class BillingMeterCollection(msrest.serialization.Model): + """Collection of Billing Meters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.BillingMeter] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingMeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BillingMeterCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -2578,7 +2746,10 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -2588,8 +2759,7 @@ def __init__(self, **kwargs): class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2603,7 +2773,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -2620,41 +2790,38 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param canonical_name: CNAME of the certificate to be issued via free - certificate + :param canonical_name: CNAME of the certificate to be issued via free certificate. :type canonical_name: str """ @@ -2670,7 +2837,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2703,12 +2869,15 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'canonical_name': {'key': 'properties.canonicalName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Certificate, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -2732,24 +2901,55 @@ def __init__(self, **kwargs): self.canonical_name = kwargs.get('canonical_name', None) -class CertificateDetails(Model): - """SSL certificate details. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: Certificate Version. - :vartype version: int - :ivar serial_number: Certificate Serial Number. - :vartype serial_number: str + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CertificateDetails(msrest.serialization.Model): + """SSL certificate details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Certificate Version. + :vartype version: int + :ivar serial_number: Certificate Serial Number. + :vartype serial_number: str :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str :ivar subject: Certificate Subject. :vartype subject: str :ivar not_before: Date Certificate is valid from. - :vartype not_before: datetime + :vartype not_before: ~datetime.datetime :ivar not_after: Date Certificate is valid to. - :vartype not_after: datetime + :vartype not_after: ~datetime.datetime :ivar signature_algorithm: Certificate Signature algorithm. :vartype signature_algorithm: str :ivar issuer: Certificate Issuer. @@ -2782,7 +2982,10 @@ class CertificateDetails(Model): 'raw_data': {'key': 'rawData', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateDetails, self).__init__(**kwargs) self.version = None self.serial_number = None @@ -2798,8 +3001,7 @@ def __init__(self, **kwargs): class CertificateEmail(ProxyOnlyResource): """SSL certificate email. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2812,7 +3014,7 @@ class CertificateEmail(ProxyOnlyResource): :param email_id: Email id. :type email_id: str :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime """ _validation = { @@ -2830,7 +3032,10 @@ class CertificateEmail(ProxyOnlyResource): 'time_stamp': {'key': 'properties.timeStamp', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateEmail, self).__init__(**kwargs) self.email_id = kwargs.get('email_id', None) self.time_stamp = kwargs.get('time_stamp', None) @@ -2839,8 +3044,7 @@ def __init__(self, **kwargs): class CertificateOrderAction(ProxyOnlyResource): """Certificate order action. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2850,16 +3054,14 @@ class CertificateOrderAction(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar action_type: Action type. Possible values include: - 'CertificateIssued', 'CertificateOrderCanceled', - 'CertificateOrderCreated', 'CertificateRevoked', - 'DomainValidationComplete', 'FraudDetected', 'OrgNameChange', - 'OrgValidationComplete', 'SanDrop', 'FraudCleared', 'CertificateExpired', - 'CertificateExpirationWarning', 'FraudDocumentationRequired', 'Unknown' - :vartype action_type: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateOrderActionType + :ivar action_type: Action type. Possible values include: "CertificateIssued", + "CertificateOrderCanceled", "CertificateOrderCreated", "CertificateRevoked", + "DomainValidationComplete", "FraudDetected", "OrgNameChange", "OrgValidationComplete", + "SanDrop", "FraudCleared", "CertificateExpired", "CertificateExpirationWarning", + "FraudDocumentationRequired", "Unknown". + :vartype action_type: str or ~azure.mgmt.web.v2019_08_01.models.CertificateOrderActionType :ivar created_at: Time at which the certificate action was performed. - :vartype created_at: datetime + :vartype created_at: ~datetime.datetime """ _validation = { @@ -2875,11 +3077,14 @@ class CertificateOrderAction(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'action_type': {'key': 'properties.actionType', 'type': 'CertificateOrderActionType'}, + 'action_type': {'key': 'properties.actionType', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOrderAction, self).__init__(**kwargs) self.action_type = None self.created_at = None @@ -2888,10 +3093,7 @@ def __init__(self, **kwargs): class CertificatePatchResource(ProxyOnlyResource): """ARM resource for a certificate. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2916,41 +3118,38 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param canonical_name: CNAME of the certificate to be issued via free - certificate + :param canonical_name: CNAME of the certificate to be issued via free certificate. :type canonical_name: str """ @@ -2965,7 +3164,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2996,12 +3194,15 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'canonical_name': {'key': 'properties.canonicalName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePatchResource, self).__init__(**kwargs) self.friendly_name = None self.subject_name = None @@ -3025,51 +3226,48 @@ def __init__(self, **kwargs): self.canonical_name = kwargs.get('canonical_name', None) -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str - :param source_web_app_location: Location of source app ex: West US or - North Europe + :param source_web_app_location: Location of source app ex: West US or North Europe. :type source_web_app_location: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str """ @@ -3091,13 +3289,16 @@ class CloningInfo(Model): 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = kwargs.get('correlation_id', None) self.overwrite = kwargs.get('overwrite', None) self.clone_custom_host_names = kwargs.get('clone_custom_host_names', None) self.clone_source_control = kwargs.get('clone_source_control', None) - self.source_web_app_id = kwargs.get('source_web_app_id', None) + self.source_web_app_id = kwargs['source_web_app_id'] self.source_web_app_location = kwargs.get('source_web_app_location', None) self.hosting_environment = kwargs.get('hosting_environment', None) self.app_settings_overrides = kwargs.get('app_settings_overrides', None) @@ -3106,19 +3307,40 @@ def __init__(self, **kwargs): self.traffic_manager_profile_name = kwargs.get('traffic_manager_profile_name', None) -class CloudError(Model): - """CloudError. +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned 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(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + class ConnectionStringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3129,8 +3351,7 @@ class ConnectionStringDictionary(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ConnStringValueTypePair] + :type properties: dict[str, ~azure.mgmt.web.v2019_08_01.models.ConnStringValueTypePair] """ _validation = { @@ -3147,47 +3368,53 @@ class ConnectionStringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{ConnStringValueTypePair}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnectionStringDictionary, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2019_08_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.connection_string = kwargs.get('connection_string', None) self.type = kwargs.get('type', None) -class ConnStringValueTypePair(Model): +class ConnStringValueTypePair(msrest.serialization.Model): """Database connection string value to type pair. All required parameters must be populated in order to send to Azure. :param value: Required. Value of pair. :type value: str - :param type: Required. Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Required. Type of database. Possible values include: "MySql", "SQLServer", + "SQLAzure", "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", + "RedisCache", "PostgreSQL". :type type: str or ~azure.mgmt.web.v2019_08_01.models.ConnectionStringType """ @@ -3198,20 +3425,21 @@ class ConnStringValueTypePair(Model): _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnStringValueTypePair, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = kwargs.get('type', None) + self.value = kwargs['value'] + self.type = kwargs['type'] -class Contact(Model): - """Contact information for domain registration. If 'Domain Privacy' option is - not selected then the contact information is made publicly available - through the Whois - directories as per ICANN requirements. +class Contact(msrest.serialization.Model): + """Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information is made publicly available through the Whois +directories as per ICANN requirements. All required parameters must be populated in order to send to Azure. @@ -3254,20 +3482,23 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.address_mailing = kwargs.get('address_mailing', None) - self.email = kwargs.get('email', None) + self.email = kwargs['email'] self.fax = kwargs.get('fax', None) self.job_title = kwargs.get('job_title', None) - self.name_first = kwargs.get('name_first', None) - self.name_last = kwargs.get('name_last', None) + self.name_first = kwargs['name_first'] + self.name_last = kwargs['name_last'] self.name_middle = kwargs.get('name_middle', None) self.organization = kwargs.get('organization', None) - self.phone = kwargs.get('phone', None) + self.phone = kwargs['phone'] -class ContainerCpuStatistics(Model): +class ContainerCpuStatistics(msrest.serialization.Model): """ContainerCpuStatistics. :param cpu_usage: @@ -3277,8 +3508,7 @@ class ContainerCpuStatistics(Model): :param online_cpu_count: :type online_cpu_count: int :param throttling_data: - :type throttling_data: - ~azure.mgmt.web.v2019_08_01.models.ContainerThrottlingData + :type throttling_data: ~azure.mgmt.web.v2019_08_01.models.ContainerThrottlingData """ _attribute_map = { @@ -3288,7 +3518,10 @@ class ContainerCpuStatistics(Model): 'throttling_data': {'key': 'throttlingData', 'type': 'ContainerThrottlingData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContainerCpuStatistics, self).__init__(**kwargs) self.cpu_usage = kwargs.get('cpu_usage', None) self.system_cpu_usage = kwargs.get('system_cpu_usage', None) @@ -3296,7 +3529,7 @@ def __init__(self, **kwargs): self.throttling_data = kwargs.get('throttling_data', None) -class ContainerCpuUsage(Model): +class ContainerCpuUsage(msrest.serialization.Model): """ContainerCpuUsage. :param total_usage: @@ -3316,7 +3549,10 @@ class ContainerCpuUsage(Model): 'user_mode_usage': {'key': 'userModeUsage', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContainerCpuUsage, self).__init__(**kwargs) self.total_usage = kwargs.get('total_usage', None) self.per_cpu_usage = kwargs.get('per_cpu_usage', None) @@ -3324,29 +3560,25 @@ def __init__(self, **kwargs): self.user_mode_usage = kwargs.get('user_mode_usage', None) -class ContainerInfo(Model): +class ContainerInfo(msrest.serialization.Model): """ContainerInfo. :param current_time_stamp: - :type current_time_stamp: datetime + :type current_time_stamp: ~datetime.datetime :param previous_time_stamp: - :type previous_time_stamp: datetime + :type previous_time_stamp: ~datetime.datetime :param current_cpu_stats: - :type current_cpu_stats: - ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics + :type current_cpu_stats: ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics :param previous_cpu_stats: - :type previous_cpu_stats: - ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics + :type previous_cpu_stats: ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics :param memory_stats: - :type memory_stats: - ~azure.mgmt.web.v2019_08_01.models.ContainerMemoryStatistics + :type memory_stats: ~azure.mgmt.web.v2019_08_01.models.ContainerMemoryStatistics :param name: :type name: str :param id: :type id: str :param eth0: - :type eth0: - ~azure.mgmt.web.v2019_08_01.models.ContainerNetworkInterfaceStatistics + :type eth0: ~azure.mgmt.web.v2019_08_01.models.ContainerNetworkInterfaceStatistics """ _attribute_map = { @@ -3360,7 +3592,10 @@ class ContainerInfo(Model): 'eth0': {'key': 'eth0', 'type': 'ContainerNetworkInterfaceStatistics'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContainerInfo, self).__init__(**kwargs) self.current_time_stamp = kwargs.get('current_time_stamp', None) self.previous_time_stamp = kwargs.get('previous_time_stamp', None) @@ -3372,7 +3607,7 @@ def __init__(self, **kwargs): self.eth0 = kwargs.get('eth0', None) -class ContainerMemoryStatistics(Model): +class ContainerMemoryStatistics(msrest.serialization.Model): """ContainerMemoryStatistics. :param usage: @@ -3389,14 +3624,17 @@ class ContainerMemoryStatistics(Model): 'limit': {'key': 'limit', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContainerMemoryStatistics, self).__init__(**kwargs) self.usage = kwargs.get('usage', None) self.max_usage = kwargs.get('max_usage', None) self.limit = kwargs.get('limit', None) -class ContainerNetworkInterfaceStatistics(Model): +class ContainerNetworkInterfaceStatistics(msrest.serialization.Model): """ContainerNetworkInterfaceStatistics. :param rx_bytes: @@ -3428,7 +3666,10 @@ class ContainerNetworkInterfaceStatistics(Model): 'tx_dropped': {'key': 'txDropped', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContainerNetworkInterfaceStatistics, self).__init__(**kwargs) self.rx_bytes = kwargs.get('rx_bytes', None) self.rx_packets = kwargs.get('rx_packets', None) @@ -3440,7 +3681,7 @@ def __init__(self, **kwargs): self.tx_dropped = kwargs.get('tx_dropped', None) -class ContainerThrottlingData(Model): +class ContainerThrottlingData(msrest.serialization.Model): """ContainerThrottlingData. :param periods: @@ -3457,7 +3698,10 @@ class ContainerThrottlingData(Model): 'throttled_time': {'key': 'throttledTime', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContainerThrottlingData, self).__init__(**kwargs) self.periods = kwargs.get('periods', None) self.throttled_periods = kwargs.get('throttled_periods', None) @@ -3467,8 +3711,7 @@ def __init__(self, **kwargs): class ContinuousWebJob(ProxyOnlyResource): """Continuous Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3478,10 +3721,9 @@ class ContinuousWebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param status: Job status. Possible values include: 'Initializing', - 'Starting', 'Running', 'PendingRestart', 'Stopped' - :type status: str or - ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobStatus + :param status: Job status. Possible values include: "Initializing", "Starting", "Running", + "PendingRestart", "Stopped". + :type status: str or ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobStatus :param detailed_status: Detailed status. :type detailed_status: str :param log_url: Log URL. @@ -3492,12 +3734,11 @@ class ContinuousWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2019_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -3514,19 +3755,22 @@ class ContinuousWebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ContinuousWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'detailed_status': {'key': 'properties.detailed_status', 'type': 'str'}, 'log_url': {'key': 'properties.log_url', 'type': 'str'}, 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContinuousWebJob, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.detailed_status = kwargs.get('detailed_status', None) @@ -3540,15 +3784,47 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) -class CorsSettings(Model): +class ContinuousWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContinuousWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ContinuousWebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] - :param support_credentials: Gets or sets whether CORS requests with - credentials are allowed. See + :param support_credentials: Gets or sets whether CORS requests with credentials are allowed. + See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials for more details. :type support_credentials: bool @@ -3559,25 +3835,26 @@ class CorsSettings(Model): 'support_credentials': {'key': 'supportCredentials', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = kwargs.get('allowed_origins', None) self.support_credentials = kwargs.get('support_credentials', None) -class CsmCopySlotEntity(Model): +class CsmCopySlotEntity(msrest.serialization.Model): """Copy deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during copy - operation. + :param target_slot: Required. Destination deployment slot during copy operation. :type target_slot: str - :param site_config: Required. The site object which will be merged with - the source slot site + :param site_config: Required. The site object which will be merged with the source slot site to produce new destination slot site object. - null to just copy source slot content. Otherwise a - Site + :code:`null` to just copy source slot content. Otherwise a + :code:`Site` object with properties to override source slot site. :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig """ @@ -3592,15 +3869,17 @@ class CsmCopySlotEntity(Model): 'site_config': {'key': 'siteConfig', 'type': 'SiteConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmCopySlotEntity, self).__init__(**kwargs) - self.target_slot = kwargs.get('target_slot', None) - self.site_config = kwargs.get('site_config', None) + self.target_slot = kwargs['target_slot'] + self.site_config = kwargs['site_config'] -class CsmMoveResourceEnvelope(Model): - """Object with a list of the resources that need to be moved and the resource - group they should be moved to. +class CsmMoveResourceEnvelope(msrest.serialization.Model): + """Object with a list of the resources that need to be moved and the resource group they should be moved to. :param target_resource_group: :type target_resource_group: str @@ -3617,24 +3896,58 @@ class CsmMoveResourceEnvelope(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmMoveResourceEnvelope, self).__init__(**kwargs) self.target_resource_group = kwargs.get('target_resource_group', None) self.resources = kwargs.get('resources', None) -class CsmOperationDescription(Model): +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2019_08_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -3644,7 +3957,10 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3652,24 +3968,27 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2019_08_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2019_08_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -3689,7 +4008,10 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3697,17 +4019,98 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class CsmPublishingProfileOptions(Model): +class CsmPublishingCredentialsPoliciesCollection(ProxyOnlyResource): + """Publishing Credentials Policies collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :param ftp: Whether FTP is allowed. + :type ftp: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :param scm: Whether Scm Basic Auth is allowed. + :type scm: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'ftp': {'key': 'properties.ftp', 'type': 'CsmPublishingCredentialsPoliciesEntity'}, + 'scm': {'key': 'properties.scm', 'type': 'CsmPublishingCredentialsPoliciesEntity'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmPublishingCredentialsPoliciesCollection, self).__init__(**kwargs) + self.ftp = kwargs.get('ftp', None) + self.scm = kwargs.get('scm', None) + + +class CsmPublishingCredentialsPoliciesEntity(ProxyOnlyResource): + """Publishing Credentials Policies parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :param allow: :code:`true` to allow access to a publishing method; otherwise, + :code:`false`. + :type allow: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'allow': {'key': 'properties.allow', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmPublishingCredentialsPoliciesEntity, self).__init__(**kwargs) + self.allow = kwargs.get('allow', None) + + +class CsmPublishingProfileOptions(msrest.serialization.Model): """Publishing options for requested profile. :param format: Name of the format. Valid values are: FileZilla3 WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2019_08_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the DisasterRecover - endpoint if true + Ftp. Possible values include: "FileZilla3", "WebDeploy", "Ftp". + :type format: str or ~azure.mgmt.web.v2019_08_01.models.PublishingProfileFormat + :param include_disaster_recovery_endpoints: Include the DisasterRecover endpoint if true. :type include_disaster_recovery_endpoints: bool """ @@ -3716,22 +4119,24 @@ class CsmPublishingProfileOptions(Model): 'include_disaster_recovery_endpoints': {'key': 'includeDisasterRecoveryEndpoints', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmPublishingProfileOptions, self).__init__(**kwargs) self.format = kwargs.get('format', None) self.include_disaster_recovery_endpoints = kwargs.get('include_disaster_recovery_endpoints', None) -class CsmSlotEntity(Model): +class CsmSlotEntity(msrest.serialization.Model): """Deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during swap - operation. + :param target_slot: Required. Destination deployment slot during swap operation. :type target_slot: str - :param preserve_vnet: Required. true to preserve Virtual - Network to the slot during swap; otherwise, false. + :param preserve_vnet: Required. :code:`true` to preserve Virtual Network to the + slot during swap; otherwise, :code:`false`. :type preserve_vnet: bool """ @@ -3745,19 +4150,22 @@ class CsmSlotEntity(Model): 'preserve_vnet': {'key': 'preserveVnet', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmSlotEntity, self).__init__(**kwargs) - self.target_slot = kwargs.get('target_slot', None) - self.preserve_vnet = kwargs.get('preserve_vnet', None) + self.target_slot = kwargs['target_slot'] + self.preserve_vnet = kwargs['preserve_vnet'] -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -3774,7 +4182,10 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = kwargs.get('unit', None) self.next_reset_time = kwargs.get('next_reset_time', None) @@ -3783,11 +4194,42 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class CustomHostnameAnalysisResult(ProxyOnlyResource): """Custom domain analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3797,25 +4239,25 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar is_hostname_already_verified: true if hostname is - already verified; otherwise, false. + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. - Possible values include: 'Passed', 'Failed', 'Skipped' + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.web.v2019_08_01.models.DnsVerificationTestResult - :ivar custom_domain_verification_failure_info: Raw failure information if - DNS verification fails. + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. :vartype custom_domain_verification_failure_info: ~azure.mgmt.web.v2019_08_01.models.ErrorEntity - :ivar has_conflict_on_scale_unit: true if there is a conflict - on a scale unit; otherwise, false. + :ivar has_conflict_on_scale_unit: :code:`true` if there is a conflict on a scale + unit; otherwise, :code:`false`. :vartype has_conflict_on_scale_unit: bool - :ivar has_conflict_across_subscription: true if there is a - conflict across subscriptions; otherwise, false. + :ivar has_conflict_across_subscription: :code:`true` if there is a conflict across + subscriptions; otherwise, :code:`false`. :vartype has_conflict_across_subscription: bool - :ivar conflicting_app_resource_id: Name of the conflicting app on scale - unit if it's within the same subscription. + :ivar conflicting_app_resource_id: Name of the conflicting app on scale unit if it's within the + same subscription. :vartype conflicting_app_resource_id: str :param c_name_records: CName records controller can see for this hostname. :type c_name_records: list[str] @@ -3823,11 +4265,9 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type txt_records: list[str] :param a_records: A records controller can see for this hostname. :type a_records: list[str] - :param alternate_cname_records: Alternate CName records controller can see - for this hostname. - :type alternate_cname_records: list[str] - :param alternate_txt_records: Alternate TXT records controller can see for - this hostname. + :param alternate_c_name_records: Alternate CName records controller can see for this hostname. + :type alternate_c_name_records: list[str] + :param alternate_txt_records: Alternate TXT records controller can see for this hostname. :type alternate_txt_records: list[str] """ @@ -3849,7 +4289,7 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'DnsVerificationTestResult'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'ErrorEntity'}, 'has_conflict_on_scale_unit': {'key': 'properties.hasConflictOnScaleUnit', 'type': 'bool'}, 'has_conflict_across_subscription': {'key': 'properties.hasConflictAcrossSubscription', 'type': 'bool'}, @@ -3857,11 +4297,14 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_cname_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomHostnameAnalysisResult, self).__init__(**kwargs) self.is_hostname_already_verified = None self.custom_domain_verification_test = None @@ -3872,28 +4315,27 @@ def __init__(self, **kwargs): self.c_name_records = kwargs.get('c_name_records', None) self.txt_records = kwargs.get('txt_records', None) self.a_records = kwargs.get('a_records', None) - self.alternate_cname_records = kwargs.get('alternate_cname_records', None) + self.alternate_c_name_records = kwargs.get('alternate_c_name_records', None) self.alternate_txt_records = kwargs.get('alternate_txt_records', None) -class DatabaseBackupSetting(Model): +class DatabaseBackupSetting(msrest.serialization.Model): """Database backup settings. All required parameters must be populated in order to send to Azure. - :param database_type: Required. Database type (e.g. SqlAzure / MySql). - Possible values include: 'SqlAzure', 'MySql', 'LocalMySql', 'PostgreSql' - :type database_type: str or - ~azure.mgmt.web.v2019_08_01.models.DatabaseType + :param database_type: Required. Database type (e.g. SqlAzure / MySql). Possible values include: + "SqlAzure", "MySql", "LocalMySql", "PostgreSql". + :type database_type: str or ~azure.mgmt.web.v2019_08_01.models.DatabaseType :param name: :type name: str - :param connection_string_name: Contains a connection string name that is - linked to the SiteConfig.ConnectionStrings. + :param connection_string_name: Contains a connection string name that is linked to the + SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. :type connection_string_name: str - :param connection_string: Contains a connection string to a database which - is being backed up or restored. If the restore should happen to a new - database, the database name inside is the new one. + :param connection_string: Contains a connection string to a database which is being backed up + or restored. If the restore should happen to a new database, the database name inside is the + new one. :type connection_string: str """ @@ -3908,22 +4350,24 @@ class DatabaseBackupSetting(Model): 'connection_string': {'key': 'connectionString', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DatabaseBackupSetting, self).__init__(**kwargs) - self.database_type = kwargs.get('database_type', None) + self.database_type = kwargs['database_type'] self.name = kwargs.get('name', None) self.connection_string_name = kwargs.get('connection_string_name', None) self.connection_string = kwargs.get('connection_string', None) -class DataSource(Model): +class DataSource(msrest.serialization.Model): """Class representing data source used by the detectors. - :param instructions: Instructions if any for the data source + :param instructions: Instructions if any for the data source. :type instructions: list[str] - :param data_source_uri: Datasource Uri Links - :type data_source_uri: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param data_source_uri: Datasource Uri Links. + :type data_source_uri: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] """ _attribute_map = { @@ -3931,20 +4375,23 @@ class DataSource(Model): 'data_source_uri': {'key': 'dataSourceUri', 'type': '[NameValuePair]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataSource, self).__init__(**kwargs) self.instructions = kwargs.get('instructions', None) self.data_source_uri = kwargs.get('data_source_uri', None) -class DataTableResponseColumn(Model): +class DataTableResponseColumn(msrest.serialization.Model): """Column definition. - :param column_name: Name of the column + :param column_name: Name of the column. :type column_name: str :param data_type: Data type which looks like 'String' or 'Int32'. :type data_type: str - :param column_type: Column Type + :param column_type: Column Type. :type column_type: str """ @@ -3954,22 +4401,24 @@ class DataTableResponseColumn(Model): 'column_type': {'key': 'columnType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataTableResponseColumn, self).__init__(**kwargs) self.column_name = kwargs.get('column_name', None) self.data_type = kwargs.get('data_type', None) self.column_type = kwargs.get('column_type', None) -class DataTableResponseObject(Model): +class DataTableResponseObject(msrest.serialization.Model): """Data Table which defines columns and raw row values. - :param table_name: Name of the table + :param table_name: Name of the table. :type table_name: str - :param columns: List of columns with data types - :type columns: - list[~azure.mgmt.web.v2019_08_01.models.DataTableResponseColumn] - :param rows: Raw row values + :param columns: List of columns with data types. + :type columns: list[~azure.mgmt.web.v2019_08_01.models.DataTableResponseColumn] + :param rows: Raw row values. :type rows: list[list[str]] """ @@ -3979,22 +4428,23 @@ class DataTableResponseObject(Model): 'rows': {'key': 'rows', 'type': '[[str]]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataTableResponseObject, self).__init__(**kwargs) self.table_name = kwargs.get('table_name', None) self.columns = kwargs.get('columns', None) self.rows = kwargs.get('rows', None) -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseError """ _validation = { @@ -4005,28 +4455,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -4035,8 +4475,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -4056,7 +4495,10 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -4065,11 +4507,10 @@ def __init__(self, **kwargs): self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -4091,7 +4532,10 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None @@ -4101,8 +4545,7 @@ def __init__(self, **kwargs): class DeletedAppRestoreRequest(ProxyOnlyResource): """Details about restoring a deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4113,17 +4556,16 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param deleted_site_id: ARM resource ID of the deleted app. Example: - /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}. :type deleted_site_id: str - :param recover_configuration: If true, deleted site configuration, in - addition to content, will be restored. + :param recover_configuration: If true, deleted site configuration, in addition to content, will + be restored. :type recover_configuration: bool - :param snapshot_time: Point in time to restore the deleted app from, - formatted as a DateTime string. + :param snapshot_time: Point in time to restore the deleted app from, formatted as a DateTime + string. If unspecified, default value is the time that the app was deleted. :type snapshot_time: str - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -4144,7 +4586,10 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedAppRestoreRequest, self).__init__(**kwargs) self.deleted_site_id = kwargs.get('deleted_site_id', None) self.recover_configuration = kwargs.get('recover_configuration', None) @@ -4155,8 +4600,7 @@ def __init__(self, **kwargs): class DeletedSite(ProxyOnlyResource): """A deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4166,21 +4610,21 @@ class DeletedSite(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deleted_site_id: Numeric id for the deleted site + :ivar deleted_site_id: Numeric id for the deleted site. :vartype deleted_site_id: int :ivar deleted_timestamp: Time in UTC when the app was deleted. :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site + :ivar subscription: Subscription containing the deleted site. :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site + :ivar resource_group: ResourceGroup that contained the deleted site. :vartype resource_group: str - :ivar deleted_site_name: Name of the deleted site + :ivar deleted_site_name: Name of the deleted site. :vartype deleted_site_name: str - :ivar slot: Slot of the deleted site + :ivar slot: Slot of the deleted site. :vartype slot: str - :ivar deleted_site_kind: Kind of site that was deleted - :vartype deleted_site_kind: str - :ivar geo_region_name: Geo Region of the deleted site + :ivar kind_properties_kind: Kind of site that was deleted. + :vartype kind_properties_kind: str + :ivar geo_region_name: Geo Region of the deleted site. :vartype geo_region_name: str """ @@ -4194,7 +4638,7 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'readonly': True}, 'deleted_site_name': {'readonly': True}, 'slot': {'readonly': True}, - 'deleted_site_kind': {'readonly': True}, + 'kind_properties_kind': {'readonly': True}, 'geo_region_name': {'readonly': True}, } @@ -4209,11 +4653,14 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, 'deleted_site_name': {'key': 'properties.deletedSiteName', 'type': 'str'}, 'slot': {'key': 'properties.slot', 'type': 'str'}, - 'deleted_site_kind': {'key': 'properties.kind', 'type': 'str'}, + 'kind_properties_kind': {'key': 'properties.kind', 'type': 'str'}, 'geo_region_name': {'key': 'properties.geoRegionName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSite, self).__init__(**kwargs) self.deleted_site_id = None self.deleted_timestamp = None @@ -4221,15 +4668,46 @@ def __init__(self, **kwargs): self.resource_group = None self.deleted_site_name = None self.slot = None - self.deleted_site_kind = None + self.kind_properties_kind = None self.geo_region_name = None +class DeletedWebAppCollection(msrest.serialization.Model): + """Collection of deleted apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DeletedSite] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedWebAppCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class Deployment(ProxyOnlyResource): """User credentials used for publishing activity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4250,11 +4728,11 @@ class Deployment(ProxyOnlyResource): :param author_email: Author email. :type author_email: str :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime - :param active: True if deployment is currently active, false if completed - and null if not started. + :type end_time: ~datetime.datetime + :param active: True if deployment is currently active, false if completed and null if not + started. :type active: bool :param details: Details on deployment. :type details: str @@ -4282,7 +4760,10 @@ class Deployment(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Deployment, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.message = kwargs.get('message', None) @@ -4295,18 +4776,49 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class DeploymentLocations(Model): +class DeploymentCollection(msrest.serialization.Model): + """Collection of app deployments. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Deployment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Deployment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DeploymentLocations(msrest.serialization.Model): """List of available locations (regions or App Service Environments) for - deployment of App Service resources. +deployment of App Service resources. :param locations: Available regions. :type locations: list[~azure.mgmt.web.v2019_08_01.models.GeoRegion] - :param hosting_environments: Available App Service Environments with full - descriptions of the environments. - :type hosting_environments: - list[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironment] - :param hosting_environment_deployment_infos: Available App Service - Environments with basic information. + :param hosting_environments: Available App Service Environments with full descriptions of the + environments. + :type hosting_environments: list[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironment] + :param hosting_environment_deployment_infos: Available App Service Environments with basic + information. :type hosting_environment_deployment_infos: list[~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDeploymentInfo] """ @@ -4317,34 +4829,36 @@ class DeploymentLocations(Model): 'hosting_environment_deployment_infos': {'key': 'hostingEnvironmentDeploymentInfos', 'type': '[HostingEnvironmentDeploymentInfo]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentLocations, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.hosting_environments = kwargs.get('hosting_environments', None) self.hosting_environment_deployment_infos = kwargs.get('hosting_environment_deployment_infos', None) -class DetectorAbnormalTimePeriod(Model): +class DetectorAbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period detected. - :param start_time: Start time of the correlated event - :type start_time: datetime - :param end_time: End time of the correlated event - :type end_time: datetime - :param message: Message describing the event + :param start_time: Start time of the correlated event. + :type start_time: ~datetime.datetime + :param end_time: End time of the correlated event. + :type end_time: ~datetime.datetime + :param message: Message describing the event. :type message: str - :param source: Represents the name of the Detector + :param source: Represents the name of the Detector. :type source: str - :param priority: Represents the rank of the Detector + :param priority: Represents the rank of the Detector. :type priority: float - :param meta_data: Downtime metadata - :type meta_data: - list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] - :param type: Represents the type of the Detector. Possible values include: - 'ServiceIncident', 'AppDeployment', 'AppCrash', 'RuntimeIssueDetected', - 'AseDeployment', 'UserIssue', 'PlatformIssue', 'Other' + :param meta_data: Downtime metadata. + :type meta_data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] + :param type: Represents the type of the Detector. Possible values include: "ServiceIncident", + "AppDeployment", "AppCrash", "RuntimeIssueDetected", "AseDeployment", "UserIssue", + "PlatformIssue", "Other". :type type: str or ~azure.mgmt.web.v2019_08_01.models.IssueType - :param solutions: List of proposed solutions + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2019_08_01.models.Solution] """ @@ -4355,11 +4869,14 @@ class DetectorAbnormalTimePeriod(Model): 'source': {'key': 'source', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'float'}, 'meta_data': {'key': 'metaData', 'type': '[[NameValuePair]]'}, - 'type': {'key': 'type', 'type': 'IssueType'}, + 'type': {'key': 'type', 'type': 'str'}, 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorAbnormalTimePeriod, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -4374,8 +4891,7 @@ def __init__(self, **kwargs): class DetectorDefinition(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4385,11 +4901,11 @@ class DetectorDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar display_name: Display name of the detector + :ivar display_name: Display name of the detector. :vartype display_name: str - :ivar description: Description of the detector + :ivar description: Description of the detector. :vartype description: str - :ivar rank: Detector Rank + :ivar rank: Detector Rank. :vartype rank: float :ivar is_enabled: Flag representing whether detector is enabled or not. :vartype is_enabled: bool @@ -4416,7 +4932,10 @@ class DetectorDefinition(ProxyOnlyResource): 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorDefinition, self).__init__(**kwargs) self.display_name = None self.description = None @@ -4424,19 +4943,18 @@ def __init__(self, **kwargs): self.is_enabled = None -class DetectorInfo(Model): +class DetectorInfo(msrest.serialization.Model): """Definition of Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Short description of the detector and its purpose + :ivar description: Short description of the detector and its purpose. :vartype description: str - :ivar category: Support Category + :ivar category: Support Category. :vartype category: str - :ivar sub_category: Support Sub Category + :ivar sub_category: Support Sub Category. :vartype sub_category: str - :ivar support_topic_id: Support Topic Id + :ivar support_topic_id: Support Topic Id. :vartype support_topic_id: str """ @@ -4454,7 +4972,10 @@ class DetectorInfo(Model): 'support_topic_id': {'key': 'supportTopicId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorInfo, self).__init__(**kwargs) self.description = None self.category = None @@ -4465,8 +4986,7 @@ def __init__(self, **kwargs): class DetectorResponse(ProxyOnlyResource): """Class representing Response from Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4476,9 +4996,9 @@ class DetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param metadata: metadata for the detector + :param metadata: metadata for the detector. :type metadata: ~azure.mgmt.web.v2019_08_01.models.DetectorInfo - :param dataset: Data Set + :param dataset: Data Set. :type dataset: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticData] """ @@ -4497,17 +5017,51 @@ class DetectorResponse(ProxyOnlyResource): 'dataset': {'key': 'properties.dataset', 'type': '[DiagnosticData]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DetectorResponse, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.dataset = kwargs.get('dataset', None) +class DetectorResponseCollection(msrest.serialization.Model): + """Collection of detector responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DetectorResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DetectorResponseCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticAnalysis(ProxyOnlyResource): """Class representing a diagnostic analysis done on an application. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4517,19 +5071,16 @@ class DiagnosticAnalysis(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param abnormal_time_periods: List of time periods. - :type abnormal_time_periods: - list[~azure.mgmt.web.v2019_08_01.models.AbnormalTimePeriod] - :param payload: Data by each detector + :type abnormal_time_periods: list[~azure.mgmt.web.v2019_08_01.models.AbnormalTimePeriod] + :param payload: Data by each detector. :type payload: list[~azure.mgmt.web.v2019_08_01.models.AnalysisData] - :param non_correlated_detectors: Data by each detector for detectors that - did not corelate - :type non_correlated_detectors: - list[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] + :param non_correlated_detectors: Data by each detector for detectors that did not corelate. + :type non_correlated_detectors: list[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] """ _validation = { @@ -4550,7 +5101,10 @@ class DiagnosticAnalysis(ProxyOnlyResource): 'non_correlated_detectors': {'key': 'properties.nonCorrelatedDetectors', 'type': '[DetectorDefinition]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticAnalysis, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -4559,11 +5113,42 @@ def __init__(self, **kwargs): self.non_correlated_detectors = kwargs.get('non_correlated_detectors', None) +class DiagnosticAnalysisCollection(msrest.serialization.Model): + """Collection of Diagnostic Analyses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticAnalysisCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticCategory(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4573,7 +5158,7 @@ class DiagnosticCategory(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the diagnostic category + :ivar description: Description of the diagnostic category. :vartype description: str """ @@ -4592,18 +5177,52 @@ class DiagnosticCategory(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): - super(DiagnosticCategory, self).__init__(**kwargs) - self.description = None + def __init__( + self, + **kwargs + ): + super(DiagnosticCategory, self).__init__(**kwargs) + self.description = None + + +class DiagnosticCategoryCollection(msrest.serialization.Model): + """Collection of Diagnostic Categories. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticCategory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticCategoryCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class DiagnosticData(Model): +class DiagnosticData(msrest.serialization.Model): """Set of data with rendering instructions. - :param table: Data in table form + :param table: Data in table form. :type table: ~azure.mgmt.web.v2019_08_01.models.DataTableResponseObject - :param rendering_properties: Properties that describe how the table should - be rendered + :param rendering_properties: Properties that describe how the table should be rendered. :type rendering_properties: ~azure.mgmt.web.v2019_08_01.models.Rendering """ @@ -4612,17 +5231,51 @@ class DiagnosticData(Model): 'rendering_properties': {'key': 'renderingProperties', 'type': 'Rendering'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticData, self).__init__(**kwargs) self.table = kwargs.get('table', None) self.rendering_properties = kwargs.get('rendering_properties', None) +class DiagnosticDetectorCollection(msrest.serialization.Model): + """Collection of Diagnostic Detectors. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticDetectorCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class DiagnosticDetectorResponse(ProxyOnlyResource): """Class representing Response from Diagnostic Detectors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4632,27 +5285,23 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param issue_detected: Flag representing Issue was detected. :type issue_detected: bool - :param detector_definition: Detector's definition - :type detector_definition: - ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition - :param metrics: Metrics provided by the detector - :type metrics: - list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] - :param abnormal_time_periods: List of Correlated events found by the - detector + :param detector_definition: Detector's definition. + :type detector_definition: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :param metrics: Metrics provided by the detector. + :type metrics: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] + :param abnormal_time_periods: List of Correlated events found by the detector. :type abnormal_time_periods: list[~azure.mgmt.web.v2019_08_01.models.DetectorAbnormalTimePeriod] :param data: Additional Data that detector wants to send. :type data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] - :param response_meta_data: Meta Data - :type response_meta_data: - ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData + :param response_meta_data: Meta Data. + :type response_meta_data: ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData """ _validation = { @@ -4676,7 +5325,10 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): 'response_meta_data': {'key': 'properties.responseMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticDetectorResponse, self).__init__(**kwargs) self.start_time = kwargs.get('start_time', None) self.end_time = kwargs.get('end_time', None) @@ -4688,28 +5340,24 @@ def __init__(self, **kwargs): self.response_meta_data = kwargs.get('response_meta_data', None) -class DiagnosticMetricSample(Model): +class DiagnosticMetricSample(msrest.serialization.Model): """Class representing Diagnostic Metric. - :param timestamp: Time at which metric is measured - :type timestamp: datetime - :param role_instance: Role Instance. Null if this counter is not per - instance - This is returned and should be whichever instance name we desire to be - returned + :param timestamp: Time at which metric is measured. + :type timestamp: ~datetime.datetime + :param role_instance: Role Instance. Null if this counter is not per instance + This is returned and should be whichever instance name we desire to be returned i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) - where RDWORKERNAME is Machine name below and RoleInstance name in - parenthesis + where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis. :type role_instance: str - :param total: Total value of the metric. If multiple measurements are made - this will have sum of all. + :param total: Total value of the metric. If multiple measurements are made this will have sum + of all. :type total: float - :param maximum: Maximum of the metric sampled during the time period + :param maximum: Maximum of the metric sampled during the time period. :type maximum: float - :param minimum: Minimum of the metric sampled during the time period + :param minimum: Minimum of the metric sampled during the time period. :type minimum: float - :param is_aggregated: Whether the values are aggregates across all workers - or not + :param is_aggregated: Whether the values are aggregates across all workers or not. :type is_aggregated: bool """ @@ -4722,7 +5370,10 @@ class DiagnosticMetricSample(Model): 'is_aggregated': {'key': 'isAggregated', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticMetricSample, self).__init__(**kwargs) self.timestamp = kwargs.get('timestamp', None) self.role_instance = kwargs.get('role_instance', None) @@ -4732,25 +5383,22 @@ def __init__(self, **kwargs): self.is_aggregated = kwargs.get('is_aggregated', None) -class DiagnosticMetricSet(Model): +class DiagnosticMetricSet(msrest.serialization.Model): """Class representing Diagnostic Metric information. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param unit: Metric's unit + :param unit: Metric's unit. :type unit: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime - :param time_grain: Presented time grain. Supported grains at the moment - are PT1M, PT1H, P1D + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime + :param time_grain: Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D. :type time_grain: str - :param values: Collection of metric values for the selected period based - on the - {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} - :type values: - list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSample] + :param values: Collection of metric values for the selected period based on the + {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain}. + :type values: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSample] """ _attribute_map = { @@ -4762,7 +5410,10 @@ class DiagnosticMetricSet(Model): 'values': {'key': 'values', 'type': '[DiagnosticMetricSample]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DiagnosticMetricSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.unit = kwargs.get('unit', None) @@ -4772,10 +5423,9 @@ def __init__(self, **kwargs): self.values = kwargs.get('values', None) -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -4794,7 +5444,10 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -4805,8 +5458,7 @@ def __init__(self, **kwargs): class Domain(Resource): """Information about a domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -4820,62 +5472,58 @@ class Domain(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2019_08_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2019_08_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2019_08_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2019_08_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2019_08_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2019_08_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.DomainPropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType :param auth_code: :type auth_code: str @@ -4886,10 +5534,6 @@ class Domain(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -4898,7 +5542,6 @@ class Domain(Resource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -4913,8 +5556,8 @@ class Domain(Resource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -4925,13 +5568,16 @@ class Domain(Resource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Domain, self).__init__(**kwargs) self.contact_admin = kwargs.get('contact_admin', None) self.contact_billing = kwargs.get('contact_billing', None) @@ -4955,46 +5601,79 @@ def __init__(self, **kwargs): self.auth_code = kwargs.get('auth_code', None) -class DomainAvailabilityCheckResult(Model): +class DomainAvailabilityCheckResult(msrest.serialization.Model): """Domain availability check result. :param name: Name of the domain. :type name: str - :param available: true if domain can be purchased using - CreateDomain API; otherwise, false. + :param available: :code:`true` if domain can be purchased using CreateDomain API; + otherwise, :code:`false`. :type available: bool - :param domain_type: Valid values are Regular domain: Azure will charge the - full price of domain registration, SoftDeleted: Purchasing this domain - will simply restore it and this operation will not cost anything. Possible - values include: 'Regular', 'SoftDeleted' + :param domain_type: Valid values are Regular domain: Azure will charge the full price of domain + registration, SoftDeleted: Purchasing this domain will simply restore it and this operation + will not cost anything. Possible values include: "Regular", "SoftDeleted". :type domain_type: str or ~azure.mgmt.web.v2019_08_01.models.DomainType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'available': {'key': 'available', 'type': 'bool'}, - 'domain_type': {'key': 'domainType', 'type': 'DomainType'}, + 'domain_type': {'key': 'domainType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainAvailabilityCheckResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available = kwargs.get('available', None) self.domain_type = kwargs.get('domain_type', None) -class DomainControlCenterSsoRequest(Model): +class DomainCollection(msrest.serialization.Model): + """Collection of domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Domain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DomainCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DomainControlCenterSsoRequest(msrest.serialization.Model): """Single sign-on request information for domain management. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar url: URL where the single sign-on request is to be made. :vartype url: str :ivar post_parameter_key: Post parameter key. :vartype post_parameter_key: str - :ivar post_parameter_value: Post parameter value. Client should use - 'application/x-www-form-urlencoded' encoding for this value. + :ivar post_parameter_value: Post parameter value. Client should use 'application/x-www-form- + urlencoded' encoding for this value. :vartype post_parameter_value: str """ @@ -5010,7 +5689,10 @@ class DomainControlCenterSsoRequest(Model): 'post_parameter_value': {'key': 'postParameterValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainControlCenterSsoRequest, self).__init__(**kwargs) self.url = None self.post_parameter_key = None @@ -5020,8 +5702,7 @@ def __init__(self, **kwargs): class DomainOwnershipIdentifier(ProxyOnlyResource): """Domain ownership Identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5049,19 +5730,51 @@ class DomainOwnershipIdentifier(ProxyOnlyResource): 'ownership_id': {'key': 'properties.ownershipId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainOwnershipIdentifier, self).__init__(**kwargs) self.ownership_id = kwargs.get('ownership_id', None) -class DomainPatchResource(ProxyOnlyResource): - """ARM resource for a domain. +class DomainOwnershipIdentifierCollection(msrest.serialization.Model): + """Collection of domain ownership identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DomainOwnershipIdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DomainPatchResource(ProxyOnlyResource): + """ARM resource for a domain. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -5070,60 +5783,56 @@ class DomainPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2019_08_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2019_08_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2019_08_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2019_08_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2019_08_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2019_08_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.DomainPatchResourcePropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType :param auth_code: :type auth_code: str @@ -5133,10 +5842,6 @@ class DomainPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -5145,7 +5850,6 @@ class DomainPatchResource(ProxyOnlyResource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -5158,8 +5862,8 @@ class DomainPatchResource(ProxyOnlyResource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -5170,13 +5874,16 @@ class DomainPatchResource(ProxyOnlyResource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainPatchResource, self).__init__(**kwargs) self.contact_admin = kwargs.get('contact_admin', None) self.contact_billing = kwargs.get('contact_billing', None) @@ -5200,18 +5907,16 @@ def __init__(self, **kwargs): self.auth_code = kwargs.get('auth_code', None) -class DomainPurchaseConsent(Model): - """Domain purchase consent object, representing acceptance of applicable legal - agreements. +class DomainPurchaseConsent(msrest.serialization.Model): + """Domain purchase consent object, representing acceptance of applicable legal agreements. - :param agreement_keys: List of applicable legal agreement keys. This list - can be retrieved using ListLegalAgreements API under - TopLevelDomain resource. + :param agreement_keys: List of applicable legal agreement keys. This list can be retrieved + using ListLegalAgreements API under :code:`TopLevelDomain` resource. :type agreement_keys: list[str] :param agreed_by: Client IP address. :type agreed_by: str :param agreed_at: Timestamp when the agreements were accepted. - :type agreed_at: datetime + :type agreed_at: ~datetime.datetime """ _attribute_map = { @@ -5220,18 +5925,20 @@ class DomainPurchaseConsent(Model): 'agreed_at': {'key': 'agreedAt', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainPurchaseConsent, self).__init__(**kwargs) self.agreement_keys = kwargs.get('agreement_keys', None) self.agreed_by = kwargs.get('agreed_by', None) self.agreed_at = kwargs.get('agreed_at', None) -class DomainRecommendationSearchParameters(Model): +class DomainRecommendationSearchParameters(msrest.serialization.Model): """Domain recommendation search parameters. - :param keywords: Keywords to be used for generating domain - recommendations. + :param keywords: Keywords to be used for generating domain recommendations. :type keywords: str :param max_domain_recommendations: Maximum number of recommendations. :type max_domain_recommendations: int @@ -5242,17 +5949,20 @@ class DomainRecommendationSearchParameters(Model): 'max_domain_recommendations': {'key': 'maxDomainRecommendations', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainRecommendationSearchParameters, self).__init__(**kwargs) self.keywords = kwargs.get('keywords', None) self.max_domain_recommendations = kwargs.get('max_domain_recommendations', None) -class EnabledConfig(Model): +class EnabledConfig(msrest.serialization.Model): """Enabled configuration. - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -5260,21 +5970,21 @@ class EnabledConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EnabledConfig, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) -class EndpointDependency(Model): - """A domain name that a service is reached at, including details of the - current connection status. +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at, including details of the current connection status. :param domain_name: The domain name of the dependency. :type domain_name: str - :param endpoint_details: The IP Addresses and Ports used when connecting - to DomainName. - :type endpoint_details: - list[~azure.mgmt.web.v2019_08_01.models.EndpointDetail] + :param endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :type endpoint_details: list[~azure.mgmt.web.v2019_08_01.models.EndpointDetail] """ _attribute_map = { @@ -5282,26 +5992,27 @@ class EndpointDependency(Model): 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EndpointDependency, self).__init__(**kwargs) self.domain_name = kwargs.get('domain_name', None) self.endpoint_details = kwargs.get('endpoint_details', None) -class EndpointDetail(Model): - """Current TCP connectivity information from the App Service Environment to a - single endpoint. +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the App Service Environment to a single endpoint. :param ip_address: An IP Address that Domain Name currently resolves to. :type ip_address: str :param port: The port an endpoint is connected to. :type port: int - :param latency: The time in milliseconds it takes for a TCP connection to - be created from the App Service Environment to this IpAddress at this - Port. + :param latency: The time in milliseconds it takes for a TCP connection to be created from the + App Service Environment to this IpAddress at this Port. :type latency: float - :param is_accessible: Whether it is possible to create a TCP connection - from the App Service Environment to this IpAddress at this Port. + :param is_accessible: Whether it is possible to create a TCP connection from the App Service + Environment to this IpAddress at this Port. :type is_accessible: bool """ @@ -5312,7 +6023,10 @@ class EndpointDetail(Model): 'is_accessible': {'key': 'isAccessible', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EndpointDetail, self).__init__(**kwargs) self.ip_address = kwargs.get('ip_address', None) self.port = kwargs.get('port', None) @@ -5320,7 +6034,7 @@ def __init__(self, **kwargs): self.is_accessible = kwargs.get('is_accessible', None) -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -5346,7 +6060,10 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = kwargs.get('extended_code', None) self.message_template = kwargs.get('message_template', None) @@ -5356,7 +6073,7 @@ def __init__(self, **kwargs): self.message = kwargs.get('message', None) -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -5367,33 +6084,38 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = kwargs.get('ramp_up_rules', None) -class FileSystemApplicationLogsConfig(Model): +class FileSystemApplicationLogsConfig(msrest.serialization.Model): """Application logs to file system configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error'. Default value: "Off" . + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2019_08_01.models.LogLevel """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FileSystemApplicationLogsConfig, self).__init__(**kwargs) - self.level = kwargs.get('level', "Off") + self.level = kwargs.get('level', None) -class FileSystemHttpLogsConfig(Model): +class FileSystemHttpLogsConfig(msrest.serialization.Model): """Http logs to file system configuration. - :param retention_in_mb: Maximum size in megabytes that http log files can - use. + :param retention_in_mb: Maximum size in megabytes that http log files can use. When reached old log files will be removed to make space for new ones. Value can range between 25 and 100. :type retention_in_mb: int @@ -5401,8 +6123,8 @@ class FileSystemHttpLogsConfig(Model): Remove files older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -5416,7 +6138,10 @@ class FileSystemHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FileSystemHttpLogsConfig, self).__init__(**kwargs) self.retention_in_mb = kwargs.get('retention_in_mb', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -5426,8 +6151,7 @@ def __init__(self, **kwargs): class FunctionEnvelope(ProxyOnlyResource): """Function information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5457,12 +6181,11 @@ class FunctionEnvelope(ProxyOnlyResource): :type files: dict[str, str] :param test_data: Test data used when testing via the Azure Portal. :type test_data: str - :param invoke_url_template: The invocation URL + :param invoke_url_template: The invocation URL. :type invoke_url_template: str - :param language: The function language + :param language: The function language. :type language: str - :param is_disabled: Gets or sets a value indicating whether the function - is disabled + :param is_disabled: Gets or sets a value indicating whether the function is disabled. :type is_disabled: bool """ @@ -5492,7 +6215,10 @@ class FunctionEnvelope(ProxyOnlyResource): 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FunctionEnvelope, self).__init__(**kwargs) self.function_app_id = kwargs.get('function_app_id', None) self.script_root_path_href = kwargs.get('script_root_path_href', None) @@ -5509,11 +6235,42 @@ def __init__(self, **kwargs): self.is_disabled = kwargs.get('is_disabled', None) +class FunctionEnvelopeCollection(msrest.serialization.Model): + """Collection of Kudu function information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FunctionEnvelopeCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class FunctionSecrets(ProxyOnlyResource): """Function secrets. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5544,7 +6301,10 @@ class FunctionSecrets(ProxyOnlyResource): 'trigger_url': {'key': 'properties.trigger_url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FunctionSecrets, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.trigger_url = kwargs.get('trigger_url', None) @@ -5553,8 +6313,7 @@ def __init__(self, **kwargs): class GeoRegion(ProxyOnlyResource): """Geographical region. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5591,14 +6350,49 @@ class GeoRegion(ProxyOnlyResource): 'org_domain': {'key': 'properties.orgDomain', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GeoRegion, self).__init__(**kwargs) self.description = None self.display_name = None self.org_domain = None -class GlobalCsmSkuDescription(Model): +class GeoRegionCollection(msrest.serialization.Model): + """Collection of geographical regions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.GeoRegion] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GeoRegion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoRegionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class GlobalCsmSkuDescription(msrest.serialization.Model): """A Global SKU Description. :param name: Name of the resource SKU. @@ -5613,8 +6407,7 @@ class GlobalCsmSkuDescription(Model): :type capacity: ~azure.mgmt.web.v2019_08_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2019_08_01.models.Capability] """ @@ -5628,7 +6421,10 @@ class GlobalCsmSkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GlobalCsmSkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -5639,19 +6435,16 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -5661,14 +6454,17 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = kwargs.get('extension', None) self.script_processor = kwargs.get('script_processor', None) self.arguments = kwargs.get('arguments', None) -class HostingEnvironmentDeploymentInfo(Model): +class HostingEnvironmentDeploymentInfo(msrest.serialization.Model): """Information needed to create resources on an App Service Environment. :param name: Name of the App Service Environment. @@ -5682,13 +6478,16 @@ class HostingEnvironmentDeploymentInfo(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentDeploymentInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.location = kwargs.get('location', None) -class HostingEnvironmentDiagnostics(Model): +class HostingEnvironmentDiagnostics(msrest.serialization.Model): """Diagnostics for an App Service Environment. :param name: Name/identifier of the diagnostics. @@ -5702,17 +6501,19 @@ class HostingEnvironmentDiagnostics(Model): 'diagnostics_output': {'key': 'diagnosticsOutput', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentDiagnostics, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.diagnostics_output = kwargs.get('diagnostics_output', None) -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -5733,14 +6534,17 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None self.type = None -class HostKeys(Model): +class HostKeys(msrest.serialization.Model): """Functions host level keys. :param master_key: Secret key. @@ -5757,50 +6561,52 @@ class HostKeys(Model): 'system_keys': {'key': 'systemKeys', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostKeys, self).__init__(**kwargs) self.master_key = kwargs.get('master_key', None) self.function_keys = kwargs.get('function_keys', None) self.system_keys = kwargs.get('system_keys', None) -class HostName(Model): +class HostName(msrest.serialization.Model): """Details of a hostname derived from a domain. :param name: Name of the hostname. :type name: str - :param site_names: List of apps the hostname is assigned to. This list - will have more than one app only if the hostname is pointing to a Traffic - Manager. + :param site_names: List of apps the hostname is assigned to. This list will have more than one + app only if the hostname is pointing to a Traffic Manager. :type site_names: list[str] - :param azure_resource_name: Name of the Azure resource the hostname is - assigned to. If it is assigned to a Traffic Manager then it will be the - Traffic Manager name otherwise it will be the app name. + :param azure_resource_name: Name of the Azure resource the hostname is assigned to. If it is + assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the + app name. :type azure_resource_name: str - :param azure_resource_type: Type of the Azure resource the hostname is - assigned to. Possible values include: 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2019_08_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Type of the DNS record. Possible - values include: 'CName', 'A' + :param azure_resource_type: Type of the Azure resource the hostname is assigned to. Possible + values include: "Website", "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2019_08_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Type of the DNS record. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2019_08_01.models.CustomHostNameDnsRecordType - :param host_name_type: Type of the hostname. Possible values include: - 'Verified', 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2019_08_01.models.HostNameType + :param host_name_type: Type of the hostname. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2019_08_01.models.HostNameType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'site_names': {'key': 'siteNames', 'type': '[str]'}, 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'hostNameType', 'type': 'HostNameType'}, + 'azure_resource_type': {'key': 'azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'hostNameType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostName, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.site_names = kwargs.get('site_names', None) @@ -5813,8 +6619,7 @@ def __init__(self, **kwargs): class HostNameBinding(ProxyOnlyResource): """A hostname binding object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5830,25 +6635,21 @@ class HostNameBinding(ProxyOnlyResource): :type domain_id: str :param azure_resource_name: Azure resource name. :type azure_resource_name: str - :param azure_resource_type: Azure resource type. Possible values include: - 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2019_08_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Custom DNS record type. Possible - values include: 'CName', 'A' + :param azure_resource_type: Azure resource type. Possible values include: "Website", + "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2019_08_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Custom DNS record type. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2019_08_01.models.CustomHostNameDnsRecordType - :param host_name_type: Hostname type. Possible values include: 'Verified', - 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2019_08_01.models.HostNameType - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param host_name_type: Hostname type. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2019_08_01.models.HostNameType + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2019_08_01.models.SslState - :param thumbprint: SSL certificate thumbprint + :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :vartype virtual_ip: str """ @@ -5867,15 +6668,18 @@ class HostNameBinding(ProxyOnlyResource): 'site_name': {'key': 'properties.siteName', 'type': 'str'}, 'domain_id': {'key': 'properties.domainId', 'type': 'str'}, 'azure_resource_name': {'key': 'properties.azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'properties.hostNameType', 'type': 'HostNameType'}, - 'ssl_state': {'key': 'properties.sslState', 'type': 'SslState'}, + 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'properties.hostNameType', 'type': 'str'}, + 'ssl_state': {'key': 'properties.sslState', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'virtual_ip': {'key': 'properties.virtualIP', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameBinding, self).__init__(**kwargs) self.site_name = kwargs.get('site_name', None) self.domain_id = kwargs.get('domain_id', None) @@ -5888,36 +6692,70 @@ def __init__(self, **kwargs): self.virtual_ip = None -class HostNameSslState(Model): +class HostNameBindingCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.HostNameBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostNameBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostNameBindingCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2019_08_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2019_08_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.ssl_state = kwargs.get('ssl_state', None) @@ -5927,15 +6765,13 @@ def __init__(self, **kwargs): self.host_type = kwargs.get('host_type', None) -class HttpLogsConfig(Model): +class HttpLogsConfig(msrest.serialization.Model): """Http logs configuration. :param file_system: Http logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2019_08_01.models.FileSystemHttpLogsConfig + :type file_system: ~azure.mgmt.web.v2019_08_01.models.FileSystemHttpLogsConfig :param azure_blob_storage: Http logs to azure blob storage configuration. - :type azure_blob_storage: - ~azure.mgmt.web.v2019_08_01.models.AzureBlobStorageHttpLogsConfig + :type azure_blob_storage: ~azure.mgmt.web.v2019_08_01.models.AzureBlobStorageHttpLogsConfig """ _attribute_map = { @@ -5943,7 +6779,10 @@ class HttpLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageHttpLogsConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HttpLogsConfig, self).__init__(**kwargs) self.file_system = kwargs.get('file_system', None) self.azure_blob_storage = kwargs.get('azure_blob_storage', None) @@ -5952,8 +6791,7 @@ def __init__(self, **kwargs): class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5973,15 +6811,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -6006,7 +6844,10 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnection, self).__init__(**kwargs) self.service_bus_namespace = kwargs.get('service_bus_namespace', None) self.relay_name = kwargs.get('relay_name', None) @@ -6018,12 +6859,42 @@ def __init__(self, **kwargs): self.service_bus_suffix = kwargs.get('service_bus_suffix', None) +class HybridConnectionCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.HybridConnection] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HybridConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HybridConnectionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6056,18 +6927,19 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionKey, self).__init__(**kwargs) self.send_key_name = None self.send_key_value = None class HybridConnectionLimits(ProxyOnlyResource): - """Hybrid Connection limits contract. This is used to return the plan limits - of Hybrid Connections. + """Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6100,7 +6972,10 @@ class HybridConnectionLimits(ProxyOnlyResource): 'maximum': {'key': 'properties.maximum', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionLimits, self).__init__(**kwargs) self.current = None self.maximum = None @@ -6109,8 +6984,7 @@ def __init__(self, **kwargs): class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6138,23 +7012,54 @@ class Identifier(ProxyOnlyResource): 'value': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Identifier, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class InboundEnvironmentEndpoint(Model): - """The IP Addresses and Ports that require inbound network access to and - within the subnet of the App Service Environment. +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class InboundEnvironmentEndpoint(msrest.serialization.Model): + """The IP Addresses and Ports that require inbound network access to and within the subnet of the App Service Environment. - :param description: Short text describing the purpose of the network - traffic. + :param description: Short text describing the purpose of the network traffic. :type description: str - :param endpoints: The IP addresses that network traffic will originate - from in cidr notation. + :param endpoints: The IP addresses that network traffic will originate from in cidr notation. :type endpoints: list[str] - :param ports: The ports that network traffic will arrive to the App - Service Environment at. + :param ports: The ports that network traffic will arrive to the App Service Environment at. :type ports: list[str] """ @@ -6164,14 +7069,49 @@ class InboundEnvironmentEndpoint(Model): 'ports': {'key': 'ports', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(InboundEnvironmentEndpoint, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.endpoints = kwargs.get('endpoints', None) self.ports = kwargs.get('ports', None) -class IpSecurityRestriction(Model): +class InboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Inbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.InboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. :param ip_address: IP address the security restriction is valid for. @@ -6179,20 +7119,18 @@ class IpSecurityRestriction(Model): CIDR notation such as ipv4/mask (leading bit match). For CIDR, SubnetMask property must not be specified. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str - :param vnet_subnet_resource_id: Virtual network resource id + :param vnet_subnet_resource_id: Virtual network resource id. :type vnet_subnet_resource_id: str - :param vnet_traffic_tag: (internal) Vnet traffic tag + :param vnet_traffic_tag: (internal) Vnet traffic tag. :type vnet_traffic_tag: int - :param subnet_traffic_tag: (internal) Subnet traffic tag + :param subnet_traffic_tag: (internal) Subnet traffic tag. :type subnet_traffic_tag: int :param action: Allow or Deny access for this IP range. :type action: str - :param tag: Defines what this IP filter will be used for. This is to - support IP filtering on proxies. Possible values include: 'Default', - 'XffProxy' + :param tag: Defines what this IP filter will be used for. This is to support IP filtering on + proxies. Possible values include: "Default", "XffProxy". :type tag: str or ~azure.mgmt.web.v2019_08_01.models.IpFilterTag :param priority: Priority of IP restriction rule. :type priority: int @@ -6209,13 +7147,16 @@ class IpSecurityRestriction(Model): 'vnet_traffic_tag': {'key': 'vnetTrafficTag', 'type': 'int'}, 'subnet_traffic_tag': {'key': 'subnetTrafficTag', 'type': 'int'}, 'action': {'key': 'action', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'IpFilterTag'}, + 'tag': {'key': 'tag', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = kwargs.get('ip_address', None) self.subnet_mask = kwargs.get('subnet_mask', None) @@ -6229,12 +7170,12 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class KeyInfo(Model): +class KeyInfo(msrest.serialization.Model): """Function key info. - :param name: Key name + :param name: Key name. :type name: str - :param value: Key value + :param value: Key value. :type value: str """ @@ -6243,7 +7184,10 @@ class KeyInfo(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -6252,8 +7196,7 @@ def __init__(self, **kwargs): class KeyVaultReferenceCollection(ProxyOnlyResource): """Web app key vault reference and status ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6263,9 +7206,8 @@ class KeyVaultReferenceCollection(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param key_to_reference_statuses: - :type key_to_reference_statuses: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ApiKVReference] + :param key_to_reference_statuses: Dictionary of :code:``. + :type key_to_reference_statuses: dict[str, ~azure.mgmt.web.v2019_08_01.models.ApiKVReference] """ _validation = { @@ -6282,7 +7224,10 @@ class KeyVaultReferenceCollection(ProxyOnlyResource): 'key_to_reference_statuses': {'key': 'properties.keyToReferenceStatuses', 'type': '{ApiKVReference}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVaultReferenceCollection, self).__init__(**kwargs) self.key_to_reference_statuses = kwargs.get('key_to_reference_statuses', None) @@ -6290,8 +7235,7 @@ def __init__(self, **kwargs): class KeyVaultReferenceResource(ProxyOnlyResource): """Web app key vault reference and status ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6303,9 +7247,9 @@ class KeyVaultReferenceResource(ProxyOnlyResource): :vartype type: str :param reference: :type reference: str - :param status: Possible values include: 'Initialized', 'Resolved', - 'InvalidSyntax', 'MSINotEnabled', 'VaultNotFound', 'SecretNotFound', - 'SecretVersionNotFound', 'AccessToKeyVaultDenied', 'OtherReasons' + :param status: Possible values include: "Initialized", "Resolved", "InvalidSyntax", + "MSINotEnabled", "VaultNotFound", "SecretNotFound", "SecretVersionNotFound", + "AccessToKeyVaultDenied", "OtherReasons". :type status: str or ~azure.mgmt.web.v2019_08_01.models.ResolveStatus :param vault_name: :type vault_name: str @@ -6313,24 +7257,23 @@ class KeyVaultReferenceResource(ProxyOnlyResource): :type secret_name: str :param secret_version: :type secret_version: str - :param identity_type: Possible values include: 'None', 'SystemAssigned', - 'UserAssigned' - :type identity_type: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType + :param identity_type: Type of managed service identity. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type identity_type: str or ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType :param details: :type details: str - :param source: Possible values include: 'KeyVault' - :type source: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceSource - :param location: Possible values include: 'ApplicationSetting' - :type location: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceLocation + :ivar source: Default value: "KeyVault". + :vartype source: str + :ivar location: Default value: "ApplicationSetting". + :vartype location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'source': {'constant': True}, + 'location': {'constant': True}, } _attribute_map = { @@ -6339,17 +7282,23 @@ class KeyVaultReferenceResource(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'reference': {'key': 'properties.reference', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ResolveStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vault_name': {'key': 'properties.vaultName', 'type': 'str'}, 'secret_name': {'key': 'properties.secretName', 'type': 'str'}, 'secret_version': {'key': 'properties.secretVersion', 'type': 'str'}, - 'identity_type': {'key': 'properties.identityType', 'type': 'ManagedServiceIdentityType'}, + 'identity_type': {'key': 'properties.identityType', 'type': 'str'}, 'details': {'key': 'properties.details', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'ConfigReferenceSource'}, - 'location': {'key': 'properties.location', 'type': 'ConfigReferenceLocation'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'location': {'key': 'properties.location', 'type': 'str'}, } - def __init__(self, **kwargs): + source = "KeyVault" + location = "ApplicationSetting" + + def __init__( + self, + **kwargs + ): super(KeyVaultReferenceResource, self).__init__(**kwargs) self.reference = kwargs.get('reference', None) self.status = kwargs.get('status', None) @@ -6358,11 +7307,9 @@ def __init__(self, **kwargs): self.secret_version = kwargs.get('secret_version', None) self.identity_type = kwargs.get('identity_type', None) self.details = kwargs.get('details', None) - self.source = kwargs.get('source', None) - self.location = kwargs.get('location', None) -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -6376,13 +7323,16 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log Definition of a single resource metric. :param name: @@ -6399,33 +7349,33 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. :vartype principal_id: str - :param user_assigned_identities: The list of user assigned identities - associated with the resource. The user identity dictionary key references - will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + :param user_assigned_identities: The list of user assigned identities associated with the + resource. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. :type user_assigned_identities: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + ~azure.mgmt.web.v2019_08_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -6434,13 +7384,16 @@ class ManagedServiceIdentity(Model): } _attribute_map = { - 'type': {'key': 'type', 'type': 'ManagedServiceIdentityType'}, + 'type': {'key': 'type', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.tenant_id = None @@ -6448,35 +7401,7 @@ def __init__(self, **kwargs): self.user_assigned_identities = kwargs.get('user_assigned_identities', None) -class ManagedServiceIdentityUserAssignedIdentitiesValue(Model): - """ManagedServiceIdentityUserAssignedIdentitiesValue. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar principal_id: Principal Id of user assigned identity - :vartype principal_id: str - :ivar client_id: Client Id of user assigned 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(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -6490,13 +7415,16 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = kwargs.get('time_grain', None) self.blob_duration = kwargs.get('blob_duration', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -6528,8 +7456,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2019_08_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2019_08_01.models.MetricAvailability] :param supported_time_grain_types: :type supported_time_grain_types: list[str] """ @@ -6553,7 +7480,10 @@ class MetricSpecification(Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -6576,10 +7506,7 @@ def __init__(self, **kwargs): class MigrateMySqlRequest(ProxyOnlyResource): """MySQL migration request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6589,21 +7516,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param connection_string: Required. Connection string to the remote MySQL - database. + :param connection_string: Connection string to the remote MySQL database. :type connection_string: str - :param migration_type: Required. The type of migration operation to be - done. Possible values include: 'LocalToRemote', 'RemoteToLocal' - :type migration_type: str or - ~azure.mgmt.web.v2019_08_01.models.MySqlMigrationType + :param migration_type: The type of migration operation to be done. Possible values include: + "LocalToRemote", "RemoteToLocal". + :type migration_type: str or ~azure.mgmt.web.v2019_08_01.models.MySqlMigrationType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'connection_string': {'required': True}, - 'migration_type': {'required': True}, } _attribute_map = { @@ -6612,10 +7535,13 @@ class MigrateMySqlRequest(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'migration_type': {'key': 'properties.migrationType', 'type': 'MySqlMigrationType'}, + 'migration_type': {'key': 'properties.migrationType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MigrateMySqlRequest, self).__init__(**kwargs) self.connection_string = kwargs.get('connection_string', None) self.migration_type = kwargs.get('migration_type', None) @@ -6624,8 +7550,7 @@ def __init__(self, **kwargs): class MigrateMySqlStatus(ProxyOnlyResource): """MySQL migration status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6635,13 +7560,12 @@ class MigrateMySqlStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar migration_operation_status: Status of the migration task. Possible - values include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' - :vartype migration_operation_status: str or - ~azure.mgmt.web.v2019_08_01.models.OperationStatus + :ivar migration_operation_status: Status of the migration task. Possible values include: + "InProgress", "Failed", "Succeeded", "TimedOut", "Created". + :vartype migration_operation_status: str or ~azure.mgmt.web.v2019_08_01.models.OperationStatus :ivar operation_id: Operation ID for the migration task. :vartype operation_id: str - :ivar local_my_sql_enabled: True if the web app has in app MySql enabled + :ivar local_my_sql_enabled: True if the web app has in app MySql enabled. :vartype local_my_sql_enabled: bool """ @@ -6659,12 +7583,15 @@ class MigrateMySqlStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'OperationStatus'}, + 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'str'}, 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, 'local_my_sql_enabled': {'key': 'properties.localMySqlEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MigrateMySqlStatus, self).__init__(**kwargs) self.migration_operation_status = None self.operation_id = None @@ -6674,8 +7601,7 @@ def __init__(self, **kwargs): class MSDeploy(ProxyOnlyResource): """MSDeploy ARM PUT information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6685,29 +7611,24 @@ class MSDeploy(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param package_uri: Package URI + :param package_uri: Package URI. :type package_uri: str - :param connection_string: SQL Connection String + :param connection_string: SQL Connection String. :type connection_string: str - :param db_type: Database Type + :param db_type: Database Type. :type db_type: str - :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must - not be set if SetParameters is used. + :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must not be set if + SetParameters is used. :type set_parameters_xml_file_uri: str - :param set_parameters: MSDeploy Parameters. Must not be set if - SetParametersXmlFileUri is used. + :param set_parameters: MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. :type set_parameters: dict[str, str] - :param skip_app_data: Controls whether the MSDeploy operation skips the - App_Data directory. - If set to true, the existing App_Data directory on the - destination - will not be deleted, and any App_Data directory in the source will be - ignored. - Setting is false by default. + :param skip_app_data: Controls whether the MSDeploy operation skips the App_Data directory. + If set to :code:`true`, the existing App_Data directory on the destination + will not be deleted, and any App_Data directory in the source will be ignored. + Setting is :code:`false` by default. :type skip_app_data: bool - :param app_offline: Sets the AppOffline rule while the MSDeploy operation - executes. - Setting is false by default. + :param app_offline: Sets the AppOffline rule while the MSDeploy operation executes. + Setting is :code:`false` by default. :type app_offline: bool """ @@ -6731,7 +7652,10 @@ class MSDeploy(ProxyOnlyResource): 'app_offline': {'key': 'properties.appOffline', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeploy, self).__init__(**kwargs) self.package_uri = kwargs.get('package_uri', None) self.connection_string = kwargs.get('connection_string', None) @@ -6745,8 +7669,7 @@ def __init__(self, **kwargs): class MSDeployLog(ProxyOnlyResource): """MSDeploy log. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6756,9 +7679,8 @@ class MSDeployLog(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar entries: List of log entry messages - :vartype entries: - list[~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntry] + :ivar entries: List of log entry messages. + :vartype entries: list[~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntry] """ _validation = { @@ -6776,24 +7698,24 @@ class MSDeployLog(ProxyOnlyResource): 'entries': {'key': 'properties.entries', 'type': '[MSDeployLogEntry]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployLog, self).__init__(**kwargs) self.entries = None -class MSDeployLogEntry(Model): +class MSDeployLogEntry(msrest.serialization.Model): """MSDeploy log entry. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar time: Timestamp of log entry - :vartype time: datetime - :ivar type: Log entry type. Possible values include: 'Message', 'Warning', - 'Error' - :vartype type: str or - ~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntryType - :ivar message: Log entry message + :ivar time: Timestamp of log entry. + :vartype time: ~datetime.datetime + :ivar type: Log entry type. Possible values include: "Message", "Warning", "Error". + :vartype type: str or ~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntryType + :ivar message: Log entry message. :vartype message: str """ @@ -6805,11 +7727,14 @@ class MSDeployLogEntry(Model): _attribute_map = { 'time': {'key': 'time', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'MSDeployLogEntryType'}, + 'type': {'key': 'type', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployLogEntry, self).__init__(**kwargs) self.time = None self.type = None @@ -6819,8 +7744,7 @@ def __init__(self, **kwargs): class MSDeployStatus(ProxyOnlyResource): """MSDeploy ARM response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6830,17 +7754,17 @@ class MSDeployStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deployer: Username of deployer + :ivar deployer: Username of deployer. :vartype deployer: str - :ivar provisioning_state: Provisioning state. Possible values include: - 'accepted', 'running', 'succeeded', 'failed', 'canceled' + :ivar provisioning_state: Provisioning state. Possible values include: "accepted", "running", + "succeeded", "failed", "canceled". :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.MSDeployProvisioningState - :ivar start_time: Start time of deploy operation - :vartype start_time: datetime - :ivar end_time: End time of deploy operation - :vartype end_time: datetime - :ivar complete: Whether the deployment operation has completed + :ivar start_time: Start time of deploy operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of deploy operation. + :vartype end_time: ~datetime.datetime + :ivar complete: Whether the deployment operation has completed. :vartype complete: bool """ @@ -6861,13 +7785,16 @@ class MSDeployStatus(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'deployer': {'key': 'properties.deployer', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'MSDeployProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'complete': {'key': 'properties.complete', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MSDeployStatus, self).__init__(**kwargs) self.deployer = None self.provisioning_state = None @@ -6876,7 +7803,7 @@ def __init__(self, **kwargs): self.complete = None -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -6884,15 +7811,50 @@ class NameIdentifier(Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameIdentifier, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class NameIdentifierCollection(msrest.serialization.Model): + """Collection of domain name identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.NameIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NameIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(NameIdentifier, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + def __init__( + self, + **kwargs + ): + super(NameIdentifierCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class NameValuePair(Model): +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -6906,18 +7868,20 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2019_08_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2019_08_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -6927,13 +7891,16 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = kwargs.get('action', None) self.description = kwargs.get('description', None) @@ -6942,11 +7909,9 @@ def __init__(self, **kwargs): class NetworkFeatures(ProxyOnlyResource): - """Full view of network features for an app (presently VNET integration and - Hybrid Connections). + """Full view of network features for an app (presently VNET integration and Hybrid Connections). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6959,14 +7924,12 @@ class NetworkFeatures(ProxyOnlyResource): :ivar virtual_network_name: The Virtual Network name. :vartype virtual_network_name: str :ivar virtual_network_connection: The Virtual Network summary view. - :vartype virtual_network_connection: - ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :vartype virtual_network_connection: ~azure.mgmt.web.v2019_08_01.models.VnetInfo :ivar hybrid_connections: The Hybrid Connections summary view. :vartype hybrid_connections: list[~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity] :ivar hybrid_connections_v2: The Hybrid Connection V2 (Service Bus) view. - :vartype hybrid_connections_v2: - list[~azure.mgmt.web.v2019_08_01.models.HybridConnection] + :vartype hybrid_connections_v2: list[~azure.mgmt.web.v2019_08_01.models.HybridConnection] """ _validation = { @@ -6990,7 +7953,10 @@ class NetworkFeatures(ProxyOnlyResource): 'hybrid_connections_v2': {'key': 'properties.hybridConnectionsV2', 'type': '[HybridConnection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkFeatures, self).__init__(**kwargs) self.virtual_network_name = None self.virtual_network_connection = None @@ -6998,16 +7964,16 @@ def __init__(self, **kwargs): self.hybrid_connections_v2 = None -class NetworkTrace(Model): +class NetworkTrace(msrest.serialization.Model): """Network trace. :param path: Local file path for the captured network trace file. :type path: str - :param status: Current status of the network trace operation, same as - Operation.Status (InProgress/Succeeded/Failed). + :param status: Current status of the network trace operation, same as Operation.Status + (InProgress/Succeeded/Failed). :type status: str - :param message: Detailed message of a network trace operation, e.g. error - message in case of failure. + :param message: Detailed message of a network trace operation, e.g. error message in case of + failure. :type message: str """ @@ -7017,31 +7983,34 @@ class NetworkTrace(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkTrace, self).__init__(**kwargs) self.path = kwargs.get('path', None) self.status = kwargs.get('status', None) self.message = kwargs.get('message', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2019_08_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2019_08_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -7049,7 +8018,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -7057,7 +8026,10 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -7069,18 +8041,14 @@ def __init__(self, **kwargs): self.geo_master_operation_id = kwargs.get('geo_master_operation_id', None) -class OutboundEnvironmentEndpoint(Model): - """Endpoints accessed for a common purpose that the App Service Environment - requires outbound network access to. +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the App Service Environment requires outbound network access to. - :param category: The type of service accessed by the App Service - Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active - Directory. + :param category: The type of service accessed by the App Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. :type category: str - :param endpoints: The endpoints that the App Service Environment reaches - the service at. - :type endpoints: - list[~azure.mgmt.web.v2019_08_01.models.EndpointDependency] + :param endpoints: The endpoints that the App Service Environment reaches the service at. + :type endpoints: list[~azure.mgmt.web.v2019_08_01.models.EndpointDependency] """ _attribute_map = { @@ -7088,13 +8056,80 @@ class OutboundEnvironmentEndpoint(Model): 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) self.category = kwargs.get('category', None) self.endpoints = kwargs.get('endpoints', None) -class PerfMonResponse(Model): +class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PerfMonCounterCollection(msrest.serialization.Model): + """Collection of performance monitor counters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.PerfMonResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PerfMonResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PerfMonCounterCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PerfMonResponse(msrest.serialization.Model): """Performance monitor API response. :param code: The response code. @@ -7111,18 +8146,21 @@ class PerfMonResponse(Model): 'data': {'key': 'data', 'type': 'PerfMonSet'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) self.data = kwargs.get('data', None) -class PerfMonSample(Model): +class PerfMonSample(msrest.serialization.Model): """Performance monitor sample in a set. :param time: Point in time for which counter was measured. - :type time: datetime + :type time: ~datetime.datetime :param instance_name: Name of the server on which the measurement is made. :type instance_name: str :param value: Value of counter at a certain time. @@ -7135,22 +8173,25 @@ class PerfMonSample(Model): 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonSample, self).__init__(**kwargs) self.time = kwargs.get('time', None) self.instance_name = kwargs.get('instance_name', None) self.value = kwargs.get('value', None) -class PerfMonSet(Model): +class PerfMonSet(msrest.serialization.Model): """Metric information. :param name: Unique key name of the counter. :type name: str :param start_time: Start time of the period. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time of the period. - :type end_time: datetime + :type end_time: ~datetime.datetime :param time_grain: Presented time grain. :type time_grain: str :param values: Collection of workers that are active during this time. @@ -7165,7 +8206,10 @@ class PerfMonSet(Model): 'values': {'key': 'values', 'type': '[PerfMonSample]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PerfMonSet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.start_time = kwargs.get('start_time', None) @@ -7177,8 +8221,7 @@ def __init__(self, **kwargs): class PremierAddOn(Resource): """Premier add-on. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -7192,7 +8235,7 @@ class PremierAddOn(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Premier add on SKU. :type sku: str @@ -7227,7 +8270,10 @@ class PremierAddOn(Resource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOn, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) @@ -7239,8 +8285,7 @@ def __init__(self, **kwargs): class PremierAddOnOffer(ProxyOnlyResource): """Premier add-on offer. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7256,14 +8301,13 @@ class PremierAddOnOffer(ProxyOnlyResource): :type product: str :param vendor: Premier add on offer Vendor. :type vendor: str - :param promo_code_required: true if promotion code is - required; otherwise, false. + :param promo_code_required: :code:`true` if promotion code is required; otherwise, + :code:`false`. :type promo_code_required: bool :param quota: Premier add on offer Quota. :type quota: int - :param web_hosting_plan_restrictions: App Service plans this offer is - restricted to. Possible values include: 'None', 'Free', 'Shared', 'Basic', - 'Standard', 'Premium' + :param web_hosting_plan_restrictions: App Service plans this offer is restricted to. Possible + values include: "None", "Free", "Shared", "Basic", "Standard", "Premium". :type web_hosting_plan_restrictions: str or ~azure.mgmt.web.v2019_08_01.models.AppServicePlanRestrictions :param privacy_policy_url: Privacy policy URL. @@ -7292,14 +8336,17 @@ class PremierAddOnOffer(ProxyOnlyResource): 'vendor': {'key': 'properties.vendor', 'type': 'str'}, 'promo_code_required': {'key': 'properties.promoCodeRequired', 'type': 'bool'}, 'quota': {'key': 'properties.quota', 'type': 'int'}, - 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'AppServicePlanRestrictions'}, + 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'str'}, 'privacy_policy_url': {'key': 'properties.privacyPolicyUrl', 'type': 'str'}, 'legal_terms_url': {'key': 'properties.legalTermsUrl', 'type': 'str'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOnOffer, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) @@ -7313,11 +8360,42 @@ def __init__(self, **kwargs): self.marketplace_offer = kwargs.get('marketplace_offer', None) +class PremierAddOnOfferCollection(msrest.serialization.Model): + """Collection of premier add-on offers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOffer] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremierAddOnOffer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremierAddOnOfferCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class PremierAddOnPatchResource(ProxyOnlyResource): """ARM resource for a PremierAddOn. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7357,7 +8435,10 @@ class PremierAddOnPatchResource(ProxyOnlyResource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PremierAddOnPatchResource, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.product = kwargs.get('product', None) @@ -7369,8 +8450,7 @@ def __init__(self, **kwargs): class PrivateAccess(ProxyOnlyResource): """Description of the parameters of Private Access for a Web Site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7382,10 +8462,9 @@ class PrivateAccess(ProxyOnlyResource): :vartype type: str :param enabled: Whether private access is enabled or not. :type enabled: bool - :param virtual_networks: The Virtual Networks (and subnets) allowed to - access the site privately. - :type virtual_networks: - list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessVirtualNetwork] + :param virtual_networks: The Virtual Networks (and subnets) allowed to access the site + privately. + :type virtual_networks: list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessVirtualNetwork] """ _validation = { @@ -7403,15 +8482,17 @@ class PrivateAccess(ProxyOnlyResource): 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[PrivateAccessVirtualNetwork]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateAccess, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.virtual_networks = kwargs.get('virtual_networks', None) -class PrivateAccessSubnet(Model): - """Description of a Virtual Network subnet that is useable for private site - access. +class PrivateAccessSubnet(msrest.serialization.Model): + """Description of a Virtual Network subnet that is useable for private site access. :param name: The name of the subnet. :type name: str @@ -7424,26 +8505,28 @@ class PrivateAccessSubnet(Model): 'key': {'key': 'key', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateAccessSubnet, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.key = kwargs.get('key', None) -class PrivateAccessVirtualNetwork(Model): +class PrivateAccessVirtualNetwork(msrest.serialization.Model): """Description of a Virtual Network that is useable for private site access. :param name: The name of the Virtual Network. :type name: str :param key: The key (ID) of the Virtual Network. :type key: int - :param resource_id: The ARM uri of the Virtual Network + :param resource_id: The ARM uri of the Virtual Network. :type resource_id: str - :param subnets: A List of subnets that access is allowed to on this - Virtual Network. An empty array (but not null) is interpreted to mean that - all subnets are allowed within this Virtual Network. - :type subnets: - list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessSubnet] + :param subnets: A List of subnets that access is allowed to on this Virtual Network. An empty + array (but not null) is interpreted to mean that all subnets are allowed within this Virtual + Network. + :type subnets: list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessSubnet] """ _attribute_map = { @@ -7453,7 +8536,10 @@ class PrivateAccessVirtualNetwork(Model): 'subnets': {'key': 'subnets', 'type': '[PrivateAccessSubnet]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateAccessVirtualNetwork, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.key = kwargs.get('key', None) @@ -7464,8 +8550,7 @@ def __init__(self, **kwargs): class PrivateEndpointConnectionResource(ProxyOnlyResource): """Private Endpoint Connection ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7477,10 +8562,9 @@ class PrivateEndpointConnectionResource(ProxyOnlyResource): :vartype type: str :ivar provisioning_state: :vartype provisioning_state: str - :param private_endpoint: PrivateEndpoint of a remote private endpoint - connection + :param private_endpoint: PrivateEndpoint of a remote private endpoint connection. :type private_endpoint: ~azure.mgmt.web.v2019_08_01.models.ArmIdWrapper - :param private_link_service_connection_state: + :param private_link_service_connection_state: The state of a private link connection. :type private_link_service_connection_state: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionState """ @@ -7502,7 +8586,10 @@ class PrivateEndpointConnectionResource(ProxyOnlyResource): 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkConnectionState'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpointConnectionResource, self).__init__(**kwargs) self.provisioning_state = None self.private_endpoint = kwargs.get('private_endpoint', None) @@ -7512,8 +8599,7 @@ def __init__(self, **kwargs): class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): """Private Endpoint Connection Approval ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7523,7 +8609,7 @@ class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param private_link_service_connection_state: + :param private_link_service_connection_state: The state of a private link connection. :type private_link_service_connection_state: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionState """ @@ -7542,19 +8628,22 @@ class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkConnectionState'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkConnectionApprovalRequestResource, self).__init__(**kwargs) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) -class PrivateLinkConnectionState(Model): +class PrivateLinkConnectionState(msrest.serialization.Model): """The state of a private link connection. - :param status: Status of a private link connection + :param status: Status of a private link connection. :type status: str - :param description: Description of a private link connection + :param description: Description of a private link connection. :type description: str - :param actions_required: ActionsRequired for a private link connection + :param actions_required: ActionsRequired for a private link connection. :type actions_required: str """ @@ -7564,27 +8653,29 @@ class PrivateLinkConnectionState(Model): 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) self.actions_required = kwargs.get('actions_required', None) -class PrivateLinkResource(Model): +class PrivateLinkResource(msrest.serialization.Model): """A private link resource. All required parameters must be populated in order to send to Azure. :param id: Required. :type id: str - :param name: Required. Name of a private link resource + :param name: Required. Name of a private link resource. :type name: str :param type: Required. :type type: str - :param properties: Required. Properties of a private link resource - :type properties: - ~azure.mgmt.web.v2019_08_01.models.PrivateLinkResourceProperties + :param properties: Required. Properties of a private link resource. + :type properties: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkResourceProperties """ _validation = { @@ -7601,25 +8692,27 @@ class PrivateLinkResource(Model): 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.properties = kwargs.get('properties', None) + self.id = kwargs['id'] + self.name = kwargs['name'] + self.type = kwargs['type'] + self.properties = kwargs['properties'] -class PrivateLinkResourceProperties(Model): +class PrivateLinkResourceProperties(msrest.serialization.Model): """Properties of a private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar group_id: GroupId of a private link resource + :ivar group_id: GroupId of a private link resource. :vartype group_id: str - :ivar required_members: RequiredMembers of a private link resource + :ivar required_members: RequiredMembers of a private link resource. :vartype required_members: list[str] - :ivar required_zone_names: RequiredZoneNames of a private link resource + :ivar required_zone_names: RequiredZoneNames of a private link resource. :vartype required_zone_names: list[str] """ @@ -7635,14 +8728,17 @@ class PrivateLinkResourceProperties(Model): 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResourceProperties, self).__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = None -class PrivateLinkResourcesWrapper(Model): +class PrivateLinkResourcesWrapper(msrest.serialization.Model): """Wrapper for a collection of private link resources. All required parameters must be populated in order to send to Azure. @@ -7659,16 +8755,18 @@ class PrivateLinkResourcesWrapper(Model): 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResourcesWrapper, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] class ProcessInfo(ProxyOnlyResource): """Process Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7686,9 +8784,9 @@ class ProcessInfo(ProxyOnlyResource): :type href: str :param minidump: Minidump URI. :type minidump: str - :param is_profile_running: Is profile running? + :param is_profile_running: Is profile running?. :type is_profile_running: bool - :param is_iis_profile_running: Is the IIS Profile running? + :param is_iis_profile_running: Is the IIS Profile running?. :type is_iis_profile_running: bool :param iis_profile_timeout_in_seconds: IIS Profile timeout (seconds). :type iis_profile_timeout_in_seconds: float @@ -7715,7 +8813,7 @@ class ProcessInfo(ProxyOnlyResource): :param thread_count: Thread count. :type thread_count: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_cpu_time: Total CPU time. :type total_cpu_time: str :param user_cpu_time: User CPU time. @@ -7741,12 +8839,12 @@ class ProcessInfo(ProxyOnlyResource): :param peak_paged_memory: Peak paged memory. :type peak_paged_memory: long :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime :param environment_variables: List of environment variables. :type environment_variables: dict[str, str] - :param is_scm_site: Is this the SCM site? + :param is_scm_site: Is this the SCM site?. :type is_scm_site: bool - :param is_webjob: Is this a Web Job? + :param is_webjob: Is this a Web Job?. :type is_webjob: bool :param description: Description of process. :type description: str @@ -7802,7 +8900,10 @@ class ProcessInfo(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessInfo, self).__init__(**kwargs) self.identifier = None self.deployment_name = kwargs.get('deployment_name', None) @@ -7842,11 +8943,42 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class ProcessInfoCollection(msrest.serialization.Model): + """Collection of Kudu process information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ProcessInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ProcessModuleInfo(ProxyOnlyResource): """Process Module Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7856,8 +8988,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param base_address: Base address. Used as module identifier in ARM - resource URI. + :param base_address: Base address. Used as module identifier in ARM resource URI. :type base_address: str :param file_name: File name. :type file_name: str @@ -7875,7 +9006,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type product: str :param product_version: Product version. :type product_version: str - :param is_debug: Is debug? + :param is_debug: Is debug?. :type is_debug: bool :param language: Module language (locale). :type language: str @@ -7905,7 +9036,10 @@ class ProcessModuleInfo(ProxyOnlyResource): 'language': {'key': 'properties.language', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessModuleInfo, self).__init__(**kwargs) self.base_address = kwargs.get('base_address', None) self.file_name = kwargs.get('file_name', None) @@ -7920,11 +9054,42 @@ def __init__(self, **kwargs): self.language = kwargs.get('language', None) +class ProcessModuleInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessModuleInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessModuleInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ProcessThreadInfo(ProxyOnlyResource): """Process Thread Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7949,7 +9114,7 @@ class ProcessThreadInfo(ProxyOnlyResource): :param base_priority: Base priority. :type base_priority: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total processor time. :type total_processor_time: str :param user_processor_time: User processor time. @@ -7986,7 +9151,10 @@ class ProcessThreadInfo(ProxyOnlyResource): 'wait_reason': {'key': 'properties.wait_reason', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProcessThreadInfo, self).__init__(**kwargs) self.identifier = None self.href = kwargs.get('href', None) @@ -8002,11 +9170,42 @@ def __init__(self, **kwargs): self.wait_reason = kwargs.get('wait_reason', None) +class ProcessThreadInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessThreadInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProcessThreadInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class PublicCertificate(ProxyOnlyResource): """Public certificate object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8016,13 +9215,13 @@ class PublicCertificate(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param blob: Public Certificate byte array + :param blob: Public Certificate byte array. :type blob: bytearray - :param public_certificate_location: Public Certificate Location. Possible - values include: 'CurrentUserMy', 'LocalMachineMy', 'Unknown' + :param public_certificate_location: Public Certificate Location. Possible values include: + "CurrentUserMy", "LocalMachineMy", "Unknown". :type public_certificate_location: str or ~azure.mgmt.web.v2019_08_01.models.PublicCertificateLocation - :ivar thumbprint: Certificate Thumbprint + :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str """ @@ -8039,25 +9238,57 @@ class PublicCertificate(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, - 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'PublicCertificateLocation'}, + 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PublicCertificate, self).__init__(**kwargs) self.blob = kwargs.get('blob', None) self.public_certificate_location = kwargs.get('public_certificate_location', None) self.thumbprint = None -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PublicCertificateCollection(msrest.serialization.Model): + """Collection of public certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.PublicCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublicCertificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublicCertificateCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -8066,22 +9297,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -8089,7 +9317,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -8103,7 +9330,10 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PushSettings, self).__init__(**kwargs) self.is_push_enabled = kwargs.get('is_push_enabled', None) self.tag_whitelist_json = kwargs.get('tag_whitelist_json', None) @@ -8111,41 +9341,39 @@ def __init__(self, **kwargs): self.dynamic_tags_json = kwargs.get('dynamic_tags_json', None) -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - \\nMinReroutePercentage or - MaxReroutePercentage. Site metrics are checked every N - minutes specified in ChangeIntervalInMinutes.\\nCustom - decision algorithm - can be provided in TiPCallback site extension which URL can be specified - in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + \n:code:`MinReroutePercentage` or + :code:`MaxReroutePercentage`. Site metrics are checked every N minutes specified + in :code:`ChangeIntervalInMinutes`.\nCustom decision algorithm + can be provided in TiPCallback site extension which URL can be specified in + :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -8160,7 +9388,10 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = kwargs.get('action_host_name', None) self.reroute_percentage = kwargs.get('reroute_percentage', None) @@ -8175,8 +9406,7 @@ def __init__(self, **kwargs): class Recommendation(ProxyOnlyResource): """Represents a recommendation result generated by the recommendation engine. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8187,68 +9417,58 @@ class Recommendation(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param creation_time: Timestamp when this instance was created. - :type creation_time: datetime - :param recommendation_id: A GUID value that each recommendation object is - associated with. + :type creation_time: ~datetime.datetime + :param recommendation_id: A GUID value that each recommendation object is associated with. :type recommendation_id: str - :param resource_id: Full ARM resource ID string that this recommendation - object is associated with. + :param resource_id: Full ARM resource ID string that this recommendation object is associated + with. :type resource_id: str - :param resource_scope: Name of a resource type this recommendation - applies, e.g. Subscription, ServerFarm, Site. Possible values include: - 'ServerFarm', 'Subscription', 'WebSite' - :type resource_scope: str or - ~azure.mgmt.web.v2019_08_01.models.ResourceScopeType + :param resource_scope: Name of a resource type this recommendation applies, e.g. Subscription, + ServerFarm, Site. Possible values include: "ServerFarm", "Subscription", "WebSite". + :type resource_scope: str or ~azure.mgmt.web.v2019_08_01.models.ResourceScopeType :param rule_name: Unique name of the rule. :type rule_name: str :param display_name: UI friendly name of the rule (may not be unique). :type display_name: str :param message: Recommendation text. :type message: str - :param level: Level indicating how critical this recommendation can - impact. Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level indicating how critical this recommendation can impact. Possible values + include: "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2019_08_01.models.NotificationLevel - :param channels: List of channels that this recommendation can apply. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of channels that this recommendation can apply. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2019_08_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - belongs to. + :ivar category_tags: The list of category tags that this recommendation belongs to. :vartype category_tags: list[str] :param action_name: Name of action recommended by this object. :type action_name: str - :param enabled: True if this recommendation is still valid (i.e. - "actionable"). False if it is invalid. + :param enabled: True if this recommendation is still valid (i.e. "actionable"). False if it is + invalid. :type enabled: int - :param states: The list of states of this recommendation. If it's null - then it should be considered "Active". + :param states: The list of states of this recommendation. If it's null then it should be + considered "Active". :type states: list[str] - :param start_time: The beginning time in UTC of a range that the - recommendation refers to. - :type start_time: datetime - :param end_time: The end time in UTC of a range that the recommendation - refers to. - :type end_time: datetime - :param next_notification_time: When to notify this recommendation next in - UTC. Null means that this will never be notified anymore. - :type next_notification_time: datetime - :param notification_expiration_time: Date and time in UTC when this - notification expires. - :type notification_expiration_time: datetime - :param notified_time: Last timestamp in UTC this instance was actually - notified. Null means that this recommendation hasn't been notified yet. - :type notified_time: datetime + :param start_time: The beginning time in UTC of a range that the recommendation refers to. + :type start_time: ~datetime.datetime + :param end_time: The end time in UTC of a range that the recommendation refers to. + :type end_time: ~datetime.datetime + :param next_notification_time: When to notify this recommendation next in UTC. Null means that + this will never be notified anymore. + :type next_notification_time: ~datetime.datetime + :param notification_expiration_time: Date and time in UTC when this notification expires. + :type notification_expiration_time: ~datetime.datetime + :param notified_time: Last timestamp in UTC this instance was actually notified. Null means + that this recommendation hasn't been notified yet. + :type notified_time: ~datetime.datetime :param score: A metric value measured by the rule. :type score: float - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool :param extension_name: Extension name of the portal if exists. :type extension_name: str :param blade_name: Deep link to a blade on the portal. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. + :param forward_link: Forward link to an external document associated with the rule. :type forward_link: str """ @@ -8271,8 +9491,8 @@ class Recommendation(ProxyOnlyResource): 'rule_name': {'key': 'properties.ruleName', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'int'}, @@ -8289,7 +9509,10 @@ class Recommendation(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Recommendation, self).__init__(**kwargs) self.creation_time = kwargs.get('creation_time', None) self.recommendation_id = kwargs.get('recommendation_id', None) @@ -8316,12 +9539,42 @@ def __init__(self, **kwargs): self.forward_link = kwargs.get('forward_link', None) +class RecommendationCollection(msrest.serialization.Model): + """Collection of recommendations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Recommendation] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Recommendation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RecommendationCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class RecommendationRule(ProxyOnlyResource): - """Represents a recommendation rule that the recommendation engine can - perform. + """Represents a recommendation rule that the recommendation engine can perform. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8337,36 +9590,30 @@ class RecommendationRule(ProxyOnlyResource): :type display_name: str :param message: Localized name of the rule (Good for UI). :type message: str - :param recommendation_id: Recommendation ID of an associated - recommendation object tied to the rule, if exists. + :param recommendation_id: Recommendation ID of an associated recommendation object tied to the + rule, if exists. If such an object doesn't exist, it is set to null. :type recommendation_id: str :param description: Localized detailed description of the rule. :type description: str - :param action_name: Name of action that is recommended by this rule in - string. + :param action_name: Name of action that is recommended by this rule in string. :type action_name: str - :param level: Level of impact indicating how critical this rule is. - Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level of impact indicating how critical this rule is. Possible values include: + "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2019_08_01.models.NotificationLevel - :param channels: List of available channels that this rule applies. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of available channels that this rule applies. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2019_08_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - rule belongs to. + :ivar category_tags: The list of category tags that this recommendation rule belongs to. :vartype category_tags: list[str] - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool - :param extension_name: Extension name of the portal if exists. Applicable - to dynamic rule only. + :param extension_name: Extension name of the portal if exists. Applicable to dynamic rule only. :type extension_name: str - :param blade_name: Deep link to a blade on the portal. Applicable to - dynamic rule only. + :param blade_name: Deep link to a blade on the portal. Applicable to dynamic rule only. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. Applicable to dynamic rule only. + :param forward_link: Forward link to an external document associated with the rule. Applicable + to dynamic rule only. :type forward_link: str """ @@ -8388,8 +9635,8 @@ class RecommendationRule(ProxyOnlyResource): 'recommendation_id': {'key': 'properties.recommendationId', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, 'extension_name': {'key': 'properties.extensionName', 'type': 'str'}, @@ -8397,7 +9644,10 @@ class RecommendationRule(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RecommendationRule, self).__init__(**kwargs) self.recommendation_name = kwargs.get('recommendation_name', None) self.display_name = kwargs.get('display_name', None) @@ -8417,8 +9667,7 @@ def __init__(self, **kwargs): class ReissueCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate reissue request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8430,13 +9679,13 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): :vartype type: str :param key_size: Certificate Key Size. :type key_size: int - :param delay_existing_revoke_in_hours: Delay in hours to revoke existing - certificate after the new certificate is issued. + :param delay_existing_revoke_in_hours: Delay in hours to revoke existing certificate after the + new certificate is issued. :type delay_existing_revoke_in_hours: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -8457,7 +9706,10 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ReissueCertificateOrderRequest, self).__init__(**kwargs) self.key_size = kwargs.get('key_size', None) self.delay_existing_revoke_in_hours = kwargs.get('delay_existing_revoke_in_hours', None) @@ -8468,8 +9720,7 @@ def __init__(self, **kwargs): class RelayServiceConnectionEntity(ProxyOnlyResource): """Hybrid Connection for an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8515,7 +9766,10 @@ class RelayServiceConnectionEntity(ProxyOnlyResource): 'biztalk_uri': {'key': 'properties.biztalkUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RelayServiceConnectionEntity, self).__init__(**kwargs) self.entity_name = kwargs.get('entity_name', None) self.entity_connection_string = kwargs.get('entity_connection_string', None) @@ -8526,26 +9780,28 @@ def __init__(self, **kwargs): self.biztalk_uri = kwargs.get('biztalk_uri', None) -class Rendering(Model): +class Rendering(msrest.serialization.Model): """Instructions for rendering the data. - :param type: Rendering Type. Possible values include: 'NoGraph', 'Table', - 'TimeSeries', 'TimeSeriesPerInstance' + :param type: Rendering Type. Possible values include: "NoGraph", "Table", "TimeSeries", + "TimeSeriesPerInstance". :type type: str or ~azure.mgmt.web.v2019_08_01.models.RenderingType - :param title: Title of data + :param title: Title of data. :type title: str - :param description: Description of the data that will help it be - interpreted + :param description: Description of the data that will help it be interpreted. :type description: str """ _attribute_map = { - 'type': {'key': 'type', 'type': 'RenderingType'}, + 'type': {'key': 'type', 'type': 'str'}, 'title': {'key': 'title', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Rendering, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.title = kwargs.get('title', None) @@ -8555,8 +9811,7 @@ def __init__(self, **kwargs): class RenewCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate renew request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8570,8 +9825,8 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): :type key_size: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -8591,14 +9846,17 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RenewCertificateOrderRequest, self).__init__(**kwargs) self.key_size = kwargs.get('key_size', None) self.csr = kwargs.get('csr', None) self.is_private_key_external = kwargs.get('is_private_key_external', None) -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -8612,17 +9870,51 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = kwargs.get('count', None) self.time_interval = kwargs.get('time_interval', None) +class ResourceCollection(msrest.serialization.Model): + """Collection of resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[str] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class ResourceHealthMetadata(ProxyOnlyResource): """Used for getting ResourceHealthCheck settings. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8632,10 +9924,9 @@ class ResourceHealthMetadata(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param category: The category that the resource matches in the RHC Policy - File + :param category: The category that the resource matches in the RHC Policy File. :type category: str - :param signal_availability: Is there a health signal for the resource + :param signal_availability: Is there a health signal for the resource. :type signal_availability: bool """ @@ -8654,17 +9945,51 @@ class ResourceHealthMetadata(ProxyOnlyResource): 'signal_availability': {'key': 'properties.signalAvailability', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceHealthMetadata, self).__init__(**kwargs) self.category = kwargs.get('category', None) self.signal_availability = kwargs.get('signal_availability', None) -class ResourceMetricAvailability(Model): +class ResourceHealthMetadataCollection(msrest.serialization.Model): + """Collection of resource health metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceHealthMetadata]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceHealthMetadataCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -8682,7 +10007,10 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None @@ -8691,8 +10019,7 @@ def __init__(self, **kwargs): class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8706,8 +10033,8 @@ class ResourceMetricDefinition(ProxyOnlyResource): :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2019_08_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. @@ -8739,7 +10066,10 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(**kwargs) self.unit = None self.primary_aggregation_type = None @@ -8748,24 +10078,53 @@ def __init__(self, **kwargs): self.properties = None -class ResourceNameAvailability(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ResourceNameAvailability(msrest.serialization.Model): """Information regarding availability of a resource name. - :param name_available: true indicates name is valid and - available. false indicates the name is invalid, unavailable, - or both. + :param name_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. :type name_available: bool - :param reason: Invalid indicates the name provided does not - match Azure App Service naming requirements. AlreadyExists - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.web.v2019_08_01.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why - the given name is invalid, and provide the resource naming requirements so - that the user can select a valid name. If reason == AlreadyExists, explain - that resource name is already in use, and direct them to select a - different name. + :param reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.web.v2019_08_01.models.InAvailabilityReasonType + :param message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. :type message: str """ @@ -8775,26 +10134,28 @@ class ResourceNameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceNameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class ResourceNameAvailabilityRequest(Model): +class ResourceNameAvailabilityRequest(msrest.serialization.Model): """Resource name availability request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes + :param type: Required. Resource type used for verification. Possible values include: "Site", + "Slot", "HostingEnvironment", "PublishingUser", "Microsoft.Web/sites", + "Microsoft.Web/sites/slots", "Microsoft.Web/hostingEnvironments", + "Microsoft.Web/publishingUsers". + :type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool """ @@ -8810,17 +10171,20 @@ class ResourceNameAvailabilityRequest(Model): 'is_fqdn': {'key': 'isFqdn', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) + self.name = kwargs['name'] + self.type = kwargs['type'] self.is_fqdn = kwargs.get('is_fqdn', None) -class ResponseMetaData(Model): +class ResponseMetaData(msrest.serialization.Model): """ResponseMetaData. - :param data_source: Source of the Data + :param data_source: Source of the Data. :type data_source: ~azure.mgmt.web.v2019_08_01.models.DataSource """ @@ -8828,7 +10192,10 @@ class ResponseMetaData(Model): 'data_source': {'key': 'dataSource', 'type': 'DataSource'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResponseMetaData, self).__init__(**kwargs) self.data_source = kwargs.get('data_source', None) @@ -8836,10 +10203,7 @@ def __init__(self, **kwargs): class RestoreRequest(ProxyOnlyResource): """Description of a restore request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8849,42 +10213,37 @@ class RestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str :param blob_name: Name of a blob which contains the backup. :type blob_name: str - :param overwrite: Required. true if the restore operation can - overwrite target app; otherwise, false. true is - needed if trying to restore over an existing app. + :param overwrite: :code:`true` if the restore operation can overwrite target app; + otherwise, :code:`false`. :code:`true` is needed if trying to restore + over an existing app. :type overwrite: bool :param site_name: Name of an app. :type site_name: str - :param databases: Collection of databases which should be restored. This - list has to match the list of databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] - :param ignore_conflicting_host_names: Changes a logic when restoring an - app with custom domains. true to remove custom domains - automatically. If false, custom domains are added to - the app's object when it is being restored, but that might fail due to - conflicts during the operation. Default value: False . + :param databases: Collection of databases which should be restored. This list has to match the + list of databases included in the backup. + :type databases: list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] + :param ignore_conflicting_host_names: Changes a logic when restoring an app with custom + domains. :code:`true` to remove custom domains automatically. If + :code:`false`, custom domains are added to + the app's object when it is being restored, but that might fail due to conflicts during the + operation. :type ignore_conflicting_host_names: bool - :param ignore_databases: Ignore the databases and only restore the site - content. Default value: False . + :param ignore_databases: Ignore the databases and only restore the site content. :type ignore_databases: bool - :param app_service_plan: Specify app service plan that will own restored - site. + :param app_service_plan: Specify app service plan that will own restored site. :type app_service_plan: str - :param operation_type: Operation type. Possible values include: 'Default', - 'Clone', 'Relocation', 'Snapshot', 'CloudFS'. Default value: "Default" . - :type operation_type: str or - ~azure.mgmt.web.v2019_08_01.models.BackupRestoreOperationType - :param adjust_connection_strings: true if - SiteConfig.ConnectionStrings should be set in new app; otherwise, - false. + :param operation_type: Operation type. Possible values include: "Default", "Clone", + "Relocation", "Snapshot", "CloudFS". Default value: "Default". + :type operation_type: str or ~azure.mgmt.web.v2019_08_01.models.BackupRestoreOperationType + :param adjust_connection_strings: :code:`true` if SiteConfig.ConnectionStrings + should be set in new app; otherwise, :code:`false`. :type adjust_connection_strings: bool - :param hosting_environment: App Service Environment name, if needed (only - when restoring an app to an App Service Environment). + :param hosting_environment: App Service Environment name, if needed (only when restoring an app + to an App Service Environment). :type hosting_environment: str """ @@ -8892,8 +10251,6 @@ class RestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -8909,12 +10266,15 @@ class RestoreRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, 'ignore_databases': {'key': 'properties.ignoreDatabases', 'type': 'bool'}, 'app_service_plan': {'key': 'properties.appServicePlan', 'type': 'str'}, - 'operation_type': {'key': 'properties.operationType', 'type': 'BackupRestoreOperationType'}, + 'operation_type': {'key': 'properties.operationType', 'type': 'str'}, 'adjust_connection_strings': {'key': 'properties.adjustConnectionStrings', 'type': 'bool'}, 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RestoreRequest, self).__init__(**kwargs) self.storage_account_url = kwargs.get('storage_account_url', None) self.blob_name = kwargs.get('blob_name', None) @@ -8929,15 +10289,13 @@ def __init__(self, **kwargs): self.hosting_environment = kwargs.get('hosting_environment', None) -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """Resource metrics service provided by Microsoft.Insights resource provider. :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2019_08_01.models.MetricSpecification] + :type metric_specifications: list[~azure.mgmt.web.v2019_08_01.models.MetricSpecification] :param log_specifications: - :type log_specifications: - list[~azure.mgmt.web.v2019_08_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.web.v2019_08_01.models.LogSpecification] """ _attribute_map = { @@ -8945,7 +10303,10 @@ class ServiceSpecification(Model): 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = kwargs.get('metric_specifications', None) self.log_specifications = kwargs.get('log_specifications', None) @@ -8954,8 +10315,7 @@ def __init__(self, **kwargs): class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -8969,127 +10329,109 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2019_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants except dataComponent. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants except dataComponent. Read- + only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2019_08_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2019_08_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2019_08_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param identity: - :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity """ _validation = { @@ -9124,13 +10466,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -9158,13 +10501,16 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Site, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -9201,15 +10547,12 @@ def __init__(self, **kwargs): self.https_only = kwargs.get('https_only', None) self.redundancy_mode = kwargs.get('redundancy_mode', None) self.in_progress_operation_id = None - self.identity = kwargs.get('identity', None) class SiteAuthSettings(ProxyOnlyResource): - """Configuration settings for the Azure App Service Authentication / - Authorization feature. + """Configuration settings for the Azure App Service Authentication / Authorization feature. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9219,152 +10562,128 @@ class SiteAuthSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param enabled: true if the Authentication / Authorization - feature is enabled for the current app; otherwise, false. + :param enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. :type enabled: bool - :param runtime_version: The RuntimeVersion of the Authentication / - Authorization feature in use for the current app. - The setting in this value can control the behavior of certain features in - the Authentication / Authorization module. + :param runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. :type runtime_version: str - :param unauthenticated_client_action: The action to take when an - unauthenticated client attempts to access the app. Possible values - include: 'RedirectToLoginPage', 'AllowAnonymous' + :param unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous". :type unauthenticated_client_action: str or ~azure.mgmt.web.v2019_08_01.models.UnauthenticatedClientAction - :param token_store_enabled: true to durably store - platform-specific security tokens that are obtained during login flows; - otherwise, false. - The default is false. + :param token_store_enabled: :code:`true` to durably store platform-specific + security tokens that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. :type token_store_enabled: bool - :param allowed_external_redirect_urls: External URLs that can be - redirected to as part of logging in or logging out of the app. Note that - the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store - application backends. + :param allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. :type allowed_external_redirect_urls: list[str] - :param default_provider: The default authentication provider to use when - multiple providers are configured. - This setting is only needed if multiple providers are configured and the - unauthenticated client - action is set to "RedirectToLoginPage". Possible values include: - 'AzureActiveDirectory', 'Facebook', 'Google', 'MicrosoftAccount', - 'Twitter' - :type default_provider: str or - ~azure.mgmt.web.v2019_08_01.models.BuiltInAuthenticationProvider - :param token_refresh_extension_hours: The number of hours after session - token expiration that a session token can be used to + :param default_provider: The default authentication provider to use when multiple providers are + configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". Possible values include: "AzureActiveDirectory", + "Facebook", "Google", "MicrosoftAccount", "Twitter". + :type default_provider: str or ~azure.mgmt.web.v2019_08_01.models.BuiltInAuthenticationProvider + :param token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to call the token refresh API. The default is 72 hours. :type token_refresh_extension_hours: float - :param client_id: The Client ID of this relying party application, known - as the client_id. - This setting is required for enabling OpenID Connection authentication - with Azure Active Directory or + :param client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or other 3rd party OpenID Connect providers. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_id: str - :param client_secret: The Client Secret of this relying party application - (in Azure Active Directory, this is also referred to as the Key). - This setting is optional. If no client secret is configured, the OpenID - Connect implicit auth flow is used to authenticate end users. - Otherwise, the OpenID Connect Authorization Code Flow is used to - authenticate end users. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + :param client_secret: The Client Secret of this relying party application (in Azure Active + Directory, this is also referred to as the Key). + This setting is optional. If no client secret is configured, the OpenID Connect implicit auth + flow is used to authenticate end users. + Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_secret: str - :param client_secret_certificate_thumbprint: An alternative to the client - secret, that is the thumbprint of a certificate used for signing purposes. - This property acts as + :param client_secret_certificate_thumbprint: An alternative to the client secret, that is the + thumbprint of a certificate used for signing purposes. This property acts as a replacement for the Client Secret. It is also optional. :type client_secret_certificate_thumbprint: str - :param issuer: The OpenID Connect Issuer URI that represents the entity - which issues access tokens for this application. - When using Azure Active Directory, this value is the URI of the directory - tenant, e.g. https://sts.windows.net/{tenant-guid}/. + :param issuer: The OpenID Connect Issuer URI that represents the entity which issues access + tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://sts.windows.net/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. - More information on OpenID Connect Discovery: - http://openid.net/specs/openid-connect-discovery-1_0.html + More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect- + discovery-1_0.html. :type issuer: str - :param validate_issuer: Gets a value indicating whether the issuer should - be a valid HTTPS url and be validated as such. + :param validate_issuer: Gets a value indicating whether the issuer should be a valid HTTPS url + and be validated as such. :type validate_issuer: bool - :param allowed_audiences: Allowed audience values to consider when - validating JWTs issued by - Azure Active Directory. Note that the ClientID value is - always considered an + :param allowed_audiences: Allowed audience values to consider when validating JWTs issued by + Azure Active Directory. Note that the :code:`ClientID` value is always considered + an allowed audience, regardless of this setting. :type allowed_audiences: list[str] - :param additional_login_params: Login parameters to send to the OpenID - Connect authorization endpoint when + :param additional_login_params: Login parameters to send to the OpenID Connect authorization + endpoint when a user logs in. Each parameter must be in the form "key=value". :type additional_login_params: list[str] - :param google_client_id: The OpenID Connect Client ID for the Google web - application. + :param google_client_id: The OpenID Connect Client ID for the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_id: str - :param google_client_secret: The client secret associated with the Google - web application. + :param google_client_secret: The client secret associated with the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_secret: str - :param google_oauth_scopes: The OAuth 2.0 scopes that will be requested as - part of Google Sign-In authentication. - This setting is optional. If not specified, "openid", "profile", and - "email" are used as default scopes. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ - :type google_oauth_scopes: list[str] + :param google_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Google + Sign-In authentication. + This setting is optional. If not specified, "openid", "profile", and "email" are used as + default scopes. + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. + :type google_o_auth_scopes: list[str] :param facebook_app_id: The App ID of the Facebook app used for login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_id: str - :param facebook_app_secret: The App Secret of the Facebook app used for - Facebook Login. + :param facebook_app_secret: The App Secret of the Facebook app used for Facebook Login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_secret: str - :param facebook_oauth_scopes: The OAuth 2.0 scopes that will be requested - as part of Facebook Login authentication. + :param facebook_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Facebook + Login authentication. This setting is optional. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login - :type facebook_oauth_scopes: list[str] - :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter - application used for sign-in. + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. + :type facebook_o_auth_scopes: list[str] + :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter application used for + sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_key: str - :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the - Twitter application used for sign-in. + :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the Twitter application used + for sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_secret: str - :param microsoft_account_client_id: The OAuth 2.0 client ID that was - created for the app used for authentication. + :param microsoft_account_client_id: The OAuth 2.0 client ID that was created for the app used + for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_id: str - :param microsoft_account_client_secret: The OAuth 2.0 client secret that - was created for the app used for authentication. + :param microsoft_account_client_secret: The OAuth 2.0 client secret that was created for the + app used for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_secret: str - :param microsoft_account_oauth_scopes: The OAuth 2.0 scopes that will be - requested as part of Microsoft Account authentication. - This setting is optional. If not specified, "wl.basic" is used as the - default scope. - Microsoft Account Scopes and permissions documentation: - https://msdn.microsoft.com/en-us/library/dn631845.aspx - :type microsoft_account_oauth_scopes: list[str] + :param microsoft_account_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of + Microsoft Account authentication. + This setting is optional. If not specified, "wl.basic" is used as the default scope. + Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en- + us/library/dn631845.aspx. + :type microsoft_account_o_auth_scopes: list[str] """ _validation = { @@ -9380,10 +10699,10 @@ class SiteAuthSettings(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, - 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'UnauthenticatedClientAction'}, + 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'str'}, 'token_store_enabled': {'key': 'properties.tokenStoreEnabled', 'type': 'bool'}, 'allowed_external_redirect_urls': {'key': 'properties.allowedExternalRedirectUrls', 'type': '[str]'}, - 'default_provider': {'key': 'properties.defaultProvider', 'type': 'BuiltInAuthenticationProvider'}, + 'default_provider': {'key': 'properties.defaultProvider', 'type': 'str'}, 'token_refresh_extension_hours': {'key': 'properties.tokenRefreshExtensionHours', 'type': 'float'}, 'client_id': {'key': 'properties.clientId', 'type': 'str'}, 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, @@ -9394,18 +10713,21 @@ class SiteAuthSettings(ProxyOnlyResource): 'additional_login_params': {'key': 'properties.additionalLoginParams', 'type': '[str]'}, 'google_client_id': {'key': 'properties.googleClientId', 'type': 'str'}, 'google_client_secret': {'key': 'properties.googleClientSecret', 'type': 'str'}, - 'google_oauth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, + 'google_o_auth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, 'facebook_app_id': {'key': 'properties.facebookAppId', 'type': 'str'}, 'facebook_app_secret': {'key': 'properties.facebookAppSecret', 'type': 'str'}, - 'facebook_oauth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, + 'facebook_o_auth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, 'twitter_consumer_key': {'key': 'properties.twitterConsumerKey', 'type': 'str'}, 'twitter_consumer_secret': {'key': 'properties.twitterConsumerSecret', 'type': 'str'}, 'microsoft_account_client_id': {'key': 'properties.microsoftAccountClientId', 'type': 'str'}, 'microsoft_account_client_secret': {'key': 'properties.microsoftAccountClientSecret', 'type': 'str'}, - 'microsoft_account_oauth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, + 'microsoft_account_o_auth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteAuthSettings, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -9423,46 +10745,45 @@ def __init__(self, **kwargs): self.additional_login_params = kwargs.get('additional_login_params', None) self.google_client_id = kwargs.get('google_client_id', None) self.google_client_secret = kwargs.get('google_client_secret', None) - self.google_oauth_scopes = kwargs.get('google_oauth_scopes', None) + self.google_o_auth_scopes = kwargs.get('google_o_auth_scopes', None) self.facebook_app_id = kwargs.get('facebook_app_id', None) self.facebook_app_secret = kwargs.get('facebook_app_secret', None) - self.facebook_oauth_scopes = kwargs.get('facebook_oauth_scopes', None) + self.facebook_o_auth_scopes = kwargs.get('facebook_o_auth_scopes', None) self.twitter_consumer_key = kwargs.get('twitter_consumer_key', None) self.twitter_consumer_secret = kwargs.get('twitter_consumer_secret', None) self.microsoft_account_client_id = kwargs.get('microsoft_account_client_id', None) self.microsoft_account_client_secret = kwargs.get('microsoft_account_client_secret', None) - self.microsoft_account_oauth_scopes = kwargs.get('microsoft_account_oauth_scopes', None) + self.microsoft_account_o_auth_scopes = kwargs.get('microsoft_account_o_auth_scopes', None) -class SiteCloneability(Model): +class SiteCloneability(msrest.serialization.Model): """Represents whether or not an app is cloneable. - :param result: Name of app. Possible values include: 'Cloneable', - 'PartiallyCloneable', 'NotCloneable' + :param result: Name of app. Possible values include: "Cloneable", "PartiallyCloneable", + "NotCloneable". :type result: str or ~azure.mgmt.web.v2019_08_01.models.CloneAbilityResult - :param blocking_features: List of features enabled on app that prevent - cloning. - :type blocking_features: - list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] - :param unsupported_features: List of features enabled on app that are - non-blocking but cannot be cloned. The app can still be cloned + :param blocking_features: List of features enabled on app that prevent cloning. + :type blocking_features: list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] + :param unsupported_features: List of features enabled on app that are non-blocking but cannot + be cloned. The app can still be cloned but the features in this list will not be set up on cloned app. - :type unsupported_features: - list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] - :param blocking_characteristics: List of blocking application - characteristics. + :type unsupported_features: list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] + :param blocking_characteristics: List of blocking application characteristics. :type blocking_characteristics: list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] """ _attribute_map = { - 'result': {'key': 'result', 'type': 'CloneAbilityResult'}, + 'result': {'key': 'result', 'type': 'str'}, 'blocking_features': {'key': 'blockingFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'unsupported_features': {'key': 'unsupportedFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'blocking_characteristics': {'key': 'blockingCharacteristics', 'type': '[SiteCloneabilityCriterion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteCloneability, self).__init__(**kwargs) self.result = kwargs.get('result', None) self.blocking_features = kwargs.get('blocking_features', None) @@ -9470,7 +10791,7 @@ def __init__(self, **kwargs): self.blocking_characteristics = kwargs.get('blocking_characteristics', None) -class SiteCloneabilityCriterion(Model): +class SiteCloneabilityCriterion(msrest.serialization.Model): """An app cloneability criterion. :param name: Name of criterion. @@ -9484,24 +10805,25 @@ class SiteCloneabilityCriterion(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteCloneabilityCriterion, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9511,54 +10833,57 @@ class SiteConfig(Model): :type node_version: str :param power_shell_version: Version of PowerShell. :type power_shell_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool + :param acr_use_managed_identity_creds: Flag to use Managed Identity Creds for ACR pull. + :type acr_use_managed_identity_creds: bool + :param acr_user_managed_identity_id: If using user managed identity, the user managed identity + ClientId. + :type acr_user_managed_identity_id: str :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2019_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO', 'VSTSRM' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO", "VSTSRM". :type scm_type: str or ~azure.mgmt.web.v2019_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9568,24 +10893,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2019_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2019_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2019_08_01.models.AutoHealRules @@ -9597,46 +10918,39 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2019_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2019_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2019_08_01.models.ApiDefinitionInfo - :param api_management_config: Azure API management settings linked to the - app. - :type api_management_config: - ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig + :param api_management_config: Azure API management settings linked to the app. + :type api_management_config: ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2019_08_01.models.FtpsState :param pre_warmed_instance_count: Number of preWarmed instances. - This setting only applies to the Consumption and Elastic Plans + This setting only applies to the Consumption and Elastic Plans. :type pre_warmed_instance_count: int - :param health_check_path: Health check path + :param health_check_path: Health check path. :type health_check_path: str """ @@ -9660,6 +10974,8 @@ class SiteConfig(Model): 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, + 'acr_use_managed_identity_creds': {'key': 'acrUseManagedIdentityCreds', 'type': 'bool'}, + 'acr_user_managed_identity_id': {'key': 'acrUserManagedIdentityID', 'type': 'str'}, 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, @@ -9676,9 +10992,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -9703,7 +11019,10 @@ class SiteConfig(Model): 'health_check_path': {'key': 'healthCheckPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -9719,6 +11038,8 @@ def __init__(self, **kwargs): self.remote_debugging_enabled = kwargs.get('remote_debugging_enabled', None) self.remote_debugging_version = kwargs.get('remote_debugging_version', None) self.http_logging_enabled = kwargs.get('http_logging_enabled', None) + self.acr_use_managed_identity_creds = kwargs.get('acr_use_managed_identity_creds', None) + self.acr_user_managed_identity_id = kwargs.get('acr_user_managed_identity_id', None) self.logs_directory_size_limit = kwargs.get('logs_directory_size_limit', None) self.detailed_error_logging_enabled = kwargs.get('detailed_error_logging_enabled', None) self.publishing_username = kwargs.get('publishing_username', None) @@ -9765,8 +11086,7 @@ def __init__(self, **kwargs): class SiteConfigResource(ProxyOnlyResource): """Web app configuration ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9780,8 +11100,7 @@ class SiteConfigResource(ProxyOnlyResource): :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9791,54 +11110,57 @@ class SiteConfigResource(ProxyOnlyResource): :type node_version: str :param power_shell_version: Version of PowerShell. :type power_shell_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool + :param acr_use_managed_identity_creds: Flag to use Managed Identity Creds for ACR pull. + :type acr_use_managed_identity_creds: bool + :param acr_user_managed_identity_id: If using user managed identity, the user managed identity + ClientId. + :type acr_user_managed_identity_id: str :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2019_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO', 'VSTSRM' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO", "VSTSRM". :type scm_type: str or ~azure.mgmt.web.v2019_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9848,24 +11170,20 @@ class SiteConfigResource(ProxyOnlyResource): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2019_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2019_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2019_08_01.models.AutoHealRules @@ -9877,46 +11195,39 @@ class SiteConfigResource(ProxyOnlyResource): :type cors: ~azure.mgmt.web.v2019_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2019_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2019_08_01.models.ApiDefinitionInfo - :param api_management_config: Azure API management settings linked to the - app. - :type api_management_config: - ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig + :param api_management_config: Azure API management settings linked to the app. + :type api_management_config: ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2019_08_01.models.FtpsState :param pre_warmed_instance_count: Number of preWarmed instances. - This setting only applies to the Consumption and Elastic Plans + This setting only applies to the Consumption and Elastic Plans. :type pre_warmed_instance_count: int - :param health_check_path: Health check path + :param health_check_path: Health check path. :type health_check_path: str """ @@ -9947,6 +11258,8 @@ class SiteConfigResource(ProxyOnlyResource): 'remote_debugging_enabled': {'key': 'properties.remoteDebuggingEnabled', 'type': 'bool'}, 'remote_debugging_version': {'key': 'properties.remoteDebuggingVersion', 'type': 'str'}, 'http_logging_enabled': {'key': 'properties.httpLoggingEnabled', 'type': 'bool'}, + 'acr_use_managed_identity_creds': {'key': 'properties.acrUseManagedIdentityCreds', 'type': 'bool'}, + 'acr_user_managed_identity_id': {'key': 'properties.acrUserManagedIdentityID', 'type': 'str'}, 'logs_directory_size_limit': {'key': 'properties.logsDirectorySizeLimit', 'type': 'int'}, 'detailed_error_logging_enabled': {'key': 'properties.detailedErrorLoggingEnabled', 'type': 'bool'}, 'publishing_username': {'key': 'properties.publishingUsername', 'type': 'str'}, @@ -9963,9 +11276,9 @@ class SiteConfigResource(ProxyOnlyResource): 'java_container': {'key': 'properties.javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'properties.javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'properties.appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'properties.virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'str'}, 'experiments': {'key': 'properties.experiments', 'type': 'Experiments'}, 'limits': {'key': 'properties.limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'properties.autoHealEnabled', 'type': 'bool'}, @@ -9990,7 +11303,10 @@ class SiteConfigResource(ProxyOnlyResource): 'health_check_path': {'key': 'properties.healthCheckPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfigResource, self).__init__(**kwargs) self.number_of_workers = kwargs.get('number_of_workers', None) self.default_documents = kwargs.get('default_documents', None) @@ -10006,6 +11322,8 @@ def __init__(self, **kwargs): self.remote_debugging_enabled = kwargs.get('remote_debugging_enabled', None) self.remote_debugging_version = kwargs.get('remote_debugging_version', None) self.http_logging_enabled = kwargs.get('http_logging_enabled', None) + self.acr_use_managed_identity_creds = kwargs.get('acr_use_managed_identity_creds', None) + self.acr_user_managed_identity_id = kwargs.get('acr_user_managed_identity_id', None) self.logs_directory_size_limit = kwargs.get('logs_directory_size_limit', None) self.detailed_error_logging_enabled = kwargs.get('detailed_error_logging_enabled', None) self.publishing_username = kwargs.get('publishing_username', None) @@ -10049,11 +11367,42 @@ def __init__(self, **kwargs): self.health_check_path = kwargs.get('health_check_path', None) +class SiteConfigResourceCollection(msrest.serialization.Model): + """Collection of site configurations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteConfigResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteConfigResourceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteConfigurationSnapshotInfo(ProxyOnlyResource): """A snapshot of a web app configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10064,8 +11413,8 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :ivar time: The time the snapshot was taken. - :vartype time: datetime - :ivar snapshot_id: The id of the snapshot + :vartype time: ~datetime.datetime + :ivar snapshot_id: The id of the snapshot. :vartype snapshot_id: int """ @@ -10086,17 +11435,51 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteConfigurationSnapshotInfo, self).__init__(**kwargs) self.time = None self.snapshot_id = None +class SiteConfigurationSnapshotInfoCollection(msrest.serialization.Model): + """Collection of metadata for the app configuration snapshots that can be restored. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteConfigurationSnapshotInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteExtensionInfo(ProxyOnlyResource): """Site Extension Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10110,10 +11493,8 @@ class SiteExtensionInfo(ProxyOnlyResource): :type extension_id: str :param title: :type title: str - :param extension_type: Site extension type. Possible values include: - 'Gallery', 'WebRoot' - :type extension_type: str or - ~azure.mgmt.web.v2019_08_01.models.SiteExtensionType + :param extension_type: Site extension type. Possible values include: "Gallery", "WebRoot". + :type extension_type: str or ~azure.mgmt.web.v2019_08_01.models.SiteExtensionType :param summary: Summary description. :type summary: str :param description: Detailed description. @@ -10135,16 +11516,16 @@ class SiteExtensionInfo(ProxyOnlyResource): :param installer_command_line_params: Installer command line parameters. :type installer_command_line_params: str :param published_date_time: Published timestamp. - :type published_date_time: datetime + :type published_date_time: ~datetime.datetime :param download_count: Count of downloads. :type download_count: int - :param local_is_latest_version: true if the local version is - the latest version; false otherwise. + :param local_is_latest_version: :code:`true` if the local version is the latest + version; :code:`false` otherwise. :type local_is_latest_version: bool :param local_path: Local path. :type local_path: str :param installed_date_time: Installed timestamp. - :type installed_date_time: datetime + :type installed_date_time: ~datetime.datetime :param provisioning_state: Provisioning state. :type provisioning_state: str :param comment: Site Extension comment. @@ -10164,7 +11545,7 @@ class SiteExtensionInfo(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'extension_id': {'key': 'properties.extension_id', 'type': 'str'}, 'title': {'key': 'properties.title', 'type': 'str'}, - 'extension_type': {'key': 'properties.extension_type', 'type': 'SiteExtensionType'}, + 'extension_type': {'key': 'properties.extension_type', 'type': 'str'}, 'summary': {'key': 'properties.summary', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'str'}, @@ -10184,7 +11565,10 @@ class SiteExtensionInfo(ProxyOnlyResource): 'comment': {'key': 'properties.comment', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteExtensionInfo, self).__init__(**kwargs) self.extension_id = kwargs.get('extension_id', None) self.title = kwargs.get('title', None) @@ -10208,11 +11592,42 @@ def __init__(self, **kwargs): self.comment = kwargs.get('comment', None) +class SiteExtensionInfoCollection(msrest.serialization.Model): + """Collection of Kudu site extension information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteExtensionInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SiteExtensionInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class SiteInstance(ProxyOnlyResource): """Instance of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10241,12 +11656,15 @@ class SiteInstance(ProxyOnlyResource): 'site_instance_name': {'key': 'properties.siteInstanceName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteInstance, self).__init__(**kwargs) self.site_instance_name = None -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -10263,7 +11681,10 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = kwargs.get('max_percentage_cpu', None) self.max_memory_in_mb = kwargs.get('max_memory_in_mb', None) @@ -10273,8 +11694,7 @@ def __init__(self, **kwargs): class SiteLogsConfig(ProxyOnlyResource): """Configuration of App Service site logs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10285,16 +11705,13 @@ class SiteLogsConfig(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param application_logs: Application logs configuration. - :type application_logs: - ~azure.mgmt.web.v2019_08_01.models.ApplicationLogsConfig + :type application_logs: ~azure.mgmt.web.v2019_08_01.models.ApplicationLogsConfig :param http_logs: HTTP logs configuration. :type http_logs: ~azure.mgmt.web.v2019_08_01.models.HttpLogsConfig :param failed_requests_tracing: Failed requests tracing configuration. - :type failed_requests_tracing: - ~azure.mgmt.web.v2019_08_01.models.EnabledConfig + :type failed_requests_tracing: ~azure.mgmt.web.v2019_08_01.models.EnabledConfig :param detailed_error_messages: Detailed error messages configuration. - :type detailed_error_messages: - ~azure.mgmt.web.v2019_08_01.models.EnabledConfig + :type detailed_error_messages: ~azure.mgmt.web.v2019_08_01.models.EnabledConfig """ _validation = { @@ -10314,7 +11731,10 @@ class SiteLogsConfig(ProxyOnlyResource): 'detailed_error_messages': {'key': 'properties.detailedErrorMessages', 'type': 'EnabledConfig'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteLogsConfig, self).__init__(**kwargs) self.application_logs = kwargs.get('application_logs', None) self.http_logs = kwargs.get('http_logs', None) @@ -10322,7 +11742,7 @@ def __init__(self, **kwargs): self.detailed_error_messages = kwargs.get('detailed_error_messages', None) -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -10342,7 +11762,10 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = kwargs.get('validation', None) self.validation_key = kwargs.get('validation_key', None) @@ -10353,8 +11776,7 @@ def __init__(self, **kwargs): class SitePatchResource(ProxyOnlyResource): """ARM resource for a site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10364,125 +11786,107 @@ class SitePatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2019_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants except dataComponent. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants except dataComponent. Read- + only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2019_08_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2019_08_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2019_08_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param identity: - :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity """ _validation = { @@ -10514,13 +11918,14 @@ class SitePatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -10548,13 +11953,16 @@ class SitePatchResource(ProxyOnlyResource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SitePatchResource, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) self.state = None self.host_names = None self.repository_site_name = None @@ -10591,14 +11999,12 @@ def __init__(self, **kwargs): self.https_only = kwargs.get('https_only', None) self.redundancy_mode = kwargs.get('redundancy_mode', None) self.in_progress_operation_id = None - self.identity = kwargs.get('identity', None) class SitePhpErrorLogFlag(ProxyOnlyResource): """Used for getting PHP error logging flag. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10635,7 +12041,10 @@ class SitePhpErrorLogFlag(ProxyOnlyResource): 'master_log_errors_max_length': {'key': 'properties.masterLogErrorsMaxLength', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SitePhpErrorLogFlag, self).__init__(**kwargs) self.local_log_errors = kwargs.get('local_log_errors', None) self.master_log_errors = kwargs.get('master_log_errors', None) @@ -10643,12 +12052,12 @@ def __init__(self, **kwargs): self.master_log_errors_max_length = kwargs.get('master_log_errors_max_length', None) -class SiteSeal(Model): +class SiteSeal(msrest.serialization.Model): """Site seal. All required parameters must be populated in order to send to Azure. - :param html: Required. HTML snippet + :param html: Required. HTML snippet. :type html: str """ @@ -10660,16 +12069,19 @@ class SiteSeal(Model): 'html': {'key': 'html', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSeal, self).__init__(**kwargs) - self.html = kwargs.get('html', None) + self.html = kwargs['html'] -class SiteSealRequest(Model): +class SiteSealRequest(msrest.serialization.Model): """Site seal request. - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. + :param light_theme: If :code:`true` use the light color theme for site seal; + otherwise, use the default color theme. :type light_theme: bool :param locale: Locale of site seal. :type locale: str @@ -10680,7 +12092,10 @@ class SiteSealRequest(Model): 'locale': {'key': 'locale', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSealRequest, self).__init__(**kwargs) self.light_theme = kwargs.get('light_theme', None) self.locale = kwargs.get('locale', None) @@ -10689,8 +12104,7 @@ def __init__(self, **kwargs): class SiteSourceControl(ProxyOnlyResource): """Source control configuration for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10704,15 +12118,15 @@ class SiteSourceControl(ProxyOnlyResource): :type repo_url: str :param branch: Name of branch to use for deployment. :type branch: str - :param is_manual_integration: true to limit to manual - integration; false to enable continuous integration (which - configures webhooks into online repos like GitHub). + :param is_manual_integration: :code:`true` to limit to manual integration; + :code:`false` to enable continuous integration (which configures webhooks into + online repos like GitHub). :type is_manual_integration: bool - :param deployment_rollback_enabled: true to enable deployment - rollback; otherwise, false. + :param deployment_rollback_enabled: :code:`true` to enable deployment rollback; + otherwise, :code:`false`. :type deployment_rollback_enabled: bool - :param is_mercurial: true for a Mercurial repository; - false for a Git repository. + :param is_mercurial: :code:`true` for a Mercurial repository; + :code:`false` for a Git repository. :type is_mercurial: bool """ @@ -10734,7 +12148,10 @@ class SiteSourceControl(ProxyOnlyResource): 'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SiteSourceControl, self).__init__(**kwargs) self.repo_url = kwargs.get('repo_url', None) self.branch = kwargs.get('branch', None) @@ -10743,7 +12160,7 @@ def __init__(self, **kwargs): self.is_mercurial = kwargs.get('is_mercurial', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -10763,7 +12180,10 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs.get('minimum', None) self.maximum = kwargs.get('maximum', None) @@ -10771,7 +12191,7 @@ def __init__(self, **kwargs): self.scale_type = kwargs.get('scale_type', None) -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -10788,8 +12208,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2019_08_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2019_08_01.models.Capability] """ @@ -10804,7 +12223,10 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -10816,7 +12238,7 @@ def __init__(self, **kwargs): self.capabilities = kwargs.get('capabilities', None) -class SkuInfo(Model): +class SkuInfo(msrest.serialization.Model): """SKU discovery information. :param resource_type: Resource type that this SKU applies to. @@ -10833,21 +12255,55 @@ class SkuInfo(Model): 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuInfo, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.sku = kwargs.get('sku', None) self.capacity = kwargs.get('capacity', None) -class SkuInfos(Model): +class SkuInfoCollection(msrest.serialization.Model): + """Collection of SKU information. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SkuInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuInfoCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SkuInfos(msrest.serialization.Model): """Collection of SKU information. :param resource_type: Resource type that this SKU applies to. :type resource_type: str :param skus: List of SKUs the subscription is able to use. - :type skus: - list[~azure.mgmt.web.v2019_08_01.models.GlobalCsmSkuDescription] + :type skus: list[~azure.mgmt.web.v2019_08_01.models.GlobalCsmSkuDescription] """ _attribute_map = { @@ -10855,7 +12311,10 @@ class SkuInfos(Model): 'skus': {'key': 'skus', 'type': '[GlobalCsmSkuDescription]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuInfos, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.skus = kwargs.get('skus', None) @@ -10864,8 +12323,7 @@ def __init__(self, **kwargs): class SlotConfigNamesResource(ProxyOnlyResource): """Slot Config names azure resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10879,8 +12337,7 @@ class SlotConfigNamesResource(ProxyOnlyResource): :type connection_string_names: list[str] :param app_setting_names: List of application settings names. :type app_setting_names: list[str] - :param azure_storage_config_names: List of external Azure storage account - identifiers. + :param azure_storage_config_names: List of external Azure storage account identifiers. :type azure_storage_config_names: list[str] """ @@ -10900,7 +12357,10 @@ class SlotConfigNamesResource(ProxyOnlyResource): 'azure_storage_config_names': {'key': 'properties.azureStorageConfigNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotConfigNamesResource, self).__init__(**kwargs) self.connection_string_names = kwargs.get('connection_string_names', None) self.app_setting_names = kwargs.get('app_setting_names', None) @@ -10910,8 +12370,7 @@ def __init__(self, **kwargs): class SlotDifference(ProxyOnlyResource): """A setting difference between two deployment slots of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10923,11 +12382,9 @@ class SlotDifference(ProxyOnlyResource): :vartype type: str :ivar level: Level of the difference: Information, Warning or Error. :vartype level: str - :ivar setting_type: The type of the setting: General, AppSetting or - ConnectionString. + :ivar setting_type: The type of the setting: General, AppSetting or ConnectionString. :vartype setting_type: str - :ivar diff_rule: Rule that describes how to process the setting difference - during a slot swap. + :ivar diff_rule: Rule that describes how to process the setting difference during a slot swap. :vartype diff_rule: str :ivar setting_name: Name of the setting. :vartype setting_name: str @@ -10966,7 +12423,10 @@ class SlotDifference(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotDifference, self).__init__(**kwargs) self.level = None self.setting_type = None @@ -10977,18 +12437,48 @@ def __init__(self, **kwargs): self.description = None -class SlotSwapStatus(Model): +class SlotDifferenceCollection(msrest.serialization.Model): + """Collection of slot differences. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SlotDifference] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SlotDifference]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SlotDifferenceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -11004,14 +12494,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -11028,7 +12521,10 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = kwargs.get('time_taken', None) self.count = kwargs.get('count', None) @@ -11038,8 +12534,7 @@ def __init__(self, **kwargs): class Snapshot(ProxyOnlyResource): """A snapshot of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11068,21 +12563,56 @@ class Snapshot(ProxyOnlyResource): 'time': {'key': 'properties.time', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Snapshot, self).__init__(**kwargs) self.time = None -class SnapshotRecoverySource(Model): +class SnapshotCollection(msrest.serialization.Model): + """Collection of snapshots which can be used to revert an app to a previous time. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Snapshot] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SnapshotCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class SnapshotRecoverySource(msrest.serialization.Model): """Specifies the web app that snapshot contents will be retrieved from. - :param location: Geographical location of the source web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the source web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the source app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -11092,7 +12622,10 @@ class SnapshotRecoverySource(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRecoverySource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.id = kwargs.get('id', None) @@ -11101,10 +12634,7 @@ def __init__(self, **kwargs): class SnapshotRestoreRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11114,26 +12644,24 @@ class SnapshotRestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app restore should be - done, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app restore should be done, formatted as a + DateTime string. :type snapshot_time: str - :param recovery_source: Optional. Specifies the web app that snapshot - contents will be retrieved from. + :param recovery_source: Optional. Specifies the web app that snapshot contents will be + retrieved from. If empty, the targeted web app will be used as the source. - :type recovery_source: - ~azure.mgmt.web.v2019_08_01.models.SnapshotRecoverySource - :param overwrite: Required. If true the restore operation can - overwrite source app; otherwise, false. + :type recovery_source: ~azure.mgmt.web.v2019_08_01.models.SnapshotRecoverySource + :param overwrite: If :code:`true` the restore operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -11141,7 +12669,6 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -11157,7 +12684,10 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SnapshotRestoreRequest, self).__init__(**kwargs) self.snapshot_time = kwargs.get('snapshot_time', None) self.recovery_source = kwargs.get('recovery_source', None) @@ -11167,25 +12697,24 @@ def __init__(self, **kwargs): self.use_dr_secondary = kwargs.get('use_dr_secondary', None) -class Solution(Model): +class Solution(msrest.serialization.Model): """Class Representing Solution for problems detected. :param id: Solution Id. :type id: float - :param display_name: Display Name of the solution + :param display_name: Display Name of the solution. :type display_name: str :param order: Order of the solution. :type order: float - :param description: Description of the solution + :param description: Description of the solution. :type description: str - :param type: Type of Solution. Possible values include: 'QuickSolution', - 'DeepInvestigation', 'BestPractices' + :param type: Type of Solution. Possible values include: "QuickSolution", "DeepInvestigation", + "BestPractices". :type type: str or ~azure.mgmt.web.v2019_08_01.models.SolutionType :param data: Solution Data. :type data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] :param metadata: Solution Metadata. - :type metadata: - list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] + :type metadata: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] """ _attribute_map = { @@ -11193,12 +12722,15 @@ class Solution(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'float'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'SolutionType'}, + 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'data', 'type': '[[NameValuePair]]'}, 'metadata': {'key': 'metadata', 'type': '[[NameValuePair]]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Solution, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.display_name = kwargs.get('display_name', None) @@ -11212,8 +12744,7 @@ def __init__(self, **kwargs): class SourceControl(ProxyOnlyResource): """The source control OAuth token. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11230,7 +12761,7 @@ class SourceControl(ProxyOnlyResource): :param refresh_token: OAuth refresh token. :type refresh_token: str :param expiration_time: OAuth token expiration. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime """ _validation = { @@ -11250,7 +12781,10 @@ class SourceControl(ProxyOnlyResource): 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SourceControl, self).__init__(**kwargs) self.token = kwargs.get('token', None) self.token_secret = kwargs.get('token_secret', None) @@ -11258,30 +12792,61 @@ def __init__(self, **kwargs): self.expiration_time = kwargs.get('expiration_time', None) -class StackMajorVersion(Model): +class SourceControlCollection(msrest.serialization.Model): + """Collection of source controls. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SourceControlCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class StackMajorVersion(msrest.serialization.Model): """Application stack major version. :param display_version: Application stack major version (display only). :type display_version: str :param runtime_version: Application stack major version (runtime only). :type runtime_version: str - :param is_default: true if this is the default major version; - otherwise, false. + :param is_default: :code:`true` if this is the default major version; otherwise, + :code:`false`. :type is_default: bool :param minor_versions: Minor versions associated with the major version. - :type minor_versions: - list[~azure.mgmt.web.v2019_08_01.models.StackMinorVersion] - :param application_insights: true if this supports - Application Insights; otherwise, false. + :type minor_versions: list[~azure.mgmt.web.v2019_08_01.models.StackMinorVersion] + :param application_insights: :code:`true` if this supports Application Insights; + otherwise, :code:`false`. :type application_insights: bool - :param is_preview: true if this stack is in Preview, - otherwise false. + :param is_preview: :code:`true` if this stack is in Preview, otherwise + :code:`false`. :type is_preview: bool - :param is_deprecated: true if this stack has been deprecated, - otherwise false. + :param is_deprecated: :code:`true` if this stack has been deprecated, otherwise + :code:`false`. :type is_deprecated: bool - :param is_hidden: true if this stack should be hidden for new - customers on portal, otherwise false. + :param is_hidden: :code:`true` if this stack should be hidden for new customers on + portal, otherwise :code:`false`. :type is_hidden: bool """ @@ -11296,7 +12861,10 @@ class StackMajorVersion(Model): 'is_hidden': {'key': 'isHidden', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StackMajorVersion, self).__init__(**kwargs) self.display_version = kwargs.get('display_version', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -11308,18 +12876,18 @@ def __init__(self, **kwargs): self.is_hidden = kwargs.get('is_hidden', None) -class StackMinorVersion(Model): +class StackMinorVersion(msrest.serialization.Model): """Application stack minor version. :param display_version: Application stack minor version (display only). :type display_version: str :param runtime_version: Application stack minor version (runtime only). :type runtime_version: str - :param is_default: true if this is the default minor version; - otherwise, false. + :param is_default: :code:`true` if this is the default minor version; otherwise, + :code:`false`. :type is_default: bool - :param is_remote_debugging_enabled: true if this supports - Remote Debugging, otherwise false. + :param is_remote_debugging_enabled: :code:`true` if this supports Remote + Debugging, otherwise :code:`false`. :type is_remote_debugging_enabled: bool """ @@ -11330,7 +12898,10 @@ class StackMinorVersion(Model): 'is_remote_debugging_enabled': {'key': 'isRemoteDebuggingEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StackMinorVersion, self).__init__(**kwargs) self.display_version = kwargs.get('display_version', None) self.runtime_version = kwargs.get('runtime_version', None) @@ -11338,42 +12909,37 @@ def __init__(self, **kwargs): self.is_remote_debugging_enabled = kwargs.get('is_remote_debugging_enabled', None) -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3', 'NestedSmall', 'Default' - :type worker_size: str or - ~azure.mgmt.web.v2019_08_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Small", "Medium", "Large", + "D1", "D2", "D3", "NestedSmall", "Default". + :type worker_size: str or ~azure.mgmt.web.v2019_08_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str - :param is_linux: Is this a linux stamp capacity + :param is_linux: Is this a linux stamp capacity. :type is_linux: bool """ @@ -11382,8 +12948,8 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, @@ -11391,7 +12957,10 @@ class StampCapacity(Model): 'is_linux': {'key': 'isLinux', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.available_capacity = kwargs.get('available_capacity', None) @@ -11406,11 +12975,42 @@ def __init__(self, **kwargs): self.is_linux = kwargs.get('is_linux', None) +class StampCapacityCollection(msrest.serialization.Model): + """Collection of stamp capacities. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StampCapacity]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StampCapacityCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class StaticSiteARMResource(Resource): """Static Site ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -11424,10 +13024,11 @@ class StaticSiteARMResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :ivar default_hostname: The default autogenerated hostname for the static - site. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :ivar default_hostname: The default autogenerated hostname for the static site. :vartype default_hostname: str :param repository_url: URL for the repository of the static site. :type repository_url: str @@ -11435,14 +13036,11 @@ class StaticSiteARMResource(Resource): :type branch: str :ivar custom_domains: The custom domains associated with this static site. :vartype custom_domains: list[str] - :param repository_token: A user's github repository token. This is used to - setup the Github Actions workflow file and API secrets. + :param repository_token: A user's github repository token. This is used to setup the Github + Actions workflow file and API secrets. :type repository_token: str :param build_properties: Build properties to configure on the repository. - :type build_properties: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties - :param sku: - :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :type build_properties: ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties """ _validation = { @@ -11461,31 +13059,33 @@ class StaticSiteARMResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'default_hostname': {'key': 'properties.defaultHostname', 'type': 'str'}, 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, 'branch': {'key': 'properties.branch', 'type': 'str'}, 'custom_domains': {'key': 'properties.customDomains', 'type': '[str]'}, 'repository_token': {'key': 'properties.repositoryToken', 'type': 'str'}, 'build_properties': {'key': 'properties.buildProperties', 'type': 'StaticSiteBuildProperties'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteARMResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.default_hostname = None self.repository_url = kwargs.get('repository_url', None) self.branch = kwargs.get('branch', None) self.custom_domains = None self.repository_token = kwargs.get('repository_token', None) self.build_properties = kwargs.get('build_properties', None) - self.sku = kwargs.get('sku', None) class StaticSiteBuildARMResource(ProxyOnlyResource): """Static Site Build ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11499,18 +13099,16 @@ class StaticSiteBuildARMResource(ProxyOnlyResource): :vartype build_id: str :ivar source_branch: The source branch. :vartype source_branch: str - :ivar pull_request_title: The title of a pull request that a static site - build is related to. + :ivar pull_request_title: The title of a pull request that a static site build is related to. :vartype pull_request_title: str :ivar hostname: The hostname for a static site build. :vartype hostname: str :ivar created_time_utc: When this build was created. - :vartype created_time_utc: datetime + :vartype created_time_utc: ~datetime.datetime :ivar last_updated_on: When this build was updated. - :vartype last_updated_on: datetime - :ivar status: The status of the static site build. Possible values - include: 'WaitingForDeployment', 'Uploading', 'Deploying', 'Ready', - 'Failed', 'Deleting', 'Detached' + :vartype last_updated_on: ~datetime.datetime + :ivar status: The status of the static site build. Possible values include: + "WaitingForDeployment", "Uploading", "Deploying", "Ready", "Failed", "Deleting", "Detached". :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.BuildStatus """ @@ -11541,7 +13139,10 @@ class StaticSiteBuildARMResource(ProxyOnlyResource): 'status': {'key': 'properties.status', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteBuildARMResource, self).__init__(**kwargs) self.build_id = None self.source_branch = None @@ -11552,15 +13153,46 @@ def __init__(self, **kwargs): self.status = None -class StaticSiteBuildProperties(Model): +class StaticSiteBuildCollection(msrest.serialization.Model): + """Collection of static site builds. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteBuildARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StaticSiteBuildCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class StaticSiteBuildProperties(msrest.serialization.Model): """Build properties for the static site. :param app_location: The path to the app code within the repository. :type app_location: str :param api_location: The path to the api code within the repository. :type api_location: str - :param app_artifact_location: The path of the app artifacts after - building. + :param app_artifact_location: The path of the app artifacts after building. :type app_artifact_location: str """ @@ -11570,18 +13202,52 @@ class StaticSiteBuildProperties(Model): 'app_artifact_location': {'key': 'appArtifactLocation', 'type': 'str'}, } - def __init__(self, **kwargs): - super(StaticSiteBuildProperties, self).__init__(**kwargs) - self.app_location = kwargs.get('app_location', None) - self.api_location = kwargs.get('api_location', None) - self.app_artifact_location = kwargs.get('app_artifact_location', None) + def __init__( + self, + **kwargs + ): + super(StaticSiteBuildProperties, self).__init__(**kwargs) + self.app_location = kwargs.get('app_location', None) + self.api_location = kwargs.get('api_location', None) + self.app_artifact_location = kwargs.get('app_artifact_location', None) + + +class StaticSiteCollection(msrest.serialization.Model): + """Collection of static sites. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StaticSiteCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None class StaticSiteCustomDomainOverviewARMResource(ProxyOnlyResource): """Static Site Custom Domain Overview ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11593,9 +13259,8 @@ class StaticSiteCustomDomainOverviewARMResource(ProxyOnlyResource): :vartype type: str :ivar domain_name: The domain name for the static site custom domain. :vartype domain_name: str - :ivar created_on: The date and time on which the custom domain was created - for the static site. - :vartype created_on: datetime + :ivar created_on: The date and time on which the custom domain was created for the static site. + :vartype created_on: ~datetime.datetime """ _validation = { @@ -11615,17 +13280,51 @@ class StaticSiteCustomDomainOverviewARMResource(ProxyOnlyResource): 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteCustomDomainOverviewARMResource, self).__init__(**kwargs) self.domain_name = None self.created_on = None +class StaticSiteCustomDomainOverviewCollection(msrest.serialization.Model): + """Collection of static site custom domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteCustomDomainOverviewARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StaticSiteCustomDomainOverviewCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class StaticSiteFunctionOverviewARMResource(ProxyOnlyResource): """Static Site Function Overview ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11635,12 +13334,11 @@ class StaticSiteFunctionOverviewARMResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar function_name: The name for the function + :ivar function_name: The name for the function. :vartype function_name: str - :ivar trigger_type: The trigger type of the function. Possible values - include: 'HttpTrigger', 'Unknown' - :vartype trigger_type: str or - ~azure.mgmt.web.v2019_08_01.models.TriggerTypes + :ivar trigger_type: The trigger type of the function. Possible values include: "HttpTrigger", + "Unknown". + :vartype trigger_type: str or ~azure.mgmt.web.v2019_08_01.models.TriggerTypes """ _validation = { @@ -11660,17 +13358,51 @@ class StaticSiteFunctionOverviewARMResource(ProxyOnlyResource): 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteFunctionOverviewARMResource, self).__init__(**kwargs) self.function_name = None self.trigger_type = None +class StaticSiteFunctionOverviewCollection(msrest.serialization.Model): + """Collection of static site functions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteFunctionOverviewARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StaticSiteFunctionOverviewCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class StaticSitePatchResource(ProxyOnlyResource): """ARM resource for a static site when patching. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11680,8 +13412,7 @@ class StaticSitePatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar default_hostname: The default autogenerated hostname for the static - site. + :ivar default_hostname: The default autogenerated hostname for the static site. :vartype default_hostname: str :param repository_url: URL for the repository of the static site. :type repository_url: str @@ -11689,12 +13420,11 @@ class StaticSitePatchResource(ProxyOnlyResource): :type branch: str :ivar custom_domains: The custom domains associated with this static site. :vartype custom_domains: list[str] - :param repository_token: A user's github repository token. This is used to - setup the Github Actions workflow file and API secrets. + :param repository_token: A user's github repository token. This is used to setup the Github + Actions workflow file and API secrets. :type repository_token: str :param build_properties: Build properties to configure on the repository. - :type build_properties: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties + :type build_properties: ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties """ _validation = { @@ -11718,7 +13448,10 @@ class StaticSitePatchResource(ProxyOnlyResource): 'build_properties': {'key': 'properties.buildProperties', 'type': 'StaticSiteBuildProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSitePatchResource, self).__init__(**kwargs) self.default_hostname = None self.repository_url = kwargs.get('repository_url', None) @@ -11731,8 +13464,7 @@ def __init__(self, **kwargs): class StaticSiteResetPropertiesARMResource(ProxyOnlyResource): """Static Site Reset Properties ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11742,11 +13474,10 @@ class StaticSiteResetPropertiesARMResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param repository_token: The token which proves admin privileges to the - repository. + :param repository_token: The token which proves admin privileges to the repository. :type repository_token: str - :param should_update_repository: Determines whether the repository should - be updated with the new properties. + :param should_update_repository: Determines whether the repository should be updated with the + new properties. :type should_update_repository: bool """ @@ -11765,7 +13496,10 @@ class StaticSiteResetPropertiesARMResource(ProxyOnlyResource): 'should_update_repository': {'key': 'properties.shouldUpdateRepository', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteResetPropertiesARMResource, self).__init__(**kwargs) self.repository_token = kwargs.get('repository_token', None) self.should_update_repository = kwargs.get('should_update_repository', None) @@ -11774,8 +13508,7 @@ def __init__(self, **kwargs): class StaticSiteUserARMResource(ProxyOnlyResource): """Static Site User ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11791,8 +13524,7 @@ class StaticSiteUserARMResource(ProxyOnlyResource): :vartype user_id: str :ivar display_name: The display name for the static site user. :vartype display_name: str - :param roles: The roles for the static site user, in free-form string - format + :param roles: The roles for the static site user, in free-form string format. :type roles: str """ @@ -11816,7 +13548,10 @@ class StaticSiteUserARMResource(ProxyOnlyResource): 'roles': {'key': 'properties.roles', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteUserARMResource, self).__init__(**kwargs) self.provider = None self.user_id = None @@ -11824,11 +13559,42 @@ def __init__(self, **kwargs): self.roles = kwargs.get('roles', None) +class StaticSiteUserCollection(msrest.serialization.Model): + """Collection of static site custom users. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteUserARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StaticSiteUserCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class StaticSiteUserInvitationRequestResource(ProxyOnlyResource): """Static sites user roles invitation resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11844,11 +13610,9 @@ class StaticSiteUserInvitationRequestResource(ProxyOnlyResource): :type provider: str :param user_details: The user id for the static site user. :type user_details: str - :param roles: The roles for the static site user, in free-form string - format + :param roles: The roles for the static site user, in free-form string format. :type roles: str - :param num_hours_to_expiration: The number of hours the sas token stays - valid + :param num_hours_to_expiration: The number of hours the sas token stays valid. :type num_hours_to_expiration: int """ @@ -11870,7 +13634,10 @@ class StaticSiteUserInvitationRequestResource(ProxyOnlyResource): 'num_hours_to_expiration': {'key': 'properties.numHoursToExpiration', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteUserInvitationRequestResource, self).__init__(**kwargs) self.domain = kwargs.get('domain', None) self.provider = kwargs.get('provider', None) @@ -11882,8 +13649,7 @@ def __init__(self, **kwargs): class StaticSiteUserInvitationResponseResource(ProxyOnlyResource): """Static sites user roles invitation link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11893,9 +13659,9 @@ class StaticSiteUserInvitationResponseResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar expires_on: The expiration time of the invitation - :vartype expires_on: datetime - :ivar invitation_url: The url for the invitation link + :ivar expires_on: The expiration time of the invitation. + :vartype expires_on: ~datetime.datetime + :ivar invitation_url: The url for the invitation link. :vartype invitation_url: str """ @@ -11916,13 +13682,16 @@ class StaticSiteUserInvitationResponseResource(ProxyOnlyResource): 'invitation_url': {'key': 'properties.invitationUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StaticSiteUserInvitationResponseResource, self).__init__(**kwargs) self.expires_on = None self.invitation_url = None -class StatusCodesBasedTrigger(Model): +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -11945,7 +13714,10 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.sub_status = kwargs.get('sub_status', None) @@ -11957,10 +13729,7 @@ def __init__(self, **kwargs): class StorageMigrationOptions(ProxyOnlyResource): """Options for app content migration. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11970,17 +13739,15 @@ class StorageMigrationOptions(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param azurefiles_connection_string: Required. AzureFiles connection - string. + :param azurefiles_connection_string: AzureFiles connection string. :type azurefiles_connection_string: str - :param azurefiles_share: Required. AzureFiles share. + :param azurefiles_share: AzureFiles share. :type azurefiles_share: str - :param switch_site_after_migration: trueif the app should be - switched over; otherwise, false. Default value: False . + :param switch_site_after_migration: :code:`true`if the app should be switched + over; otherwise, :code:`false`. :type switch_site_after_migration: bool - :param block_write_access_to_site: true if the app should be - read only during copy operation; otherwise, false. Default - value: False . + :param block_write_access_to_site: :code:`true` if the app should be read only + during copy operation; otherwise, :code:`false`. :type block_write_access_to_site: bool """ @@ -11988,8 +13755,6 @@ class StorageMigrationOptions(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'azurefiles_connection_string': {'required': True}, - 'azurefiles_share': {'required': True}, } _attribute_map = { @@ -12003,7 +13768,10 @@ class StorageMigrationOptions(ProxyOnlyResource): 'block_write_access_to_site': {'key': 'properties.blockWriteAccessToSite', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageMigrationOptions, self).__init__(**kwargs) self.azurefiles_connection_string = kwargs.get('azurefiles_connection_string', None) self.azurefiles_share = kwargs.get('azurefiles_share', None) @@ -12014,8 +13782,7 @@ def __init__(self, **kwargs): class StorageMigrationResponse(ProxyOnlyResource): """Response for a migration of app content request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12025,8 +13792,8 @@ class StorageMigrationResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the migration process, it will - return an operation ID identifying that particular migration operation. + :ivar operation_id: When server starts the migration process, it will return an operation ID + identifying that particular migration operation. :vartype operation_id: str """ @@ -12045,7 +13812,10 @@ class StorageMigrationResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageMigrationResponse, self).__init__(**kwargs) self.operation_id = None @@ -12053,8 +13823,7 @@ def __init__(self, **kwargs): class StringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12082,17 +13851,18 @@ class StringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringDictionary, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) class SwiftVirtualNetwork(ProxyOnlyResource): - """Swift Virtual Network Contract. This is used to enable the new Swift way of - doing virtual network integration. + """Swift Virtual Network Contract. This is used to enable the new Swift way of doing virtual network integration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12102,12 +13872,12 @@ class SwiftVirtualNetwork(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param subnet_resource_id: The Virtual Network subnet's resource ID. This - is the subnet that this Web App will join. This subnet must have a - delegation to Microsoft.Web/serverFarms defined first. + :param subnet_resource_id: The Virtual Network subnet's resource ID. This is the subnet that + this Web App will join. This subnet must have a delegation to Microsoft.Web/serverFarms defined + first. :type subnet_resource_id: str - :param swift_supported: A flag that specifies if the scale unit this Web - App is on supports Swift integration. + :param swift_supported: A flag that specifies if the scale unit this Web App is on supports + Swift integration. :type swift_supported: bool """ @@ -12126,13 +13896,16 @@ class SwiftVirtualNetwork(ProxyOnlyResource): 'swift_supported': {'key': 'properties.swiftSupported', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SwiftVirtualNetwork, self).__init__(**kwargs) self.subnet_resource_id = kwargs.get('subnet_resource_id', None) self.swift_supported = kwargs.get('swift_supported', None) -class TldLegalAgreement(Model): +class TldLegalAgreement(msrest.serialization.Model): """Legal agreement for a top level domain. All required parameters must be populated in order to send to Azure. @@ -12160,19 +13933,53 @@ class TldLegalAgreement(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TldLegalAgreement, self).__init__(**kwargs) - self.agreement_key = kwargs.get('agreement_key', None) - self.title = kwargs.get('title', None) - self.content = kwargs.get('content', None) + self.agreement_key = kwargs['agreement_key'] + self.title = kwargs['title'] + self.content = kwargs['content'] self.url = kwargs.get('url', None) +class TldLegalAgreementCollection(msrest.serialization.Model): + """Collection of top-level domain legal agreements. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TldLegalAgreement] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TldLegalAgreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TldLegalAgreementCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TopLevelDomain(ProxyOnlyResource): """A top level domain object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12182,8 +13989,8 @@ class TopLevelDomain(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param privacy: If true, then the top level domain supports - domain privacy; otherwise, false. + :param privacy: If :code:`true`, then the top level domain supports domain + privacy; otherwise, :code:`false`. :type privacy: bool """ @@ -12201,21 +14008,22 @@ class TopLevelDomain(ProxyOnlyResource): 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopLevelDomain, self).__init__(**kwargs) self.privacy = kwargs.get('privacy', None) -class TopLevelDomainAgreementOption(Model): +class TopLevelDomainAgreementOption(msrest.serialization.Model): """Options for retrieving the list of top level domain legal agreements. - :param include_privacy: If true, then the list of agreements - will include agreements for domain privacy as well; otherwise, - false. + :param include_privacy: If :code:`true`, then the list of agreements will include + agreements for domain privacy as well; otherwise, :code:`false`. :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. + :param for_transfer: If :code:`true`, then the list of agreements will include + agreements for domain transfer as well; otherwise, :code:`false`. :type for_transfer: bool """ @@ -12224,18 +14032,51 @@ class TopLevelDomainAgreementOption(Model): 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopLevelDomainAgreementOption, self).__init__(**kwargs) self.include_privacy = kwargs.get('include_privacy', None) self.for_transfer = kwargs.get('for_transfer', None) +class TopLevelDomainCollection(msrest.serialization.Model): + """Collection of Top-level domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TopLevelDomain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopLevelDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TopLevelDomainCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TriggeredJobHistory(ProxyOnlyResource): - """Triggered Web Job History. List of Triggered Web Job Run Information - elements. + """Triggered Web Job History. List of Triggered Web Job Run Information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12263,16 +14104,50 @@ class TriggeredJobHistory(ProxyOnlyResource): 'runs': {'key': 'properties.runs', 'type': '[TriggeredJobRun]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredJobHistory, self).__init__(**kwargs) self.runs = kwargs.get('runs', None) +class TriggeredJobHistoryCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredJobHistory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TriggeredJobHistoryCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class TriggeredJobRun(ProxyOnlyResource): """Triggered Web Job Run Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12286,14 +14161,12 @@ class TriggeredJobRun(ProxyOnlyResource): :type web_job_id: str :param web_job_name: Job name. :type web_job_name: str - :param status: Job status. Possible values include: 'Success', 'Failed', - 'Error' - :type status: str or - ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobStatus + :param status: Job status. Possible values include: "Success", "Failed", "Error". + :type status: str or ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobStatus :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime + :type end_time: ~datetime.datetime :param duration: Job duration. :type duration: str :param output_url: Output URL. @@ -12321,7 +14194,7 @@ class TriggeredJobRun(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'web_job_id': {'key': 'properties.web_job_id', 'type': 'str'}, 'web_job_name': {'key': 'properties.web_job_name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TriggeredWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'start_time': {'key': 'properties.start_time', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.end_time', 'type': 'iso-8601'}, 'duration': {'key': 'properties.duration', 'type': 'str'}, @@ -12332,7 +14205,10 @@ class TriggeredJobRun(ProxyOnlyResource): 'trigger': {'key': 'properties.trigger', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredJobRun, self).__init__(**kwargs) self.web_job_id = kwargs.get('web_job_id', None) self.web_job_name = kwargs.get('web_job_name', None) @@ -12350,8 +14226,7 @@ def __init__(self, **kwargs): class TriggeredWebJob(ProxyOnlyResource): """Triggered Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12373,12 +14248,11 @@ class TriggeredWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2019_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -12401,13 +14275,16 @@ class TriggeredWebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggeredWebJob, self).__init__(**kwargs) self.latest_run = kwargs.get('latest_run', None) self.history_url = kwargs.get('history_url', None) @@ -12421,11 +14298,42 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) +class TriggeredWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TriggeredWebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class Usage(ProxyOnlyResource): """Usage of the quota resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12446,11 +14354,10 @@ class Usage(ProxyOnlyResource): :ivar limit: The resource limit. :vartype limit: long :ivar next_reset_time: Next reset time for the resource counter. - :vartype next_reset_time: datetime - :ivar compute_mode: Compute mode used for this usage. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :vartype compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :vartype next_reset_time: ~datetime.datetime + :ivar compute_mode: Compute mode used for this usage. Possible values include: "Shared", + "Dedicated", "Dynamic". + :vartype compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions :ivar site_mode: Site mode used for this usage. :vartype site_mode: str """ @@ -12480,11 +14387,14 @@ class Usage(ProxyOnlyResource): 'current_value': {'key': 'properties.currentValue', 'type': 'long'}, 'limit': {'key': 'properties.limit', 'type': 'long'}, 'next_reset_time': {'key': 'properties.nextResetTime', 'type': 'iso-8601'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'site_mode': {'key': 'properties.siteMode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Usage, self).__init__(**kwargs) self.display_name = None self.resource_name = None @@ -12496,14 +14406,43 @@ def __init__(self, **kwargs): self.site_mode = None -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class UsageCollection(msrest.serialization.Model): + """Collection of usages. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Usage] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UsageCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class User(ProxyOnlyResource): + """User credentials used for publishing activity. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -12512,14 +14451,13 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str :param scm_uri: Url of SCM site. :type scm_uri: str @@ -12529,7 +14467,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -12544,7 +14481,10 @@ class User(ProxyOnlyResource): 'scm_uri': {'key': 'properties.scmUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(User, self).__init__(**kwargs) self.publishing_user_name = kwargs.get('publishing_user_name', None) self.publishing_password = kwargs.get('publishing_password', None) @@ -12553,51 +14493,47 @@ def __init__(self, **kwargs): self.scm_uri = kwargs.get('scm_uri', None) -class ValidateRequest(Model): +class ValidateRequest(msrest.serialization.Model): """Resource validation request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'ServerFarm', 'Site' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.ValidateResourceTypes + :param type: Required. Resource type used for verification. Possible values include: + "ServerFarm", "Site". + :type type: str or ~azure.mgmt.web.v2019_08_01.models.ValidateResourceTypes :param location: Required. Expected location of the resource. :type location: str - :param server_farm_id: ARM resource ID of an App Service plan that would - host the app. + :param server_farm_id: ARM resource ID of an App Service plan that would host the app. :type server_farm_id: str :param sku_name: Name of the target SKU for the App Service plan. :type sku_name: str - :param need_linux_workers: true if App Service plan is for - Linux workers; otherwise, false. + :param need_linux_workers: :code:`true` if App Service plan is for Linux workers; + otherwise, :code:`false`. :type need_linux_workers: bool - :param is_spot: true if App Service plan is for Spot - instances; otherwise, false. + :param is_spot: :code:`true` if App Service plan is for Spot instances; otherwise, + :code:`false`. :type is_spot: bool :param capacity: Target capacity of the App Service plan (number of VMs). :type capacity: int - :param hosting_environment: Name of App Service Environment where app or - App Service plan should be created. + :param hosting_environment: Name of App Service Environment where app or App Service plan + should be created. :type hosting_environment: str - :param is_xenon: true if App Service plan is running as a - windows container + :param is_xenon: :code:`true` if App Service plan is running as a windows + container. :type is_xenon: bool - :param container_registry_base_url: Base URL of the container registry + :param container_registry_base_url: Base URL of the container registry. :type container_registry_base_url: str - :param container_registry_username: Username for to access the container - registry + :param container_registry_username: Username for to access the container registry. :type container_registry_username: str - :param container_registry_password: Password for to access the container - registry + :param container_registry_password: Password for to access the container registry. :type container_registry_password: str - :param container_image_repository: Repository name (image name) + :param container_image_repository: Repository name (image name). :type container_image_repository: str - :param container_image_tag: Image tag + :param container_image_tag: Image tag. :type container_image_tag: str - :param container_image_platform: Platform (windows or linux) + :param container_image_platform: Platform (windows or linux). :type container_image_platform: str """ @@ -12627,11 +14563,14 @@ class ValidateRequest(Model): 'container_image_platform': {'key': 'properties.containerImagePlatform', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.location = kwargs.get('location', None) + self.name = kwargs['name'] + self.type = kwargs['type'] + self.location = kwargs['location'] self.server_farm_id = kwargs.get('server_farm_id', None) self.sku_name = kwargs.get('sku_name', None) self.need_linux_workers = kwargs.get('need_linux_workers', None) @@ -12647,7 +14586,7 @@ def __init__(self, **kwargs): self.container_image_platform = kwargs.get('container_image_platform', None) -class ValidateResponse(Model): +class ValidateResponse(msrest.serialization.Model): """Describes the result of resource validation. :param status: Result of validation. @@ -12661,13 +14600,16 @@ class ValidateResponse(Model): 'error': {'key': 'error', 'type': 'ValidateResponseError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateResponse, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.error = kwargs.get('error', None) -class ValidateResponseError(Model): +class ValidateResponseError(msrest.serialization.Model): """Error details for when validation fails. :param code: Validation error code. @@ -12681,25 +14623,27 @@ class ValidateResponseError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ValidateResponseError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2019_08_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2019_08_01.models.VirtualDirectory] """ _attribute_map = { @@ -12709,7 +14653,10 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) @@ -12717,7 +14664,7 @@ def __init__(self, **kwargs): self.virtual_directories = kwargs.get('virtual_directories', None) -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -12731,13 +14678,16 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = kwargs.get('virtual_path', None) self.physical_path = kwargs.get('physical_path', None) -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -12748,7 +14698,7 @@ class VirtualIPMapping(Model): :type internal_https_port: int :param in_use: Is virtual IP mapping in use. :type in_use: bool - :param service_name: name of the service that virtual IP is assigned to + :param service_name: name of the service that virtual IP is assigned to. :type service_name: str """ @@ -12760,7 +14710,10 @@ class VirtualIPMapping(Model): 'service_name': {'key': 'serviceName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = kwargs.get('virtual_ip', None) self.internal_http_port = kwargs.get('internal_http_port', None) @@ -12769,11 +14722,10 @@ def __init__(self, **kwargs): self.service_name = kwargs.get('service_name', None) -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -12797,7 +14749,10 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None @@ -12806,13 +14761,9 @@ def __init__(self, **kwargs): class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12824,8 +14775,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -12833,7 +14783,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -12845,7 +14794,10 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetGateway, self).__init__(**kwargs) self.vnet_name = kwargs.get('vnet_name', None) self.vpn_package_uri = kwargs.get('vpn_package_uri', None) @@ -12854,8 +14806,7 @@ def __init__(self, **kwargs): class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12869,19 +14820,19 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: str :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str - :param is_swift: Flag that is used to denote if this is VNET injection + :param is_swift: Flag that is used to denote if this is VNET injection. :type is_swift: bool """ @@ -12908,7 +14859,10 @@ class VnetInfo(ProxyOnlyResource): 'is_swift': {'key': 'properties.isSwift', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetInfo, self).__init__(**kwargs) self.vnet_resource_id = kwargs.get('vnet_resource_id', None) self.cert_thumbprint = None @@ -12922,8 +14876,7 @@ def __init__(self, **kwargs): class VnetParameters(ProxyOnlyResource): """The required set of inputs to validate a VNET. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12933,11 +14886,11 @@ class VnetParameters(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_resource_group: The Resource Group of the VNET to be validated + :param vnet_resource_group: The Resource Group of the VNET to be validated. :type vnet_resource_group: str - :param vnet_name: The name of the VNET to be validated + :param vnet_name: The name of the VNET to be validated. :type vnet_name: str - :param vnet_subnet_name: The subnet name to be validated + :param vnet_subnet_name: The subnet name to be validated. :type vnet_subnet_name: str """ @@ -12957,7 +14910,10 @@ class VnetParameters(ProxyOnlyResource): 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetParameters, self).__init__(**kwargs) self.vnet_resource_group = kwargs.get('vnet_resource_group', None) self.vnet_name = kwargs.get('vnet_name', None) @@ -12965,11 +14921,9 @@ def __init__(self, **kwargs): class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12979,20 +14933,19 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2019_08_01.models.RouteType """ @@ -13012,7 +14965,10 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetRoute, self).__init__(**kwargs) self.start_address = kwargs.get('start_address', None) self.end_address = kwargs.get('end_address', None) @@ -13022,8 +14978,7 @@ def __init__(self, **kwargs): class VnetValidationFailureDetails(ProxyOnlyResource): """A class that describes the reason for a validation failure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13036,8 +14991,7 @@ class VnetValidationFailureDetails(ProxyOnlyResource): :param failed: A flag describing whether or not validation failed. :type failed: bool :param failed_tests: A list of tests that failed in the validation. - :type failed_tests: - list[~azure.mgmt.web.v2019_08_01.models.VnetValidationTestFailure] + :type failed_tests: list[~azure.mgmt.web.v2019_08_01.models.VnetValidationTestFailure] """ _validation = { @@ -13055,7 +15009,10 @@ class VnetValidationFailureDetails(ProxyOnlyResource): 'failed_tests': {'key': 'properties.failedTests', 'type': '[VnetValidationTestFailure]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetValidationFailureDetails, self).__init__(**kwargs) self.failed = kwargs.get('failed', None) self.failed_tests = kwargs.get('failed_tests', None) @@ -13064,8 +15021,7 @@ def __init__(self, **kwargs): class VnetValidationTestFailure(ProxyOnlyResource): """A class that describes a test that failed during NSG and UDR validation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13077,8 +15033,7 @@ class VnetValidationTestFailure(ProxyOnlyResource): :vartype type: str :param test_name: The name of the test that failed. :type test_name: str - :param details: The details of what caused the failure, e.g. the blocking - rule name, etc. + :param details: The details of what caused the failure, e.g. the blocking rule name, etc. :type details: str """ @@ -13097,17 +15052,19 @@ class VnetValidationTestFailure(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VnetValidationTestFailure, self).__init__(**kwargs) self.test_name = kwargs.get('test_name', None) self.details = kwargs.get('details', None) -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -13127,17 +15084,51 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] + self.next_link = None + + +class WebAppInstanceCollection(msrest.serialization.Model): + """Collection of app instances. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteInstance] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebAppInstanceCollection, self).__init__(**kwargs) + self.value = kwargs['value'] self.next_link = None class WebJob(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13153,12 +15144,11 @@ class WebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2019_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -13178,13 +15168,16 @@ class WebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebJob, self).__init__(**kwargs) self.run_command = kwargs.get('run_command', None) self.url = kwargs.get('url', None) @@ -13195,11 +15188,42 @@ def __init__(self, **kwargs): self.settings = kwargs.get('settings', None) +class WebJobCollection(msrest.serialization.Model): + """Collection of Kudu web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.WebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebJobCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class WebSiteInstanceStatus(ProxyOnlyResource): """WebSiteInstanceStatus. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13209,17 +15233,16 @@ class WebSiteInstanceStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param state: Possible values include: 'READY', 'STOPPED', 'UNKNOWN' + :param state: Possible values include: "READY", "STOPPED", "UNKNOWN". :type state: str or ~azure.mgmt.web.v2019_08_01.models.SiteRuntimeState - :param status_url: Link to the GetStatusApi in Kudu + :param status_url: Link to the GetStatusApi in Kudu. :type status_url: str - :param detector_url: Link to the Diagnose and Solve Portal + :param detector_url: Link to the Diagnose and Solve Portal. :type detector_url: str - :param console_url: Link to the Diagnose and Solve Portal + :param console_url: Link to the Diagnose and Solve Portal. :type console_url: str - :param containers: - :type containers: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ContainerInfo] + :param containers: Dictionary of :code:``. + :type containers: dict[str, ~azure.mgmt.web.v2019_08_01.models.ContainerInfo] """ _validation = { @@ -13233,14 +15256,17 @@ class WebSiteInstanceStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'SiteRuntimeState'}, + 'state': {'key': 'properties.state', 'type': 'str'}, 'status_url': {'key': 'properties.statusUrl', 'type': 'str'}, 'detector_url': {'key': 'properties.detectorUrl', 'type': 'str'}, 'console_url': {'key': 'properties.consoleUrl', 'type': 'str'}, 'containers': {'key': 'properties.containers', 'type': '{ContainerInfo}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebSiteInstanceStatus, self).__init__(**kwargs) self.state = kwargs.get('state', None) self.status_url = kwargs.get('status_url', None) @@ -13249,24 +15275,21 @@ def __init__(self, **kwargs): self.containers = kwargs.get('containers', None) -class WorkerPool(Model): +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -13276,13 +15299,16 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) @@ -13291,11 +15317,42 @@ def __init__(self, **kwargs): self.instance_names = None +class WorkerPoolCollection(msrest.serialization.Model): + """Collection of worker pools. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkerPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkerPoolCollection, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + class WorkerPoolResource(ProxyOnlyResource): """Worker pool of an App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13305,21 +15362,19 @@ class WorkerPoolResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] - :param sku: - :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription """ _validation = { @@ -13334,19 +15389,22 @@ class WorkerPoolResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_size_id': {'key': 'properties.workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'worker_size': {'key': 'properties.workerSize', 'type': 'str'}, 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, 'instance_names': {'key': 'properties.instanceNames', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkerPoolResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.worker_size_id = kwargs.get('worker_size_id', None) self.compute_mode = kwargs.get('compute_mode', None) self.worker_size = kwargs.get('worker_size', None) self.worker_count = kwargs.get('worker_count', None) self.instance_names = None - self.sku = kwargs.get('sku', None) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models_py3.py index 0f5432a57cdb..a1006c8a10b6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_models_py3.py @@ -1,29 +1,30 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AbnormalTimePeriod(Model): +from ._web_site_management_client_enums import * + + +class AbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period identified in diagnosis. - :param start_time: Start time of the downtime - :type start_time: datetime - :param end_time: End time of the downtime - :type end_time: datetime - :param events: List of Possible Cause of downtime - :type events: - list[~azure.mgmt.web.v2019_08_01.models.DetectorAbnormalTimePeriod] - :param solutions: List of proposed solutions + :param start_time: Start time of the downtime. + :type start_time: ~datetime.datetime + :param end_time: End time of the downtime. + :type end_time: ~datetime.datetime + :param events: List of Possible Cause of downtime. + :type events: list[~azure.mgmt.web.v2019_08_01.models.DetectorAbnormalTimePeriod] + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2019_08_01.models.Solution] """ @@ -34,7 +35,15 @@ class AbnormalTimePeriod(Model): 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, *, start_time=None, end_time=None, events=None, solutions=None, **kwargs) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + events: Optional[List["DetectorAbnormalTimePeriod"]] = None, + solutions: Optional[List["Solution"]] = None, + **kwargs + ): super(AbnormalTimePeriod, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -42,7 +51,7 @@ def __init__(self, *, start_time=None, end_time=None, events=None, solutions=Non self.solutions = solutions -class Address(Model): +class Address(msrest.serialization.Model): """Address information for domain registration. All required parameters must be populated in order to send to Azure. @@ -78,7 +87,17 @@ class Address(Model): 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, *, address1: str, city: str, country: str, postal_code: str, state: str, address2: str=None, **kwargs) -> None: + def __init__( + self, + *, + address1: str, + city: str, + country: str, + postal_code: str, + state: str, + address2: Optional[str] = None, + **kwargs + ): super(Address, self).__init__(**kwargs) self.address1 = address1 self.address2 = address2 @@ -88,12 +107,10 @@ def __init__(self, *, address1: str, city: str, country: str, postal_code: str, self.state = state -class ProxyOnlyResource(Model): - """Azure proxy only resource. This resource is not tracked by Azure Resource - Manager. +class ProxyOnlyResource(msrest.serialization.Model): + """Azure proxy only resource. This resource is not tracked by Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -118,7 +135,12 @@ class ProxyOnlyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ProxyOnlyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -129,8 +151,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class AddressResponse(ProxyOnlyResource): """Describes main public IP address and any extra virtual IPs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -142,15 +163,13 @@ class AddressResponse(ProxyOnlyResource): :vartype type: str :param service_ip_address: Main public virtual IP. :type service_ip_address: str - :param internal_ip_address: Virtual Network internal IP address of the App - Service Environment if it is in internal load-balancing mode. + :param internal_ip_address: Virtual Network internal IP address of the App Service Environment + if it is in internal load-balancing mode. :type internal_ip_address: str - :param outbound_ip_addresses: IP addresses appearing on outbound - connections. + :param outbound_ip_addresses: IP addresses appearing on outbound connections. :type outbound_ip_addresses: list[str] :param vip_mappings: Additional virtual IPs. - :type vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :type vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] """ _validation = { @@ -170,7 +189,16 @@ class AddressResponse(ProxyOnlyResource): 'vip_mappings': {'key': 'properties.vipMappings', 'type': '[VirtualIPMapping]'}, } - def __init__(self, *, kind: str=None, service_ip_address: str=None, internal_ip_address: str=None, outbound_ip_addresses=None, vip_mappings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + service_ip_address: Optional[str] = None, + internal_ip_address: Optional[str] = None, + outbound_ip_addresses: Optional[List[str]] = None, + vip_mappings: Optional[List["VirtualIPMapping"]] = None, + **kwargs + ): super(AddressResponse, self).__init__(kind=kind, **kwargs) self.service_ip_address = service_ip_address self.internal_ip_address = internal_ip_address @@ -178,22 +206,19 @@ def __init__(self, *, kind: str=None, service_ip_address: str=None, internal_ip_ self.vip_mappings = vip_mappings -class AnalysisData(Model): +class AnalysisData(msrest.serialization.Model): """Class Representing Detector Evidence used for analysis. - :param source: Name of the Detector + :param source: Name of the Detector. :type source: str - :param detector_definition: Detector Definition - :type detector_definition: - ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition - :param metrics: Source Metrics - :type metrics: - list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] - :param data: Additional Source Data + :param detector_definition: Detector Definition. + :type detector_definition: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :param metrics: Source Metrics. + :type metrics: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] + :param data: Additional Source Data. :type data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] - :param detector_meta_data: Detector Meta Data - :type detector_meta_data: - ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData + :param detector_meta_data: Detector Meta Data. + :type detector_meta_data: ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData """ _attribute_map = { @@ -204,7 +229,16 @@ class AnalysisData(Model): 'detector_meta_data': {'key': 'detectorMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, *, source: str=None, detector_definition=None, metrics=None, data=None, detector_meta_data=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional[str] = None, + detector_definition: Optional["DetectorDefinition"] = None, + metrics: Optional[List["DiagnosticMetricSet"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + detector_meta_data: Optional["ResponseMetaData"] = None, + **kwargs + ): super(AnalysisData, self).__init__(**kwargs) self.source = source self.detector_definition = detector_definition @@ -216,8 +250,7 @@ def __init__(self, *, source: str=None, detector_definition=None, metrics=None, class AnalysisDefinition(ProxyOnlyResource): """Definition of Analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -227,7 +260,7 @@ class AnalysisDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar description: Description of the Analysis + :ivar description: Description of the Analysis. :vartype description: str """ @@ -246,12 +279,17 @@ class AnalysisDefinition(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(AnalysisDefinition, self).__init__(kind=kind, **kwargs) self.description = None -class ApiDefinitionInfo(Model): +class ApiDefinitionInfo(msrest.serialization.Model): """Information about the formal API definition for the app. :param url: The URL of the API definition. @@ -262,19 +300,26 @@ class ApiDefinitionInfo(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): super(ApiDefinitionInfo, self).__init__(**kwargs) self.url = url -class ApiKVReference(Model): +class ApiKVReference(msrest.serialization.Model): """Description of site key vault references. + Variables are only populated by the server, and will be ignored when sending a request. + :param reference: :type reference: str - :param status: Possible values include: 'Initialized', 'Resolved', - 'InvalidSyntax', 'MSINotEnabled', 'VaultNotFound', 'SecretNotFound', - 'SecretVersionNotFound', 'AccessToKeyVaultDenied', 'OtherReasons' + :param status: Possible values include: "Initialized", "Resolved", "InvalidSyntax", + "MSINotEnabled", "VaultNotFound", "SecretNotFound", "SecretVersionNotFound", + "AccessToKeyVaultDenied", "OtherReasons". :type status: str or ~azure.mgmt.web.v2019_08_01.models.ResolveStatus :param vault_name: :type vault_name: str @@ -282,33 +327,49 @@ class ApiKVReference(Model): :type secret_name: str :param secret_version: :type secret_version: str - :param identity_type: Possible values include: 'None', 'SystemAssigned', - 'UserAssigned' - :type identity_type: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType + :param identity_type: Type of managed service identity. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type identity_type: str or ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType :param details: :type details: str - :param source: Possible values include: 'KeyVault' - :type source: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceSource - :param location: Possible values include: 'ApplicationSetting' - :type location: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceLocation + :ivar source: Default value: "KeyVault". + :vartype source: str + :ivar location: Default value: "ApplicationSetting". + :vartype location: str """ + _validation = { + 'source': {'constant': True}, + 'location': {'constant': True}, + } + _attribute_map = { 'reference': {'key': 'reference', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'ResolveStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'vault_name': {'key': 'vaultName', 'type': 'str'}, 'secret_name': {'key': 'secretName', 'type': 'str'}, 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - 'identity_type': {'key': 'identityType', 'type': 'ManagedServiceIdentityType'}, + 'identity_type': {'key': 'identityType', 'type': 'str'}, 'details': {'key': 'details', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'ConfigReferenceSource'}, - 'location': {'key': 'location', 'type': 'ConfigReferenceLocation'}, + 'source': {'key': 'source', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, reference: str=None, status=None, vault_name: str=None, secret_name: str=None, secret_version: str=None, identity_type=None, details: str=None, source=None, location=None, **kwargs) -> None: + source = "KeyVault" + location = "ApplicationSetting" + + def __init__( + self, + *, + reference: Optional[str] = None, + status: Optional[Union[str, "ResolveStatus"]] = None, + vault_name: Optional[str] = None, + secret_name: Optional[str] = None, + secret_version: Optional[str] = None, + identity_type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + details: Optional[str] = None, + **kwargs + ): super(ApiKVReference, self).__init__(**kwargs) self.reference = reference self.status = status @@ -317,11 +378,9 @@ def __init__(self, *, reference: str=None, status=None, vault_name: str=None, se self.secret_version = secret_version self.identity_type = identity_type self.details = details - self.source = source - self.location = location -class ApiManagementConfig(Model): +class ApiManagementConfig(msrest.serialization.Model): """Azure API management (APIM) configuration linked to the app. :param id: APIM-Api Identifier. @@ -332,19 +391,22 @@ class ApiManagementConfig(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(ApiManagementConfig, self).__init__(**kwargs) self.id = id -class ApplicationLogsConfig(Model): +class ApplicationLogsConfig(msrest.serialization.Model): """Application logs configuration. :param file_system: Application logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2019_08_01.models.FileSystemApplicationLogsConfig - :param azure_table_storage: Application logs to azure table storage - configuration. + :type file_system: ~azure.mgmt.web.v2019_08_01.models.FileSystemApplicationLogsConfig + :param azure_table_storage: Application logs to azure table storage configuration. :type azure_table_storage: ~azure.mgmt.web.v2019_08_01.models.AzureTableStorageApplicationLogsConfig :param azure_blob_storage: Application logs to blob storage configuration. @@ -358,14 +420,21 @@ class ApplicationLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageApplicationLogsConfig'}, } - def __init__(self, *, file_system=None, azure_table_storage=None, azure_blob_storage=None, **kwargs) -> None: + def __init__( + self, + *, + file_system: Optional["FileSystemApplicationLogsConfig"] = None, + azure_table_storage: Optional["AzureTableStorageApplicationLogsConfig"] = None, + azure_blob_storage: Optional["AzureBlobStorageApplicationLogsConfig"] = None, + **kwargs + ): super(ApplicationLogsConfig, self).__init__(**kwargs) self.file_system = file_system self.azure_table_storage = azure_table_storage self.azure_blob_storage = azure_blob_storage -class ApplicationStack(Model): +class ApplicationStack(msrest.serialization.Model): """Application stack. :param name: Application stack name. @@ -375,11 +444,9 @@ class ApplicationStack(Model): :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] """ _attribute_map = { @@ -390,7 +457,16 @@ class ApplicationStack(Model): 'frameworks': {'key': 'frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, *, name: str=None, display: str=None, dependency: str=None, major_versions=None, frameworks=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional[str] = None, + dependency: Optional[str] = None, + major_versions: Optional[List["StackMajorVersion"]] = None, + frameworks: Optional[List["ApplicationStack"]] = None, + **kwargs + ): super(ApplicationStack, self).__init__(**kwargs) self.name = name self.display = display @@ -399,11 +475,44 @@ def __init__(self, *, name: str=None, display: str=None, dependency: str=None, m self.frameworks = frameworks +class ApplicationStackCollection(msrest.serialization.Model): + """Collection of Application Stacks. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ApplicationStackResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationStackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ApplicationStackResource"], + **kwargs + ): + super(ApplicationStackCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ApplicationStackResource(ProxyOnlyResource): """ARM resource for a ApplicationStack. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -413,18 +522,16 @@ class ApplicationStackResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param application_stack_resource_name: Application stack name. - :type application_stack_resource_name: str + :param name_properties_name: Application stack name. + :type name_properties_name: str :param display: Application stack display name. :type display: str :param dependency: Application stack dependency. :type dependency: str :param major_versions: List of major versions available. - :type major_versions: - list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] + :type major_versions: list[~azure.mgmt.web.v2019_08_01.models.StackMajorVersion] :param frameworks: List of frameworks associated with application stack. - :type frameworks: - list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] + :type frameworks: list[~azure.mgmt.web.v2019_08_01.models.ApplicationStack] """ _validation = { @@ -438,40 +545,47 @@ class ApplicationStackResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'application_stack_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'display': {'key': 'properties.display', 'type': 'str'}, 'dependency': {'key': 'properties.dependency', 'type': 'str'}, 'major_versions': {'key': 'properties.majorVersions', 'type': '[StackMajorVersion]'}, 'frameworks': {'key': 'properties.frameworks', 'type': '[ApplicationStack]'}, } - def __init__(self, *, kind: str=None, application_stack_resource_name: str=None, display: str=None, dependency: str=None, major_versions=None, frameworks=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + display: Optional[str] = None, + dependency: Optional[str] = None, + major_versions: Optional[List["StackMajorVersion"]] = None, + frameworks: Optional[List["ApplicationStack"]] = None, + **kwargs + ): super(ApplicationStackResource, self).__init__(kind=kind, **kwargs) - self.application_stack_resource_name = application_stack_resource_name + self.name_properties_name = name_properties_name self.display = display self.dependency = dependency self.major_versions = major_versions self.frameworks = frameworks -class AppServiceCertificate(Model): +class AppServiceCertificate(msrest.serialization.Model): """Key Vault container for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -481,21 +595,60 @@ class AppServiceCertificate(Model): _attribute_map = { 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } - def __init__(self, *, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificate, self).__init__(**kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name self.provisioning_state = None -class Resource(Model): +class AppServiceCertificateCollection(msrest.serialization.Model): + """Collection of certificate order certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceCertificateResource"], + **kwargs + ): + super(AppServiceCertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Resource(msrest.serialization.Model): """Azure resource. This resource is tracked in Azure Resource Manager. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -509,7 +662,7 @@ class Resource(Model): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] """ @@ -529,7 +682,14 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -542,8 +702,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, **kwargs) -> Non class AppServiceCertificateOrder(Resource): """SSL certificate purchase order. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -557,63 +716,54 @@ class AppServiceCertificateOrder(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2019_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -623,7 +773,6 @@ class AppServiceCertificateOrder(Resource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -649,10 +798,10 @@ class AppServiceCertificateOrder(Resource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -665,7 +814,21 @@ class AppServiceCertificateOrder(Resource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, product_type, kind: str=None, tags=None, certificates=None, distinguished_name: str=None, validity_in_years: int=1, key_size: int=2048, auto_renew: bool=True, csr: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + certificates: Optional[Dict[str, "AppServiceCertificate"]] = None, + distinguished_name: Optional[str] = None, + validity_in_years: Optional[int] = 1, + key_size: Optional[int] = 2048, + product_type: Optional[Union[str, "CertificateProductType"]] = None, + auto_renew: Optional[bool] = True, + csr: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateOrder, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.certificates = certificates self.distinguished_name = distinguished_name @@ -688,14 +851,45 @@ def __init__(self, *, location: str, product_type, kind: str=None, tags=None, ce self.next_auto_renewal_time_stamp = None -class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): - """ARM resource for a certificate order that is purchased through Azure. +class AppServiceCertificateOrderCollection(msrest.serialization.Model): + """Collection of certificate orders. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceCertificateOrder]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceCertificateOrder"], + **kwargs + ): + super(AppServiceCertificateOrderCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): + """ARM resource for a certificate order that is purchased through Azure. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -705,60 +899,51 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param certificates: State of the Key Vault secret. - :type certificates: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] + :type certificates: dict[str, ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificate] :param distinguished_name: Certificate distinguished name. :type distinguished_name: str :ivar domain_verification_token: Domain verification token. :vartype domain_verification_token: str :param validity_in_years: Duration in years (must be between 1 and 3). - Default value: 1 . :type validity_in_years: int - :param key_size: Certificate key size. Default value: 2048 . + :param key_size: Certificate key size. :type key_size: int - :param product_type: Required. Certificate product type. Possible values - include: 'StandardDomainValidatedSsl', - 'StandardDomainValidatedWildCardSsl' - :type product_type: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateProductType - :param auto_renew: true if the certificate should be - automatically renewed when it expires; otherwise, false. - Default value: True . + :param product_type: Certificate product type. Possible values include: + "StandardDomainValidatedSsl", "StandardDomainValidatedWildCardSsl". + :type product_type: str or ~azure.mgmt.web.v2019_08_01.models.CertificateProductType + :param auto_renew: :code:`true` if the certificate should be automatically renewed + when it expires; otherwise, :code:`false`. :type auto_renew: bool - :ivar provisioning_state: Status of certificate order. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current order status. Possible values include: - 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', 'Denied', - 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', 'NotSubmitted' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus + :ivar provisioning_state: Status of certificate order. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current order status. Possible values include: "Pendingissuance", "Issued", + "Revoked", "Canceled", "Denied", "Pendingrevocation", "PendingRekey", "Unused", "Expired", + "NotSubmitted". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.CertificateOrderStatus :ivar signed_certificate: Signed certificate. - :vartype signed_certificate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype signed_certificate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :param csr: Last CSR that was created for this order. :type csr: str :ivar intermediate: Intermediate certificate. - :vartype intermediate: - ~azure.mgmt.web.v2019_08_01.models.CertificateDetails + :vartype intermediate: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar root: Root certificate. :vartype root: ~azure.mgmt.web.v2019_08_01.models.CertificateDetails :ivar serial_number: Current serial number of the certificate. :vartype serial_number: str :ivar last_certificate_issuance_time: Certificate last issuance time. - :vartype last_certificate_issuance_time: datetime + :vartype last_certificate_issuance_time: ~datetime.datetime :ivar expiration_time: Certificate expiration time. - :vartype expiration_time: datetime - :ivar is_private_key_external: true if private key is - external; otherwise, false. + :vartype expiration_time: ~datetime.datetime + :ivar is_private_key_external: :code:`true` if private key is external; otherwise, + :code:`false`. :vartype is_private_key_external: bool - :ivar app_service_certificate_not_renewable_reasons: Reasons why App - Service Certificate is not renewable at the current moment. - :vartype app_service_certificate_not_renewable_reasons: list[str] - :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would - be auto renewed next - :vartype next_auto_renewal_time_stamp: datetime + :ivar app_service_certificate_not_renewable_reasons: Reasons why App Service Certificate is not + renewable at the current moment. + :vartype app_service_certificate_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem] + :ivar next_auto_renewal_time_stamp: Time stamp when the certificate would be auto renewed next. + :vartype next_auto_renewal_time_stamp: ~datetime.datetime """ _validation = { @@ -767,7 +952,6 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'type': {'readonly': True}, 'domain_verification_token': {'readonly': True}, 'validity_in_years': {'maximum': 3, 'minimum': 1}, - 'product_type': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, 'signed_certificate': {'readonly': True}, @@ -791,10 +975,10 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'domain_verification_token': {'key': 'properties.domainVerificationToken', 'type': 'str'}, 'validity_in_years': {'key': 'properties.validityInYears', 'type': 'int'}, 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'product_type': {'key': 'properties.productType', 'type': 'CertificateProductType'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, 'auto_renew': {'key': 'properties.autoRenew', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'CertificateOrderStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'signed_certificate': {'key': 'properties.signedCertificate', 'type': 'CertificateDetails'}, 'csr': {'key': 'properties.csr', 'type': 'str'}, 'intermediate': {'key': 'properties.intermediate', 'type': 'CertificateDetails'}, @@ -807,7 +991,19 @@ class AppServiceCertificateOrderPatchResource(ProxyOnlyResource): 'next_auto_renewal_time_stamp': {'key': 'properties.nextAutoRenewalTimeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, product_type, kind: str=None, certificates=None, distinguished_name: str=None, validity_in_years: int=1, key_size: int=2048, auto_renew: bool=True, csr: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + certificates: Optional[Dict[str, "AppServiceCertificate"]] = None, + distinguished_name: Optional[str] = None, + validity_in_years: Optional[int] = 1, + key_size: Optional[int] = 2048, + product_type: Optional[Union[str, "CertificateProductType"]] = None, + auto_renew: Optional[bool] = True, + csr: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateOrderPatchResource, self).__init__(kind=kind, **kwargs) self.certificates = certificates self.distinguished_name = distinguished_name @@ -831,11 +1027,9 @@ def __init__(self, *, product_type, kind: str=None, certificates=None, distingui class AppServiceCertificatePatchResource(ProxyOnlyResource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -849,14 +1043,12 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -873,10 +1065,17 @@ class AppServiceCertificatePatchResource(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, kind: str=None, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificatePatchResource, self).__init__(kind=kind, **kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name @@ -884,11 +1083,9 @@ def __init__(self, *, kind: str=None, key_vault_id: str=None, key_vault_secret_n class AppServiceCertificateResource(Resource): - """Key Vault container ARM resource for a certificate that is purchased - through Azure. + """Key Vault container ARM resource for a certificate that is purchased through Azure. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -902,20 +1099,18 @@ class AppServiceCertificateResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param key_vault_id: Key Vault resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar provisioning_state: Status of the Key Vault secret. Possible values - include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus + :ivar provisioning_state: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus """ _validation = { @@ -935,71 +1130,72 @@ class AppServiceCertificateResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'KeyVaultSecretStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, key_vault_id: str=None, key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceCertificateResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.key_vault_id = key_vault_id self.key_vault_secret_name = key_vault_secret_name self.provisioning_state = None -class AppServiceEnvironment(Model): +class AppServiceEnvironment(msrest.serialization.Model): """Description of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. :param name: Required. Name of the App Service Environment. :type name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param location: Required. Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :type virtual_network: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2019_08_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Required. Description of worker pools with worker size IDs, VM sizes, and + number of workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2019_08_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1007,35 +1203,29 @@ class AppServiceEnvironment(Model): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2019_08_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1043,34 +1233,31 @@ class AppServiceEnvironment(Model): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1101,13 +1288,13 @@ class AppServiceEnvironment(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, 'vnet_name': {'key': 'vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'workerPools', 'type': '[WorkerPool]'}, @@ -1140,7 +1327,33 @@ class AppServiceEnvironment(Model): 'ssl_cert_key_vault_secret_name': {'key': 'sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, *, name: str, location: str, virtual_network, worker_pools, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, has_linux_workers: bool=None, ssl_cert_key_vault_id: str=None, ssl_cert_key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + location: str, + virtual_network: "VirtualNetworkProfile", + worker_pools: List["WorkerPool"], + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + has_linux_workers: Optional[bool] = None, + ssl_cert_key_vault_id: Optional[str] = None, + ssl_cert_key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceEnvironment, self).__init__(**kwargs) self.name = name self.location = location @@ -1183,14 +1396,45 @@ def __init__(self, *, name: str, location: str, virtual_network, worker_pools, v self.ssl_cert_key_vault_secret_name = ssl_cert_key_vault_secret_name -class AppServiceEnvironmentPatchResource(ProxyOnlyResource): - """ARM resource for a app service environment. +class AppServiceEnvironmentCollection(msrest.serialization.Model): + """Collection of App Service Environments. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceEnvironmentResource"], + **kwargs + ): + super(AppServiceEnvironmentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppServiceEnvironmentPatchResource(ProxyOnlyResource): + """ARM resource for a app service environment. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -1199,54 +1443,46 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param app_service_environment_patch_resource_name: Required. Name of the - App Service Environment. - :type app_service_environment_patch_resource_name: str - :param location: Required. Location of the App Service Environment, e.g. - "West US". + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location: Location of the App Service Environment, e.g. "West US". :type location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2019_08_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2019_08_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1254,35 +1490,29 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2019_08_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1290,34 +1520,31 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1325,12 +1552,8 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'app_service_environment_patch_resource_name': {'required': True}, - 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1353,15 +1576,15 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'app_service_environment_patch_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1394,9 +1617,36 @@ class AppServiceEnvironmentPatchResource(ProxyOnlyResource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, *, app_service_environment_patch_resource_name: str, location: str, virtual_network, worker_pools, kind: str=None, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, has_linux_workers: bool=None, ssl_cert_key_vault_id: str=None, ssl_cert_key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + name_properties_name: Optional[str] = None, + location: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + virtual_network: Optional["VirtualNetworkProfile"] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + worker_pools: Optional[List["WorkerPool"]] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + has_linux_workers: Optional[bool] = None, + ssl_cert_key_vault_id: Optional[str] = None, + ssl_cert_key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceEnvironmentPatchResource, self).__init__(kind=kind, **kwargs) - self.app_service_environment_patch_resource_name = app_service_environment_patch_resource_name + self.name_properties_name = name_properties_name self.location = location self.provisioning_state = None self.status = None @@ -1440,8 +1690,7 @@ def __init__(self, *, app_service_environment_patch_resource_name: str, location class AppServiceEnvironmentResource(Resource): """App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1455,56 +1704,48 @@ class AppServiceEnvironmentResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param app_service_environment_resource_name: Required. Name of the App - Service Environment. - :type app_service_environment_resource_name: str - :param app_service_environment_resource_location: Required. Location of - the App Service Environment, e.g. "West US". - :type app_service_environment_resource_location: str - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :ivar status: Current status of the App Service Environment. Possible - values include: 'Preparing', 'Ready', 'Scaling', 'Deleting' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus - :param vnet_name: Name of the Virtual Network for the App Service - Environment. + :param name_properties_name: Name of the App Service Environment. + :type name_properties_name: str + :param location_properties_location: Location of the App Service Environment, e.g. "West US". + :type location_properties_location: str + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar status: Current status of the App Service Environment. Possible values include: + "Preparing", "Ready", "Scaling", "Deleting". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentStatus + :param vnet_name: Name of the Virtual Network for the App Service Environment. :type vnet_name: str :param vnet_resource_group_name: Resource group of the Virtual Network. :type vnet_resource_group_name: str :param vnet_subnet_name: Subnet of the Virtual Network. :type vnet_subnet_name: str - :param virtual_network: Required. Description of the Virtual Network. - :type virtual_network: - ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile - :param internal_load_balancing_mode: Specifies which endpoints to serve - internally in the Virtual Network for the App Service Environment. - Possible values include: 'None', 'Web', 'Publishing' + :param virtual_network: Description of the Virtual Network. + :type virtual_network: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :param internal_load_balancing_mode: Specifies which endpoints to serve internally in the + Virtual Network for the App Service Environment. Possible values include: "None", "Web", + "Publishing". :type internal_load_balancing_mode: str or ~azure.mgmt.web.v2019_08_01.models.InternalLoadBalancingMode :param multi_size: Front-end VM size, e.g. "Medium", "Large". :type multi_size: str :param multi_role_count: Number of front-end instances. :type multi_role_count: int - :param worker_pools: Required. Description of worker pools with worker - size IDs, VM sizes, and number of workers in each pool. + :param worker_pools: Description of worker pools with worker size IDs, VM sizes, and number of + workers in each pool. :type worker_pools: list[~azure.mgmt.web.v2019_08_01.models.WorkerPool] - :param ipssl_address_count: Number of IP SSL addresses reserved for the - App Service Environment. + :param ipssl_address_count: Number of IP SSL addresses reserved for the App Service + Environment. :type ipssl_address_count: int - :ivar database_edition: Edition of the metadata database for the App - Service Environment, e.g. "Standard". + :ivar database_edition: Edition of the metadata database for the App Service Environment, e.g. + "Standard". :vartype database_edition: str - :ivar database_service_objective: Service objective of the metadata - database for the App Service Environment, e.g. "S0". + :ivar database_service_objective: Service objective of the metadata database for the App + Service Environment, e.g. "S0". :vartype database_service_objective: str - :ivar upgrade_domains: Number of upgrade domains of the App Service - Environment. + :ivar upgrade_domains: Number of upgrade domains of the App Service Environment. :vartype upgrade_domains: int :ivar subscription_id: Subscription of the App Service Environment. :vartype subscription_id: str @@ -1512,35 +1753,29 @@ class AppServiceEnvironmentResource(Resource): :type dns_suffix: str :ivar last_action: Last deployment action on the App Service Environment. :vartype last_action: str - :ivar last_action_result: Result of the last deployment action on the App - Service Environment. + :ivar last_action_result: Result of the last deployment action on the App Service Environment. :vartype last_action_result: str - :ivar allowed_multi_sizes: List of comma separated strings describing - which VM sizes are allowed for front-ends. + :ivar allowed_multi_sizes: List of comma separated strings describing which VM sizes are + allowed for front-ends. :vartype allowed_multi_sizes: str - :ivar allowed_worker_sizes: List of comma separated strings describing - which VM sizes are allowed for workers. + :ivar allowed_worker_sizes: List of comma separated strings describing which VM sizes are + allowed for workers. :vartype allowed_worker_sizes: str - :ivar maximum_number_of_machines: Maximum number of VMs in the App Service - Environment. + :ivar maximum_number_of_machines: Maximum number of VMs in the App Service Environment. :vartype maximum_number_of_machines: int - :ivar vip_mappings: Description of IP SSL mapping for the App Service - Environment. - :vartype vip_mappings: - list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] - :ivar environment_capacities: Current total, used, and available worker - capacities. - :vartype environment_capacities: - list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :param network_access_control_list: Access control list for controlling - traffic to the App Service Environment. + :ivar vip_mappings: Description of IP SSL mapping for the App Service Environment. + :vartype vip_mappings: list[~azure.mgmt.web.v2019_08_01.models.VirtualIPMapping] + :ivar environment_capacities: Current total, used, and available worker capacities. + :vartype environment_capacities: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :param network_access_control_list: Access control list for controlling traffic to the App + Service Environment. :type network_access_control_list: list[~azure.mgmt.web.v2019_08_01.models.NetworkAccessControlEntry] - :ivar environment_is_healthy: True/false indicating whether the App - Service Environment is healthy. + :ivar environment_is_healthy: True/false indicating whether the App Service Environment is + healthy. :vartype environment_is_healthy: bool - :ivar environment_status: Detailed message about with results of the last - check of the App Service Environment. + :ivar environment_status: Detailed message about with results of the last check of the App + Service Environment. :vartype environment_status: str :ivar resource_group: Resource group of the App Service Environment. :vartype resource_group: str @@ -1548,34 +1783,31 @@ class AppServiceEnvironmentResource(Resource): :type front_end_scale_factor: int :ivar default_front_end_scale_factor: Default Scale Factor for FrontEnds. :vartype default_front_end_scale_factor: int - :param api_management_account_id: API Management Account associated with - the App Service Environment. + :param api_management_account_id: API Management Account associated with the App Service + Environment. :type api_management_account_id: str - :param suspended: true if the App Service Environment is - suspended; otherwise, false. The environment can be - suspended, e.g. when the management endpoint is no longer available - (most likely because NSG blocked the incoming traffic). + :param suspended: :code:`true` if the App Service Environment is suspended; + otherwise, :code:`false`. The environment can be suspended, e.g. when the + management endpoint is no longer available + (most likely because NSG blocked the incoming traffic). :type suspended: bool - :param dynamic_cache_enabled: True/false indicating whether the App - Service Environment is suspended. The environment can be suspended e.g. - when the management endpoint is no longer available + :param dynamic_cache_enabled: True/false indicating whether the App Service Environment is + suspended. The environment can be suspended e.g. when the management endpoint is no longer + available (most likely because NSG blocked the incoming traffic). :type dynamic_cache_enabled: bool - :param cluster_settings: Custom settings for changing the behavior of the - App Service Environment. - :type cluster_settings: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] - :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on - ASE db + :param cluster_settings: Custom settings for changing the behavior of the App Service + Environment. + :type cluster_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param user_whitelisted_ip_ranges: User added ip ranges to whitelist on ASE db. :type user_whitelisted_ip_ranges: list[str] - :param has_linux_workers: Flag that displays whether an ASE has linux - workers or not + :param has_linux_workers: Flag that displays whether an ASE has linux workers or not. :type has_linux_workers: bool - :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment - default SSL certificate + :param ssl_cert_key_vault_id: Key Vault ID for ILB App Service Environment default SSL + certificate. :type ssl_cert_key_vault_id: str - :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App - Service Environment default SSL certificate + :param ssl_cert_key_vault_secret_name: Key Vault Secret Name for ILB App Service Environment + default SSL certificate. :type ssl_cert_key_vault_secret_name: str """ @@ -1584,12 +1816,8 @@ class AppServiceEnvironmentResource(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'app_service_environment_resource_name': {'required': True}, - 'app_service_environment_resource_location': {'required': True}, 'provisioning_state': {'readonly': True}, 'status': {'readonly': True}, - 'virtual_network': {'required': True}, - 'worker_pools': {'required': True}, 'database_edition': {'readonly': True}, 'database_service_objective': {'readonly': True}, 'upgrade_domains': {'readonly': True}, @@ -1614,15 +1842,15 @@ class AppServiceEnvironmentResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'app_service_environment_resource_name': {'key': 'properties.name', 'type': 'str'}, - 'app_service_environment_resource_location': {'key': 'properties.location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'status': {'key': 'properties.status', 'type': 'HostingEnvironmentStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'location_properties_location': {'key': 'properties.location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vnet_name': {'key': 'properties.vnetName', 'type': 'str'}, 'vnet_resource_group_name': {'key': 'properties.vnetResourceGroupName', 'type': 'str'}, 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'VirtualNetworkProfile'}, - 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'InternalLoadBalancingMode'}, + 'internal_load_balancing_mode': {'key': 'properties.internalLoadBalancingMode', 'type': 'str'}, 'multi_size': {'key': 'properties.multiSize', 'type': 'str'}, 'multi_role_count': {'key': 'properties.multiRoleCount', 'type': 'int'}, 'worker_pools': {'key': 'properties.workerPools', 'type': '[WorkerPool]'}, @@ -1655,10 +1883,39 @@ class AppServiceEnvironmentResource(Resource): 'ssl_cert_key_vault_secret_name': {'key': 'properties.sslCertKeyVaultSecretName', 'type': 'str'}, } - def __init__(self, *, location: str, app_service_environment_resource_name: str, app_service_environment_resource_location: str, virtual_network, worker_pools, kind: str=None, tags=None, vnet_name: str=None, vnet_resource_group_name: str=None, vnet_subnet_name: str=None, internal_load_balancing_mode=None, multi_size: str=None, multi_role_count: int=None, ipssl_address_count: int=None, dns_suffix: str=None, network_access_control_list=None, front_end_scale_factor: int=None, api_management_account_id: str=None, suspended: bool=None, dynamic_cache_enabled: bool=None, cluster_settings=None, user_whitelisted_ip_ranges=None, has_linux_workers: bool=None, ssl_cert_key_vault_id: str=None, ssl_cert_key_vault_secret_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + name_properties_name: Optional[str] = None, + location_properties_location: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_resource_group_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + virtual_network: Optional["VirtualNetworkProfile"] = None, + internal_load_balancing_mode: Optional[Union[str, "InternalLoadBalancingMode"]] = None, + multi_size: Optional[str] = None, + multi_role_count: Optional[int] = None, + worker_pools: Optional[List["WorkerPool"]] = None, + ipssl_address_count: Optional[int] = None, + dns_suffix: Optional[str] = None, + network_access_control_list: Optional[List["NetworkAccessControlEntry"]] = None, + front_end_scale_factor: Optional[int] = None, + api_management_account_id: Optional[str] = None, + suspended: Optional[bool] = None, + dynamic_cache_enabled: Optional[bool] = None, + cluster_settings: Optional[List["NameValuePair"]] = None, + user_whitelisted_ip_ranges: Optional[List[str]] = None, + has_linux_workers: Optional[bool] = None, + ssl_cert_key_vault_id: Optional[str] = None, + ssl_cert_key_vault_secret_name: Optional[str] = None, + **kwargs + ): super(AppServiceEnvironmentResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) - self.app_service_environment_resource_name = app_service_environment_resource_name - self.app_service_environment_resource_location = app_service_environment_resource_location + self.name_properties_name = name_properties_name + self.location_properties_location = location_properties_location self.provisioning_state = None self.status = None self.vnet_name = vnet_name @@ -1701,8 +1958,7 @@ def __init__(self, *, location: str, app_service_environment_resource_name: str, class AppServicePlan(Resource): """App Service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -1716,66 +1972,59 @@ class AppServicePlan(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: If Linux app service plan :code:`true`, + :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState - :param sku: - :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState """ _validation = { @@ -1799,8 +2048,9 @@ class AppServicePlan(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1817,12 +2067,32 @@ class AppServicePlan(Resource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, worker_tier_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, maximum_elastic_worker_count: int=None, is_spot: bool=None, spot_expiration_time=None, free_offer_expiration_time=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SkuDescription"] = None, + worker_tier_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + maximum_elastic_worker_count: Optional[int] = None, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + free_offer_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlan, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.sku = sku self.worker_tier_name = worker_tier_name self.status = None self.subscription = None @@ -1842,14 +2112,46 @@ def __init__(self, *, location: str, kind: str=None, tags=None, worker_tier_name self.target_worker_count = target_worker_count self.target_worker_size_id = target_worker_size_id self.provisioning_state = None - self.sku = sku + + +class AppServicePlanCollection(msrest.serialization.Model): + """Collection of App Service plans. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServicePlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServicePlan"], + **kwargs + ): + super(AppServicePlanCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None class AppServicePlanPatchResource(ProxyOnlyResource): """ARM resource for a app service plan. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -1859,62 +2161,56 @@ class AppServicePlanPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param worker_tier_name: Target worker tier assigned to the App Service - plan. + :param worker_tier_name: Target worker tier assigned to the App Service plan. :type worker_tier_name: str - :ivar status: App Service plan status. Possible values include: 'Ready', - 'Pending', 'Creating' + :ivar status: App Service plan status. Possible values include: "Ready", "Pending", "Creating". :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.StatusOptions :ivar subscription: App Service plan subscription. :vartype subscription: str - :param hosting_environment_profile: Specification for the App Service - Environment to use for the App Service plan. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :ivar maximum_number_of_workers: Maximum number of instances that can be - assigned to this App Service plan. + :param hosting_environment_profile: Specification for the App Service Environment to use for + the App Service plan. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :ivar maximum_number_of_workers: Maximum number of instances that can be assigned to this App + Service plan. :vartype maximum_number_of_workers: int :ivar geo_region: Geographical location for the App Service plan. :vartype geo_region: str - :param per_site_scaling: If true, apps assigned to this App - Service plan can be scaled independently. - If false, apps assigned to this App Service plan will scale - to all instances of the plan. Default value: False . + :param per_site_scaling: If :code:`true`, apps assigned to this App Service plan + can be scaled independently. + If :code:`false`, apps assigned to this App Service plan will scale to all + instances of the plan. :type per_site_scaling: bool - :param maximum_elastic_worker_count: Maximum number of total workers - allowed for this ElasticScaleEnabled App Service Plan + :param maximum_elastic_worker_count: Maximum number of total workers allowed for this + ElasticScaleEnabled App Service Plan. :type maximum_elastic_worker_count: int :ivar number_of_sites: Number of apps assigned to this App Service plan. :vartype number_of_sites: int - :param is_spot: If true, this App Service Plan owns spot - instances. + :param is_spot: If :code:`true`, this App Service Plan owns spot instances. :type is_spot: bool - :param spot_expiration_time: The time when the server farm expires. Valid - only if it is a spot server farm. - :type spot_expiration_time: datetime - :param free_offer_expiration_time: The time when the server farm free - offer expires. - :type free_offer_expiration_time: datetime + :param spot_expiration_time: The time when the server farm expires. Valid only if it is a spot + server farm. + :type spot_expiration_time: ~datetime.datetime + :param free_offer_expiration_time: The time when the server farm free offer expires. + :type free_offer_expiration_time: ~datetime.datetime :ivar resource_group: Resource group of the App Service plan. :vartype resource_group: str - :param reserved: If Linux app service plan true, - false otherwise. Default value: False . + :param reserved: This needs to set to :code:`true` when creating a Linux App + Service Plan, along with :code:`kind` set to :code:`Linux`. It should + be :code:`false` otherwise. :type reserved: bool - :param is_xenon: Obsolete: If Hyper-V container app service plan - true, false otherwise. Default value: False . + :param is_xenon: Obsolete: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type is_xenon: bool - :param hyper_v: If Hyper-V container app service plan true, - false otherwise. Default value: False . + :param hyper_v: If Hyper-V container app service plan :code:`true`, + :code:`false` otherwise. :type hyper_v: bool :param target_worker_count: Scaling worker count. :type target_worker_count: int :param target_worker_size_id: Scaling worker size ID. :type target_worker_size_id: int - :ivar provisioning_state: Provisioning state of the App Service - Environment. Possible values include: 'Succeeded', 'Failed', 'Canceled', - 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar provisioning_state: Provisioning state of the App Service Environment. Possible values + include: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState """ _validation = { @@ -1936,7 +2232,7 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'worker_tier_name': {'key': 'properties.workerTierName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'StatusOptions'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'subscription': {'key': 'properties.subscription', 'type': 'str'}, 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'maximum_number_of_workers': {'key': 'properties.maximumNumberOfWorkers', 'type': 'int'}, @@ -1953,10 +2249,27 @@ class AppServicePlanPatchResource(ProxyOnlyResource): 'hyper_v': {'key': 'properties.hyperV', 'type': 'bool'}, 'target_worker_count': {'key': 'properties.targetWorkerCount', 'type': 'int'}, 'target_worker_size_id': {'key': 'properties.targetWorkerSizeId', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, kind: str=None, worker_tier_name: str=None, hosting_environment_profile=None, per_site_scaling: bool=False, maximum_elastic_worker_count: int=None, is_spot: bool=None, spot_expiration_time=None, free_offer_expiration_time=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, target_worker_count: int=None, target_worker_size_id: int=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + worker_tier_name: Optional[str] = None, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + per_site_scaling: Optional[bool] = False, + maximum_elastic_worker_count: Optional[int] = None, + is_spot: Optional[bool] = None, + spot_expiration_time: Optional[datetime.datetime] = None, + free_offer_expiration_time: Optional[datetime.datetime] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + target_worker_count: Optional[int] = None, + target_worker_size_id: Optional[int] = None, + **kwargs + ): super(AppServicePlanPatchResource, self).__init__(kind=kind, **kwargs) self.worker_tier_name = worker_tier_name self.status = None @@ -1979,11 +2292,10 @@ def __init__(self, *, kind: str=None, worker_tier_name: str=None, hosting_enviro self.provisioning_state = None -class ArmIdWrapper(Model): +class ArmIdWrapper(msrest.serialization.Model): """A wrapper for an ARM resource id. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: :vartype id: str @@ -1997,42 +2309,50 @@ class ArmIdWrapper(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ArmIdWrapper, self).__init__(**kwargs) self.id = None -class AutoHealActions(Model): +class AutoHealActions(msrest.serialization.Model): """Actions which to take by the auto-heal module when a rule is triggered. - :param action_type: Predefined action to be taken. Possible values - include: 'Recycle', 'LogEvent', 'CustomAction' - :type action_type: str or - ~azure.mgmt.web.v2019_08_01.models.AutoHealActionType + :param action_type: Predefined action to be taken. Possible values include: "Recycle", + "LogEvent", "CustomAction". + :type action_type: str or ~azure.mgmt.web.v2019_08_01.models.AutoHealActionType :param custom_action: Custom action to be taken. - :type custom_action: - ~azure.mgmt.web.v2019_08_01.models.AutoHealCustomAction + :type custom_action: ~azure.mgmt.web.v2019_08_01.models.AutoHealCustomAction :param min_process_execution_time: Minimum time the process must execute - before taking the action + before taking the action. :type min_process_execution_time: str """ _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'AutoHealActionType'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'custom_action': {'key': 'customAction', 'type': 'AutoHealCustomAction'}, 'min_process_execution_time': {'key': 'minProcessExecutionTime', 'type': 'str'}, } - def __init__(self, *, action_type=None, custom_action=None, min_process_execution_time: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "AutoHealActionType"]] = None, + custom_action: Optional["AutoHealCustomAction"] = None, + min_process_execution_time: Optional[str] = None, + **kwargs + ): super(AutoHealActions, self).__init__(**kwargs) self.action_type = action_type self.custom_action = custom_action self.min_process_execution_time = min_process_execution_time -class AutoHealCustomAction(Model): +class AutoHealCustomAction(msrest.serialization.Model): """Custom action to be executed - when an auto heal rule is triggered. +when an auto heal rule is triggered. :param exe: Executable to be run. :type exe: str @@ -2045,17 +2365,22 @@ class AutoHealCustomAction(Model): 'parameters': {'key': 'parameters', 'type': 'str'}, } - def __init__(self, *, exe: str=None, parameters: str=None, **kwargs) -> None: + def __init__( + self, + *, + exe: Optional[str] = None, + parameters: Optional[str] = None, + **kwargs + ): super(AutoHealCustomAction, self).__init__(**kwargs) self.exe = exe self.parameters = parameters -class AutoHealRules(Model): +class AutoHealRules(msrest.serialization.Model): """Rules that can be defined for auto-heal. - :param triggers: Conditions that describe when to execute the auto-heal - actions. + :param triggers: Conditions that describe when to execute the auto-heal actions. :type triggers: ~azure.mgmt.web.v2019_08_01.models.AutoHealTriggers :param actions: Actions to be executed when a rule is triggered. :type actions: ~azure.mgmt.web.v2019_08_01.models.AutoHealActions @@ -2066,13 +2391,19 @@ class AutoHealRules(Model): 'actions': {'key': 'actions', 'type': 'AutoHealActions'}, } - def __init__(self, *, triggers=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + triggers: Optional["AutoHealTriggers"] = None, + actions: Optional["AutoHealActions"] = None, + **kwargs + ): super(AutoHealRules, self).__init__(**kwargs) self.triggers = triggers self.actions = actions -class AutoHealTriggers(Model): +class AutoHealTriggers(msrest.serialization.Model): """Triggers for auto-heal. :param requests: A rule based on total requests. @@ -2080,11 +2411,9 @@ class AutoHealTriggers(Model): :param private_bytes_in_kb: A rule based on private bytes. :type private_bytes_in_kb: int :param status_codes: A rule based on status codes. - :type status_codes: - list[~azure.mgmt.web.v2019_08_01.models.StatusCodesBasedTrigger] + :type status_codes: list[~azure.mgmt.web.v2019_08_01.models.StatusCodesBasedTrigger] :param slow_requests: A rule based on request execution time. - :type slow_requests: - ~azure.mgmt.web.v2019_08_01.models.SlowRequestsBasedTrigger + :type slow_requests: ~azure.mgmt.web.v2019_08_01.models.SlowRequestsBasedTrigger """ _attribute_map = { @@ -2094,7 +2423,15 @@ class AutoHealTriggers(Model): 'slow_requests': {'key': 'slowRequests', 'type': 'SlowRequestsBasedTrigger'}, } - def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes=None, slow_requests=None, **kwargs) -> None: + def __init__( + self, + *, + requests: Optional["RequestsBasedTrigger"] = None, + private_bytes_in_kb: Optional[int] = None, + status_codes: Optional[List["StatusCodesBasedTrigger"]] = None, + slow_requests: Optional["SlowRequestsBasedTrigger"] = None, + **kwargs + ): super(AutoHealTriggers, self).__init__(**kwargs) self.requests = requests self.private_bytes_in_kb = private_bytes_in_kb @@ -2102,14 +2439,13 @@ def __init__(self, *, requests=None, private_bytes_in_kb: int=None, status_codes self.slow_requests = slow_requests -class AzureBlobStorageApplicationLogsConfig(Model): +class AzureBlobStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs azure blob storage configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2019_08_01.models.LogLevel - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. @@ -2118,30 +2454,36 @@ class AzureBlobStorageApplicationLogsConfig(Model): """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, } - def __init__(self, *, level=None, sas_url: str=None, retention_in_days: int=None, **kwargs) -> None: + def __init__( + self, + *, + level: Optional[Union[str, "LogLevel"]] = None, + sas_url: Optional[str] = None, + retention_in_days: Optional[int] = None, + **kwargs + ): super(AzureBlobStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = level self.sas_url = sas_url self.retention_in_days = retention_in_days -class AzureBlobStorageHttpLogsConfig(Model): +class AzureBlobStorageHttpLogsConfig(msrest.serialization.Model): """Http logs to azure blob storage configuration. - :param sas_url: SAS url to a azure blob container with - read/write/list/delete permissions. + :param sas_url: SAS url to a azure blob container with read/write/list/delete permissions. :type sas_url: str :param retention_in_days: Retention in days. Remove blobs older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -2151,37 +2493,38 @@ class AzureBlobStorageHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, sas_url: str=None, retention_in_days: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + sas_url: Optional[str] = None, + retention_in_days: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(AzureBlobStorageHttpLogsConfig, self).__init__(**kwargs) self.sas_url = sas_url self.retention_in_days = retention_in_days self.enabled = enabled -class AzureStorageInfoValue(Model): - """Azure Files or Blob Storage access information value for dictionary - storage. +class AzureStorageInfoValue(msrest.serialization.Model): + """Azure Files or Blob Storage access information value for dictionary storage. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of storage. Possible values include: 'AzureFiles', - 'AzureBlob' + :param type: Type of storage. Possible values include: "AzureFiles", "AzureBlob". :type type: str or ~azure.mgmt.web.v2019_08_01.models.AzureStorageType :param account_name: Name of the storage account. :type account_name: str - :param share_name: Name of the file share (container name, for Blob - storage). + :param share_name: Name of the file share (container name, for Blob storage). :type share_name: str :param access_key: Access key for the storage account. :type access_key: str - :param mount_path: Path to mount the storage within the site's runtime - environment. + :param mount_path: Path to mount the storage within the site's runtime environment. :type mount_path: str - :ivar state: State of the storage account. Possible values include: 'Ok', - 'InvalidCredentials', 'InvalidShare' - :vartype state: str or - ~azure.mgmt.web.v2019_08_01.models.AzureStorageState + :ivar state: State of the storage account. Possible values include: "Ok", "InvalidCredentials", + "InvalidShare". + :vartype state: str or ~azure.mgmt.web.v2019_08_01.models.AzureStorageState """ _validation = { @@ -2189,15 +2532,24 @@ class AzureStorageInfoValue(Model): } _attribute_map = { - 'type': {'key': 'type', 'type': 'AzureStorageType'}, + 'type': {'key': 'type', 'type': 'str'}, 'account_name': {'key': 'accountName', 'type': 'str'}, 'share_name': {'key': 'shareName', 'type': 'str'}, 'access_key': {'key': 'accessKey', 'type': 'str'}, 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'AzureStorageState'}, + 'state': {'key': 'state', 'type': 'str'}, } - def __init__(self, *, type=None, account_name: str=None, share_name: str=None, access_key: str=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "AzureStorageType"]] = None, + account_name: Optional[str] = None, + share_name: Optional[str] = None, + access_key: Optional[str] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(AzureStorageInfoValue, self).__init__(**kwargs) self.type = type self.account_name = account_name @@ -2210,8 +2562,7 @@ def __init__(self, *, type=None, account_name: str=None, share_name: str=None, a class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): """AzureStorageInfo dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2222,8 +2573,7 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AzureStorageInfoValue] + :type properties: dict[str, ~azure.mgmt.web.v2019_08_01.models.AzureStorageInfoValue] """ _validation = { @@ -2240,21 +2590,26 @@ class AzureStoragePropertyDictionaryResource(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{AzureStorageInfoValue}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, "AzureStorageInfoValue"]] = None, + **kwargs + ): super(AzureStoragePropertyDictionaryResource, self).__init__(kind=kind, **kwargs) self.properties = properties -class AzureTableStorageApplicationLogsConfig(Model): +class AzureTableStorageApplicationLogsConfig(msrest.serialization.Model): """Application logs to Azure table storage configuration. All required parameters must be populated in order to send to Azure. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error' + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2019_08_01.models.LogLevel - :param sas_url: Required. SAS URL to an Azure table with add/query/delete - permissions. + :param sas_url: Required. SAS URL to an Azure table with add/query/delete permissions. :type sas_url: str """ @@ -2263,11 +2618,17 @@ class AzureTableStorageApplicationLogsConfig(Model): } _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, 'sas_url': {'key': 'sasUrl', 'type': 'str'}, } - def __init__(self, *, sas_url: str, level=None, **kwargs) -> None: + def __init__( + self, + *, + sas_url: str, + level: Optional[Union[str, "LogLevel"]] = None, + **kwargs + ): super(AzureTableStorageApplicationLogsConfig, self).__init__(**kwargs) self.level = level self.sas_url = sas_url @@ -2276,8 +2637,7 @@ def __init__(self, *, sas_url: str, level=None, **kwargs) -> None: class BackupItem(ProxyOnlyResource): """Backup description. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2289,40 +2649,35 @@ class BackupItem(ProxyOnlyResource): :vartype type: str :ivar backup_id: Id of the backup. :vartype backup_id: int - :ivar storage_account_url: SAS URL for the storage account container which - contains this backup. + :ivar storage_account_url: SAS URL for the storage account container which contains this + backup. :vartype storage_account_url: str :ivar blob_name: Name of the blob which contains data for this backup. :vartype blob_name: str - :ivar backup_item_name: Name of this backup. - :vartype backup_item_name: str - :ivar status: Backup status. Possible values include: 'InProgress', - 'Failed', 'Succeeded', 'TimedOut', 'Created', 'Skipped', - 'PartiallySucceeded', 'DeleteInProgress', 'DeleteFailed', 'Deleted' - :vartype status: str or - ~azure.mgmt.web.v2019_08_01.models.BackupItemStatus + :ivar name_properties_name: Name of this backup. + :vartype name_properties_name: str + :ivar status: Backup status. Possible values include: "InProgress", "Failed", "Succeeded", + "TimedOut", "Created", "Skipped", "PartiallySucceeded", "DeleteInProgress", "DeleteFailed", + "Deleted". + :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.BackupItemStatus :ivar size_in_bytes: Size of the backup in bytes. :vartype size_in_bytes: long :ivar created: Timestamp of the backup creation. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar log: Details regarding this backup. Might contain an error message. :vartype log: str :ivar databases: List of databases included in the backup. - :vartype databases: - list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] - :ivar scheduled: True if this backup has been created due to a schedule - being triggered. + :vartype databases: list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] + :ivar scheduled: True if this backup has been created due to a schedule being triggered. :vartype scheduled: bool - :ivar last_restore_time_stamp: Timestamp of a last restore operation which - used this backup. - :vartype last_restore_time_stamp: datetime + :ivar last_restore_time_stamp: Timestamp of a last restore operation which used this backup. + :vartype last_restore_time_stamp: ~datetime.datetime :ivar finished_time_stamp: Timestamp when this backup finished. - :vartype finished_time_stamp: datetime - :ivar correlation_id: Unique correlation identifier. Please use this along - with the timestamp while communicating with Azure support. + :vartype finished_time_stamp: ~datetime.datetime + :ivar correlation_id: Unique correlation identifier. Please use this along with the timestamp + while communicating with Azure support. :vartype correlation_id: str - :ivar website_size_in_bytes: Size of the original web app which has been - backed up. + :ivar website_size_in_bytes: Size of the original web app which has been backed up. :vartype website_size_in_bytes: long """ @@ -2333,7 +2688,7 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'readonly': True}, 'storage_account_url': {'readonly': True}, 'blob_name': {'readonly': True}, - 'backup_item_name': {'readonly': True}, + 'name_properties_name': {'readonly': True}, 'status': {'readonly': True}, 'size_in_bytes': {'readonly': True}, 'created': {'readonly': True}, @@ -2354,8 +2709,8 @@ class BackupItem(ProxyOnlyResource): 'backup_id': {'key': 'properties.id', 'type': 'int'}, 'storage_account_url': {'key': 'properties.storageAccountUrl', 'type': 'str'}, 'blob_name': {'key': 'properties.blobName', 'type': 'str'}, - 'backup_item_name': {'key': 'properties.name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'BackupItemStatus'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, 'created': {'key': 'properties.created', 'type': 'iso-8601'}, 'log': {'key': 'properties.log', 'type': 'str'}, @@ -2367,12 +2722,17 @@ class BackupItem(ProxyOnlyResource): 'website_size_in_bytes': {'key': 'properties.websiteSizeInBytes', 'type': 'long'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(BackupItem, self).__init__(kind=kind, **kwargs) self.backup_id = None self.storage_account_url = None self.blob_name = None - self.backup_item_name = None + self.name_properties_name = None self.status = None self.size_in_bytes = None self.created = None @@ -2385,14 +2745,45 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.website_size_in_bytes = None -class BackupRequest(ProxyOnlyResource): - """Description of a backup which will be performed. +class BackupItemCollection(msrest.serialization.Model): + """Collection of backup items. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.BackupItem] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BackupItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["BackupItem"], + **kwargs + ): + super(BackupItemCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class BackupRequest(ProxyOnlyResource): + """Description of a backup which will be performed. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -2403,24 +2794,21 @@ class BackupRequest(ProxyOnlyResource): :vartype type: str :param backup_name: Name of the backup. :type backup_name: str - :param enabled: True if the backup schedule is enabled (must be included - in that case), false if the backup schedule should be disabled. + :param enabled: True if the backup schedule is enabled (must be included in that case), false + if the backup schedule should be disabled. :type enabled: bool - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str - :param backup_schedule: Schedule for the backup if it is executed - periodically. + :param backup_schedule: Schedule for the backup if it is executed periodically. :type backup_schedule: ~azure.mgmt.web.v2019_08_01.models.BackupSchedule :param databases: Databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] + :type databases: list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, } _attribute_map = { @@ -2435,7 +2823,17 @@ class BackupRequest(ProxyOnlyResource): 'databases': {'key': 'properties.databases', 'type': '[DatabaseBackupSetting]'}, } - def __init__(self, *, storage_account_url: str, kind: str=None, backup_name: str=None, enabled: bool=None, backup_schedule=None, databases=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + backup_name: Optional[str] = None, + enabled: Optional[bool] = None, + storage_account_url: Optional[str] = None, + backup_schedule: Optional["BackupSchedule"] = None, + databases: Optional[List["DatabaseBackupSetting"]] = None, + **kwargs + ): super(BackupRequest, self).__init__(kind=kind, **kwargs) self.backup_name = backup_name self.enabled = enabled @@ -2444,36 +2842,29 @@ def __init__(self, *, storage_account_url: str, kind: str=None, backup_name: str self.databases = databases -class BackupSchedule(Model): - """Description of a backup schedule. Describes how often should be the backup - performed and what should be the retention policy. +class BackupSchedule(msrest.serialization.Model): + """Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param frequency_interval: Required. How often the backup should be - executed (e.g. for weekly backup, this should be set to 7 and - FrequencyUnit should be set to Day). Default value: 7 . + :param frequency_interval: Required. How often the backup should be executed (e.g. for weekly + backup, this should be set to 7 and FrequencyUnit should be set to Day). :type frequency_interval: int - :param frequency_unit: Required. The unit of time for how often the backup - should be executed (e.g. for weekly backup, this should be set to Day and - FrequencyInterval should be set to 7). Possible values include: 'Day', - 'Hour'. Default value: "Day" . - :type frequency_unit: str or - ~azure.mgmt.web.v2019_08_01.models.FrequencyUnit - :param keep_at_least_one_backup: Required. True if the retention policy - should always keep at least one backup in the storage account, regardless - how old it is; false otherwise. Default value: True . + :param frequency_unit: Required. The unit of time for how often the backup should be executed + (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). + Possible values include: "Day", "Hour". Default value: "Day". + :type frequency_unit: str or ~azure.mgmt.web.v2019_08_01.models.FrequencyUnit + :param keep_at_least_one_backup: Required. True if the retention policy should always keep at + least one backup in the storage account, regardless how old it is; false otherwise. :type keep_at_least_one_backup: bool - :param retention_period_in_days: Required. After how many days backups - should be deleted. Default value: 30 . + :param retention_period_in_days: Required. After how many days backups should be deleted. :type retention_period_in_days: int :param start_time: When the schedule should start working. - :type start_time: datetime + :type start_time: ~datetime.datetime :ivar last_execution_time: Last time when this schedule was triggered. - :vartype last_execution_time: datetime + :vartype last_execution_time: ~datetime.datetime """ _validation = { @@ -2486,14 +2877,23 @@ class BackupSchedule(Model): _attribute_map = { 'frequency_interval': {'key': 'frequencyInterval', 'type': 'int'}, - 'frequency_unit': {'key': 'frequencyUnit', 'type': 'FrequencyUnit'}, + 'frequency_unit': {'key': 'frequencyUnit', 'type': 'str'}, 'keep_at_least_one_backup': {'key': 'keepAtLeastOneBackup', 'type': 'bool'}, 'retention_period_in_days': {'key': 'retentionPeriodInDays', 'type': 'int'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, } - def __init__(self, *, frequency_interval: int=7, frequency_unit="Day", keep_at_least_one_backup: bool=True, retention_period_in_days: int=30, start_time=None, **kwargs) -> None: + def __init__( + self, + *, + frequency_interval: int = 7, + frequency_unit: Union[str, "FrequencyUnit"] = "Day", + keep_at_least_one_backup: bool = True, + retention_period_in_days: int = 30, + start_time: Optional[datetime.datetime] = None, + **kwargs + ): super(BackupSchedule, self).__init__(**kwargs) self.frequency_interval = frequency_interval self.frequency_unit = frequency_unit @@ -2504,11 +2904,9 @@ def __init__(self, *, frequency_interval: int=7, frequency_unit="Day", keep_at_l class BillingMeter(ProxyOnlyResource): - """App Service billing entity that contains information about meter which the - Azure billing system utilizes to charge users for services. + """App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2518,17 +2916,17 @@ class BillingMeter(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param meter_id: Meter GUID onboarded in Commerce + :param meter_id: Meter GUID onboarded in Commerce. :type meter_id: str - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param short_name: Short Name from App Service Azure pricing Page + :param short_name: Short Name from App Service Azure pricing Page. :type short_name: str - :param friendly_name: Friendly name of the meter + :param friendly_name: Friendly name of the meter. :type friendly_name: str - :param resource_type: App Service ResourceType meter used for + :param resource_type: App Service ResourceType meter used for. :type resource_type: str - :param os_type: App Service OS type meter used for + :param os_type: App Service OS type meter used for. :type os_type: str """ @@ -2551,7 +2949,18 @@ class BillingMeter(ProxyOnlyResource): 'os_type': {'key': 'properties.osType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, meter_id: str=None, billing_location: str=None, short_name: str=None, friendly_name: str=None, resource_type: str=None, os_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + meter_id: Optional[str] = None, + billing_location: Optional[str] = None, + short_name: Optional[str] = None, + friendly_name: Optional[str] = None, + resource_type: Optional[str] = None, + os_type: Optional[str] = None, + **kwargs + ): super(BillingMeter, self).__init__(kind=kind, **kwargs) self.meter_id = meter_id self.billing_location = billing_location @@ -2561,7 +2970,41 @@ def __init__(self, *, kind: str=None, meter_id: str=None, billing_location: str= self.os_type = os_type -class Capability(Model): +class BillingMeterCollection(msrest.serialization.Model): + """Collection of Billing Meters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.BillingMeter] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingMeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["BillingMeter"], + **kwargs + ): + super(BillingMeterCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Capability(msrest.serialization.Model): """Describes the capabilities/features allowed for a specific SKU. :param name: Name of the SKU capability. @@ -2578,7 +3021,14 @@ class Capability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + reason: Optional[str] = None, + **kwargs + ): super(Capability, self).__init__(**kwargs) self.name = name self.value = value @@ -2588,8 +3038,7 @@ def __init__(self, *, name: str=None, value: str=None, reason: str=None, **kwarg class Certificate(Resource): """SSL certificate for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -2603,7 +3052,7 @@ class Certificate(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :ivar friendly_name: Friendly name of the certificate. :vartype friendly_name: str @@ -2620,41 +3069,38 @@ class Certificate(Resource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param canonical_name: CNAME of the certificate to be issued via free - certificate + :param canonical_name: CNAME of the certificate to be issued via free certificate. :type canonical_name: str """ @@ -2670,7 +3116,6 @@ class Certificate(Resource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2703,12 +3148,26 @@ class Certificate(Resource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'canonical_name': {'key': 'properties.canonicalName', 'type': 'str'}, } - def __init__(self, *, location: str, password: str, kind: str=None, tags=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, canonical_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + canonical_name: Optional[str] = None, + **kwargs + ): super(Certificate, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.friendly_name = None self.subject_name = None @@ -2732,24 +3191,57 @@ def __init__(self, *, location: str, password: str, kind: str=None, tags=None, h self.canonical_name = canonical_name -class CertificateDetails(Model): - """SSL certificate details. +class CertificateCollection(msrest.serialization.Model): + """Collection of certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: Certificate Version. - :vartype version: int - :ivar serial_number: Certificate Serial Number. + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Certificate"], + **kwargs + ): + super(CertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificateDetails(msrest.serialization.Model): + """SSL certificate details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Certificate Version. + :vartype version: int + :ivar serial_number: Certificate Serial Number. :vartype serial_number: str :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str :ivar subject: Certificate Subject. :vartype subject: str :ivar not_before: Date Certificate is valid from. - :vartype not_before: datetime + :vartype not_before: ~datetime.datetime :ivar not_after: Date Certificate is valid to. - :vartype not_after: datetime + :vartype not_after: ~datetime.datetime :ivar signature_algorithm: Certificate Signature algorithm. :vartype signature_algorithm: str :ivar issuer: Certificate Issuer. @@ -2782,7 +3274,10 @@ class CertificateDetails(Model): 'raw_data': {'key': 'rawData', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateDetails, self).__init__(**kwargs) self.version = None self.serial_number = None @@ -2798,8 +3293,7 @@ def __init__(self, **kwargs) -> None: class CertificateEmail(ProxyOnlyResource): """SSL certificate email. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2812,7 +3306,7 @@ class CertificateEmail(ProxyOnlyResource): :param email_id: Email id. :type email_id: str :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime """ _validation = { @@ -2830,7 +3324,14 @@ class CertificateEmail(ProxyOnlyResource): 'time_stamp': {'key': 'properties.timeStamp', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, email_id: str=None, time_stamp=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + email_id: Optional[str] = None, + time_stamp: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateEmail, self).__init__(kind=kind, **kwargs) self.email_id = email_id self.time_stamp = time_stamp @@ -2839,8 +3340,7 @@ def __init__(self, *, kind: str=None, email_id: str=None, time_stamp=None, **kwa class CertificateOrderAction(ProxyOnlyResource): """Certificate order action. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2850,16 +3350,14 @@ class CertificateOrderAction(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar action_type: Action type. Possible values include: - 'CertificateIssued', 'CertificateOrderCanceled', - 'CertificateOrderCreated', 'CertificateRevoked', - 'DomainValidationComplete', 'FraudDetected', 'OrgNameChange', - 'OrgValidationComplete', 'SanDrop', 'FraudCleared', 'CertificateExpired', - 'CertificateExpirationWarning', 'FraudDocumentationRequired', 'Unknown' - :vartype action_type: str or - ~azure.mgmt.web.v2019_08_01.models.CertificateOrderActionType + :ivar action_type: Action type. Possible values include: "CertificateIssued", + "CertificateOrderCanceled", "CertificateOrderCreated", "CertificateRevoked", + "DomainValidationComplete", "FraudDetected", "OrgNameChange", "OrgValidationComplete", + "SanDrop", "FraudCleared", "CertificateExpired", "CertificateExpirationWarning", + "FraudDocumentationRequired", "Unknown". + :vartype action_type: str or ~azure.mgmt.web.v2019_08_01.models.CertificateOrderActionType :ivar created_at: Time at which the certificate action was performed. - :vartype created_at: datetime + :vartype created_at: ~datetime.datetime """ _validation = { @@ -2875,11 +3373,16 @@ class CertificateOrderAction(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'action_type': {'key': 'properties.actionType', 'type': 'CertificateOrderActionType'}, + 'action_type': {'key': 'properties.actionType', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(CertificateOrderAction, self).__init__(kind=kind, **kwargs) self.action_type = None self.created_at = None @@ -2888,10 +3391,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class CertificatePatchResource(ProxyOnlyResource): """ARM resource for a certificate. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -2916,41 +3416,38 @@ class CertificatePatchResource(ProxyOnlyResource): :ivar issuer: Certificate issuer. :vartype issuer: str :ivar issue_date: Certificate issue Date. - :vartype issue_date: datetime + :vartype issue_date: ~datetime.datetime :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: datetime - :param password: Required. Certificate password. + :vartype expiration_date: ~datetime.datetime + :param password: Certificate password. :type password: str :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool - :ivar cer_blob: Raw bytes of .cer file + :ivar cer_blob: Raw bytes of .cer file. :vartype cer_blob: bytearray :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar hosting_environment_profile: Specification for the App Service - Environment to use for the certificate. + :ivar hosting_environment_profile: Specification for the App Service Environment to use for the + certificate. :vartype hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile :param key_vault_id: Key Vault Csm resource Id. :type key_vault_id: str :param key_vault_secret_name: Key Vault secret name. :type key_vault_secret_name: str - :ivar key_vault_secret_status: Status of the Key Vault secret. Possible - values include: 'Initialized', 'WaitingOnCertificateOrder', 'Succeeded', - 'CertificateOrderFailed', 'OperationNotPermittedOnKeyVault', - 'AzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultDoesNotExist', - 'KeyVaultSecretDoesNotExist', 'UnknownError', 'ExternalPrivateKey', - 'Unknown' + :ivar key_vault_secret_status: Status of the Key Vault secret. Possible values include: + "Initialized", "WaitingOnCertificateOrder", "Succeeded", "CertificateOrderFailed", + "OperationNotPermittedOnKeyVault", "AzureServiceUnauthorizedToAccessKeyVault", + "KeyVaultDoesNotExist", "KeyVaultSecretDoesNotExist", "UnknownError", "ExternalPrivateKey", + "Unknown". :vartype key_vault_secret_status: str or ~azure.mgmt.web.v2019_08_01.models.KeyVaultSecretStatus - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param canonical_name: CNAME of the certificate to be issued via free - certificate + :param canonical_name: CNAME of the certificate to be issued via free certificate. :type canonical_name: str """ @@ -2965,7 +3462,6 @@ class CertificatePatchResource(ProxyOnlyResource): 'issuer': {'readonly': True}, 'issue_date': {'readonly': True}, 'expiration_date': {'readonly': True}, - 'password': {'required': True}, 'thumbprint': {'readonly': True}, 'valid': {'readonly': True}, 'cer_blob': {'readonly': True}, @@ -2996,12 +3492,24 @@ class CertificatePatchResource(ProxyOnlyResource): 'hosting_environment_profile': {'key': 'properties.hostingEnvironmentProfile', 'type': 'HostingEnvironmentProfile'}, 'key_vault_id': {'key': 'properties.keyVaultId', 'type': 'str'}, 'key_vault_secret_name': {'key': 'properties.keyVaultSecretName', 'type': 'str'}, - 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'KeyVaultSecretStatus'}, + 'key_vault_secret_status': {'key': 'properties.keyVaultSecretStatus', 'type': 'str'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'canonical_name': {'key': 'properties.canonicalName', 'type': 'str'}, } - def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: bytearray=None, key_vault_id: str=None, key_vault_secret_name: str=None, server_farm_id: str=None, canonical_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + host_names: Optional[List[str]] = None, + pfx_blob: Optional[bytearray] = None, + password: Optional[str] = None, + key_vault_id: Optional[str] = None, + key_vault_secret_name: Optional[str] = None, + server_farm_id: Optional[str] = None, + canonical_name: Optional[str] = None, + **kwargs + ): super(CertificatePatchResource, self).__init__(kind=kind, **kwargs) self.friendly_name = None self.subject_name = None @@ -3025,51 +3533,48 @@ def __init__(self, *, password: str, kind: str=None, host_names=None, pfx_blob: self.canonical_name = canonical_name -class CloningInfo(Model): +class CloningInfo(msrest.serialization.Model): """Information needed for cloning operation. All required parameters must be populated in order to send to Azure. - :param correlation_id: Correlation ID of cloning operation. This ID ties - multiple cloning operations + :param correlation_id: Correlation ID of cloning operation. This ID ties multiple cloning + operations together to use the same snapshot. :type correlation_id: str - :param overwrite: true to overwrite destination app; - otherwise, false. + :param overwrite: :code:`true` to overwrite destination app; otherwise, + :code:`false`. :type overwrite: bool - :param clone_custom_host_names: true to clone custom - hostnames from source app; otherwise, false. + :param clone_custom_host_names: :code:`true` to clone custom hostnames from source + app; otherwise, :code:`false`. :type clone_custom_host_names: bool - :param clone_source_control: true to clone source control - from source app; otherwise, false. + :param clone_source_control: :code:`true` to clone source control from source app; + otherwise, :code:`false`. :type clone_source_control: bool - :param source_web_app_id: Required. ARM resource ID of the source app. App - resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + :param source_web_app_id: Required. ARM resource ID of the source app. App resource ID is of + the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type source_web_app_id: str - :param source_web_app_location: Location of source app ex: West US or - North Europe + :param source_web_app_location: Location of source app ex: West US or North Europe. :type source_web_app_location: str :param hosting_environment: App Service Environment. :type hosting_environment: str - :param app_settings_overrides: Application setting overrides for cloned - app. If specified, these settings override the settings cloned - from source app. Otherwise, application settings from source app are - retained. + :param app_settings_overrides: Application setting overrides for cloned app. If specified, + these settings override the settings cloned + from source app. Otherwise, application settings from source app are retained. :type app_settings_overrides: dict[str, str] - :param configure_load_balancing: true to configure load - balancing for source and destination app. + :param configure_load_balancing: :code:`true` to configure load balancing for + source and destination app. :type configure_load_balancing: bool - :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager - profile to use, if it exists. Traffic Manager resource ID is of the form - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + :param traffic_manager_profile_id: ARM resource ID of the Traffic Manager profile to use, if it + exists. Traffic Manager resource ID is of the form + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. :type traffic_manager_profile_id: str - :param traffic_manager_profile_name: Name of Traffic Manager profile to - create. This is only needed if Traffic Manager profile does not already - exist. + :param traffic_manager_profile_name: Name of Traffic Manager profile to create. This is only + needed if Traffic Manager profile does not already exist. :type traffic_manager_profile_name: str """ @@ -3091,7 +3596,22 @@ class CloningInfo(Model): 'traffic_manager_profile_name': {'key': 'trafficManagerProfileName', 'type': 'str'}, } - def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrite: bool=None, clone_custom_host_names: bool=None, clone_source_control: bool=None, source_web_app_location: str=None, hosting_environment: str=None, app_settings_overrides=None, configure_load_balancing: bool=None, traffic_manager_profile_id: str=None, traffic_manager_profile_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + source_web_app_id: str, + correlation_id: Optional[str] = None, + overwrite: Optional[bool] = None, + clone_custom_host_names: Optional[bool] = None, + clone_source_control: Optional[bool] = None, + source_web_app_location: Optional[str] = None, + hosting_environment: Optional[str] = None, + app_settings_overrides: Optional[Dict[str, str]] = None, + configure_load_balancing: Optional[bool] = None, + traffic_manager_profile_id: Optional[str] = None, + traffic_manager_profile_name: Optional[str] = None, + **kwargs + ): super(CloningInfo, self).__init__(**kwargs) self.correlation_id = correlation_id self.overwrite = overwrite @@ -3106,19 +3626,40 @@ def __init__(self, *, source_web_app_id: str, correlation_id: str=None, overwrit self.traffic_manager_profile_name = traffic_manager_profile_name -class CloudError(Model): - """CloudError. +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned 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(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + class ConnectionStringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3129,8 +3670,7 @@ class ConnectionStringDictionary(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ConnStringValueTypePair] + :type properties: dict[str, ~azure.mgmt.web.v2019_08_01.models.ConnStringValueTypePair] """ _validation = { @@ -3147,47 +3687,60 @@ class ConnectionStringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{ConnStringValueTypePair}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, "ConnStringValueTypePair"]] = None, + **kwargs + ): super(ConnectionStringDictionary, self).__init__(kind=kind, **kwargs) self.properties = properties -class ConnStringInfo(Model): +class ConnStringInfo(msrest.serialization.Model): """Database connection string information. :param name: Name of connection string. :type name: str :param connection_string: Connection string value. :type connection_string: str - :param type: Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Type of database. Possible values include: "MySql", "SQLServer", "SQLAzure", + "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", "RedisCache", + "PostgreSQL". :type type: str or ~azure.mgmt.web.v2019_08_01.models.ConnectionStringType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, connection_string: str=None, type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + connection_string: Optional[str] = None, + type: Optional[Union[str, "ConnectionStringType"]] = None, + **kwargs + ): super(ConnStringInfo, self).__init__(**kwargs) self.name = name self.connection_string = connection_string self.type = type -class ConnStringValueTypePair(Model): +class ConnStringValueTypePair(msrest.serialization.Model): """Database connection string value to type pair. All required parameters must be populated in order to send to Azure. :param value: Required. Value of pair. :type value: str - :param type: Required. Type of database. Possible values include: 'MySql', - 'SQLServer', 'SQLAzure', 'Custom', 'NotificationHub', 'ServiceBus', - 'EventHub', 'ApiHub', 'DocDb', 'RedisCache', 'PostgreSQL' + :param type: Required. Type of database. Possible values include: "MySql", "SQLServer", + "SQLAzure", "Custom", "NotificationHub", "ServiceBus", "EventHub", "ApiHub", "DocDb", + "RedisCache", "PostgreSQL". :type type: str or ~azure.mgmt.web.v2019_08_01.models.ConnectionStringType """ @@ -3198,20 +3751,24 @@ class ConnStringValueTypePair(Model): _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ConnectionStringType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, value: str, type, **kwargs) -> None: + def __init__( + self, + *, + value: str, + type: Union[str, "ConnectionStringType"], + **kwargs + ): super(ConnStringValueTypePair, self).__init__(**kwargs) self.value = value self.type = type -class Contact(Model): - """Contact information for domain registration. If 'Domain Privacy' option is - not selected then the contact information is made publicly available - through the Whois - directories as per ICANN requirements. +class Contact(msrest.serialization.Model): + """Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information is made publicly available through the Whois +directories as per ICANN requirements. All required parameters must be populated in order to send to Azure. @@ -3254,7 +3811,20 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, email: str, name_first: str, name_last: str, phone: str, address_mailing=None, fax: str=None, job_title: str=None, name_middle: str=None, organization: str=None, **kwargs) -> None: + def __init__( + self, + *, + email: str, + name_first: str, + name_last: str, + phone: str, + address_mailing: Optional["Address"] = None, + fax: Optional[str] = None, + job_title: Optional[str] = None, + name_middle: Optional[str] = None, + organization: Optional[str] = None, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.address_mailing = address_mailing self.email = email @@ -3267,7 +3837,7 @@ def __init__(self, *, email: str, name_first: str, name_last: str, phone: str, a self.phone = phone -class ContainerCpuStatistics(Model): +class ContainerCpuStatistics(msrest.serialization.Model): """ContainerCpuStatistics. :param cpu_usage: @@ -3277,8 +3847,7 @@ class ContainerCpuStatistics(Model): :param online_cpu_count: :type online_cpu_count: int :param throttling_data: - :type throttling_data: - ~azure.mgmt.web.v2019_08_01.models.ContainerThrottlingData + :type throttling_data: ~azure.mgmt.web.v2019_08_01.models.ContainerThrottlingData """ _attribute_map = { @@ -3288,7 +3857,15 @@ class ContainerCpuStatistics(Model): 'throttling_data': {'key': 'throttlingData', 'type': 'ContainerThrottlingData'}, } - def __init__(self, *, cpu_usage=None, system_cpu_usage: int=None, online_cpu_count: int=None, throttling_data=None, **kwargs) -> None: + def __init__( + self, + *, + cpu_usage: Optional["ContainerCpuUsage"] = None, + system_cpu_usage: Optional[int] = None, + online_cpu_count: Optional[int] = None, + throttling_data: Optional["ContainerThrottlingData"] = None, + **kwargs + ): super(ContainerCpuStatistics, self).__init__(**kwargs) self.cpu_usage = cpu_usage self.system_cpu_usage = system_cpu_usage @@ -3296,7 +3873,7 @@ def __init__(self, *, cpu_usage=None, system_cpu_usage: int=None, online_cpu_cou self.throttling_data = throttling_data -class ContainerCpuUsage(Model): +class ContainerCpuUsage(msrest.serialization.Model): """ContainerCpuUsage. :param total_usage: @@ -3316,7 +3893,15 @@ class ContainerCpuUsage(Model): 'user_mode_usage': {'key': 'userModeUsage', 'type': 'long'}, } - def __init__(self, *, total_usage: int=None, per_cpu_usage=None, kernel_mode_usage: int=None, user_mode_usage: int=None, **kwargs) -> None: + def __init__( + self, + *, + total_usage: Optional[int] = None, + per_cpu_usage: Optional[List[int]] = None, + kernel_mode_usage: Optional[int] = None, + user_mode_usage: Optional[int] = None, + **kwargs + ): super(ContainerCpuUsage, self).__init__(**kwargs) self.total_usage = total_usage self.per_cpu_usage = per_cpu_usage @@ -3324,29 +3909,25 @@ def __init__(self, *, total_usage: int=None, per_cpu_usage=None, kernel_mode_usa self.user_mode_usage = user_mode_usage -class ContainerInfo(Model): +class ContainerInfo(msrest.serialization.Model): """ContainerInfo. :param current_time_stamp: - :type current_time_stamp: datetime + :type current_time_stamp: ~datetime.datetime :param previous_time_stamp: - :type previous_time_stamp: datetime + :type previous_time_stamp: ~datetime.datetime :param current_cpu_stats: - :type current_cpu_stats: - ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics + :type current_cpu_stats: ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics :param previous_cpu_stats: - :type previous_cpu_stats: - ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics + :type previous_cpu_stats: ~azure.mgmt.web.v2019_08_01.models.ContainerCpuStatistics :param memory_stats: - :type memory_stats: - ~azure.mgmt.web.v2019_08_01.models.ContainerMemoryStatistics + :type memory_stats: ~azure.mgmt.web.v2019_08_01.models.ContainerMemoryStatistics :param name: :type name: str :param id: :type id: str :param eth0: - :type eth0: - ~azure.mgmt.web.v2019_08_01.models.ContainerNetworkInterfaceStatistics + :type eth0: ~azure.mgmt.web.v2019_08_01.models.ContainerNetworkInterfaceStatistics """ _attribute_map = { @@ -3360,7 +3941,19 @@ class ContainerInfo(Model): 'eth0': {'key': 'eth0', 'type': 'ContainerNetworkInterfaceStatistics'}, } - def __init__(self, *, current_time_stamp=None, previous_time_stamp=None, current_cpu_stats=None, previous_cpu_stats=None, memory_stats=None, name: str=None, id: str=None, eth0=None, **kwargs) -> None: + def __init__( + self, + *, + current_time_stamp: Optional[datetime.datetime] = None, + previous_time_stamp: Optional[datetime.datetime] = None, + current_cpu_stats: Optional["ContainerCpuStatistics"] = None, + previous_cpu_stats: Optional["ContainerCpuStatistics"] = None, + memory_stats: Optional["ContainerMemoryStatistics"] = None, + name: Optional[str] = None, + id: Optional[str] = None, + eth0: Optional["ContainerNetworkInterfaceStatistics"] = None, + **kwargs + ): super(ContainerInfo, self).__init__(**kwargs) self.current_time_stamp = current_time_stamp self.previous_time_stamp = previous_time_stamp @@ -3372,7 +3965,7 @@ def __init__(self, *, current_time_stamp=None, previous_time_stamp=None, current self.eth0 = eth0 -class ContainerMemoryStatistics(Model): +class ContainerMemoryStatistics(msrest.serialization.Model): """ContainerMemoryStatistics. :param usage: @@ -3389,14 +3982,21 @@ class ContainerMemoryStatistics(Model): 'limit': {'key': 'limit', 'type': 'long'}, } - def __init__(self, *, usage: int=None, max_usage: int=None, limit: int=None, **kwargs) -> None: + def __init__( + self, + *, + usage: Optional[int] = None, + max_usage: Optional[int] = None, + limit: Optional[int] = None, + **kwargs + ): super(ContainerMemoryStatistics, self).__init__(**kwargs) self.usage = usage self.max_usage = max_usage self.limit = limit -class ContainerNetworkInterfaceStatistics(Model): +class ContainerNetworkInterfaceStatistics(msrest.serialization.Model): """ContainerNetworkInterfaceStatistics. :param rx_bytes: @@ -3428,7 +4028,19 @@ class ContainerNetworkInterfaceStatistics(Model): 'tx_dropped': {'key': 'txDropped', 'type': 'long'}, } - def __init__(self, *, rx_bytes: int=None, rx_packets: int=None, rx_errors: int=None, rx_dropped: int=None, tx_bytes: int=None, tx_packets: int=None, tx_errors: int=None, tx_dropped: int=None, **kwargs) -> None: + def __init__( + self, + *, + rx_bytes: Optional[int] = None, + rx_packets: Optional[int] = None, + rx_errors: Optional[int] = None, + rx_dropped: Optional[int] = None, + tx_bytes: Optional[int] = None, + tx_packets: Optional[int] = None, + tx_errors: Optional[int] = None, + tx_dropped: Optional[int] = None, + **kwargs + ): super(ContainerNetworkInterfaceStatistics, self).__init__(**kwargs) self.rx_bytes = rx_bytes self.rx_packets = rx_packets @@ -3440,7 +4052,7 @@ def __init__(self, *, rx_bytes: int=None, rx_packets: int=None, rx_errors: int=N self.tx_dropped = tx_dropped -class ContainerThrottlingData(Model): +class ContainerThrottlingData(msrest.serialization.Model): """ContainerThrottlingData. :param periods: @@ -3457,7 +4069,14 @@ class ContainerThrottlingData(Model): 'throttled_time': {'key': 'throttledTime', 'type': 'int'}, } - def __init__(self, *, periods: int=None, throttled_periods: int=None, throttled_time: int=None, **kwargs) -> None: + def __init__( + self, + *, + periods: Optional[int] = None, + throttled_periods: Optional[int] = None, + throttled_time: Optional[int] = None, + **kwargs + ): super(ContainerThrottlingData, self).__init__(**kwargs) self.periods = periods self.throttled_periods = throttled_periods @@ -3467,8 +4086,7 @@ def __init__(self, *, periods: int=None, throttled_periods: int=None, throttled_ class ContinuousWebJob(ProxyOnlyResource): """Continuous Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3478,10 +4096,9 @@ class ContinuousWebJob(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param status: Job status. Possible values include: 'Initializing', - 'Starting', 'Running', 'PendingRestart', 'Stopped' - :type status: str or - ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobStatus + :param status: Job status. Possible values include: "Initializing", "Starting", "Running", + "PendingRestart", "Stopped". + :type status: str or ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobStatus :param detailed_status: Detailed status. :type detailed_status: str :param log_url: Log URL. @@ -3492,12 +4109,11 @@ class ContinuousWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2019_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -3514,19 +4130,34 @@ class ContinuousWebJob(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ContinuousWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'detailed_status': {'key': 'properties.detailed_status', 'type': 'str'}, 'log_url': {'key': 'properties.log_url', 'type': 'str'}, 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, status=None, detailed_status: str=None, log_url: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, web_job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + status: Optional[Union[str, "ContinuousWebJobStatus"]] = None, + detailed_status: Optional[str] = None, + log_url: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + web_job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(ContinuousWebJob, self).__init__(kind=kind, **kwargs) self.status = status self.detailed_status = detailed_status @@ -3540,15 +4171,49 @@ def __init__(self, *, kind: str=None, status=None, detailed_status: str=None, lo self.settings = settings -class CorsSettings(Model): +class ContinuousWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContinuousWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ContinuousWebJob"], + **kwargs + ): + super(ContinuousWebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings for the app. - :param allowed_origins: Gets or sets the list of origins that should be - allowed to make cross-origin + :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- + origin calls (for example: http://example.com:12345). Use "*" to allow all. :type allowed_origins: list[str] - :param support_credentials: Gets or sets whether CORS requests with - credentials are allowed. See + :param support_credentials: Gets or sets whether CORS requests with credentials are allowed. + See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials for more details. :type support_credentials: bool @@ -3559,25 +4224,29 @@ class CorsSettings(Model): 'support_credentials': {'key': 'supportCredentials', 'type': 'bool'}, } - def __init__(self, *, allowed_origins=None, support_credentials: bool=None, **kwargs) -> None: + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + support_credentials: Optional[bool] = None, + **kwargs + ): super(CorsSettings, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.support_credentials = support_credentials -class CsmCopySlotEntity(Model): +class CsmCopySlotEntity(msrest.serialization.Model): """Copy deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during copy - operation. + :param target_slot: Required. Destination deployment slot during copy operation. :type target_slot: str - :param site_config: Required. The site object which will be merged with - the source slot site + :param site_config: Required. The site object which will be merged with the source slot site to produce new destination slot site object. - null to just copy source slot content. Otherwise a - Site + :code:`null` to just copy source slot content. Otherwise a + :code:`Site` object with properties to override source slot site. :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig """ @@ -3592,15 +4261,20 @@ class CsmCopySlotEntity(Model): 'site_config': {'key': 'siteConfig', 'type': 'SiteConfig'}, } - def __init__(self, *, target_slot: str, site_config, **kwargs) -> None: + def __init__( + self, + *, + target_slot: str, + site_config: "SiteConfig", + **kwargs + ): super(CsmCopySlotEntity, self).__init__(**kwargs) self.target_slot = target_slot self.site_config = site_config -class CsmMoveResourceEnvelope(Model): - """Object with a list of the resources that need to be moved and the resource - group they should be moved to. +class CsmMoveResourceEnvelope(msrest.serialization.Model): + """Object with a list of the resources that need to be moved and the resource group they should be moved to. :param target_resource_group: :type target_resource_group: str @@ -3617,24 +4291,63 @@ class CsmMoveResourceEnvelope(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, *, target_resource_group: str=None, resources=None, **kwargs) -> None: + def __init__( + self, + *, + target_resource_group: Optional[str] = None, + resources: Optional[List[str]] = None, + **kwargs + ): super(CsmMoveResourceEnvelope, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources -class CsmOperationDescription(Model): +class CsmOperationCollection(msrest.serialization.Model): + """Collection of Azure resource manager operation metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.CsmOperationDescription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmOperationDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmOperationDescription"], + **kwargs + ): + super(CsmOperationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CsmOperationDescription(msrest.serialization.Model): """Description of an operation available for Microsoft.Web resource provider. :param name: :type name: str - :param display: + :param display: Meta data about operation used for display in portal. :type display: ~azure.mgmt.web.v2019_08_01.models.CsmOperationDisplay :param origin: :type origin: str - :param properties: - :type properties: - ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionProperties + :param properties: Properties available for a Microsoft.Web resource provider operation. + :type properties: ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionProperties """ _attribute_map = { @@ -3644,7 +4357,15 @@ class CsmOperationDescription(Model): 'properties': {'key': 'properties', 'type': 'CsmOperationDescriptionProperties'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["CsmOperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["CsmOperationDescriptionProperties"] = None, + **kwargs + ): super(CsmOperationDescription, self).__init__(**kwargs) self.name = name self.display = display @@ -3652,24 +4373,29 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties self.properties = properties -class CsmOperationDescriptionProperties(Model): +class CsmOperationDescriptionProperties(msrest.serialization.Model): """Properties available for a Microsoft.Web resource provider operation. - :param service_specification: - :type service_specification: - ~azure.mgmt.web.v2019_08_01.models.ServiceSpecification + :param service_specification: Resource metrics service provided by Microsoft.Insights resource + provider. + :type service_specification: ~azure.mgmt.web.v2019_08_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(CsmOperationDescriptionProperties, self).__init__(**kwargs) self.service_specification = service_specification -class CsmOperationDisplay(Model): +class CsmOperationDisplay(msrest.serialization.Model): """Meta data about operation used for display in portal. :param provider: @@ -3689,7 +4415,15 @@ class CsmOperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(CsmOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3697,17 +4431,105 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class CsmPublishingProfileOptions(Model): +class CsmPublishingCredentialsPoliciesCollection(ProxyOnlyResource): + """Publishing Credentials Policies collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :param ftp: Whether FTP is allowed. + :type ftp: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :param scm: Whether Scm Basic Auth is allowed. + :type scm: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'ftp': {'key': 'properties.ftp', 'type': 'CsmPublishingCredentialsPoliciesEntity'}, + 'scm': {'key': 'properties.scm', 'type': 'CsmPublishingCredentialsPoliciesEntity'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + ftp: Optional["CsmPublishingCredentialsPoliciesEntity"] = None, + scm: Optional["CsmPublishingCredentialsPoliciesEntity"] = None, + **kwargs + ): + super(CsmPublishingCredentialsPoliciesCollection, self).__init__(kind=kind, **kwargs) + self.ftp = ftp + self.scm = scm + + +class CsmPublishingCredentialsPoliciesEntity(ProxyOnlyResource): + """Publishing Credentials Policies parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :param allow: :code:`true` to allow access to a publishing method; otherwise, + :code:`false`. + :type allow: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'allow': {'key': 'properties.allow', 'type': 'bool'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + allow: Optional[bool] = None, + **kwargs + ): + super(CsmPublishingCredentialsPoliciesEntity, self).__init__(kind=kind, **kwargs) + self.allow = allow + + +class CsmPublishingProfileOptions(msrest.serialization.Model): """Publishing options for requested profile. :param format: Name of the format. Valid values are: FileZilla3 WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2019_08_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the DisasterRecover - endpoint if true + Ftp. Possible values include: "FileZilla3", "WebDeploy", "Ftp". + :type format: str or ~azure.mgmt.web.v2019_08_01.models.PublishingProfileFormat + :param include_disaster_recovery_endpoints: Include the DisasterRecover endpoint if true. :type include_disaster_recovery_endpoints: bool """ @@ -3716,22 +4538,27 @@ class CsmPublishingProfileOptions(Model): 'include_disaster_recovery_endpoints': {'key': 'includeDisasterRecoveryEndpoints', 'type': 'bool'}, } - def __init__(self, *, format=None, include_disaster_recovery_endpoints: bool=None, **kwargs) -> None: + def __init__( + self, + *, + format: Optional[Union[str, "PublishingProfileFormat"]] = None, + include_disaster_recovery_endpoints: Optional[bool] = None, + **kwargs + ): super(CsmPublishingProfileOptions, self).__init__(**kwargs) self.format = format self.include_disaster_recovery_endpoints = include_disaster_recovery_endpoints -class CsmSlotEntity(Model): +class CsmSlotEntity(msrest.serialization.Model): """Deployment slot parameters. All required parameters must be populated in order to send to Azure. - :param target_slot: Required. Destination deployment slot during swap - operation. + :param target_slot: Required. Destination deployment slot during swap operation. :type target_slot: str - :param preserve_vnet: Required. true to preserve Virtual - Network to the slot during swap; otherwise, false. + :param preserve_vnet: Required. :code:`true` to preserve Virtual Network to the + slot during swap; otherwise, :code:`false`. :type preserve_vnet: bool """ @@ -3745,19 +4572,25 @@ class CsmSlotEntity(Model): 'preserve_vnet': {'key': 'preserveVnet', 'type': 'bool'}, } - def __init__(self, *, target_slot: str, preserve_vnet: bool, **kwargs) -> None: + def __init__( + self, + *, + target_slot: str, + preserve_vnet: bool, + **kwargs + ): super(CsmSlotEntity, self).__init__(**kwargs) self.target_slot = target_slot self.preserve_vnet = preserve_vnet -class CsmUsageQuota(Model): +class CsmUsageQuota(msrest.serialization.Model): """Usage of the quota resource. :param unit: Units of measurement for the quota resource. :type unit: str :param next_reset_time: Next reset time for the resource counter. - :type next_reset_time: datetime + :type next_reset_time: ~datetime.datetime :param current_value: The current value of the resource counter. :type current_value: long :param limit: The resource limit. @@ -3774,7 +4607,16 @@ class CsmUsageQuota(Model): 'name': {'key': 'name', 'type': 'LocalizableString'}, } - def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=None, limit: int=None, name=None, **kwargs) -> None: + def __init__( + self, + *, + unit: Optional[str] = None, + next_reset_time: Optional[datetime.datetime] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["LocalizableString"] = None, + **kwargs + ): super(CsmUsageQuota, self).__init__(**kwargs) self.unit = unit self.next_reset_time = next_reset_time @@ -3783,11 +4625,44 @@ def __init__(self, *, unit: str=None, next_reset_time=None, current_value: int=N self.name = name +class CsmUsageQuotaCollection(msrest.serialization.Model): + """Collection of CSM usage quotas. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuota] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CsmUsageQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CsmUsageQuota"], + **kwargs + ): + super(CsmUsageQuotaCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class CustomHostnameAnalysisResult(ProxyOnlyResource): """Custom domain analysis. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -3797,25 +4672,25 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar is_hostname_already_verified: true if hostname is - already verified; otherwise, false. + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. - Possible values include: 'Passed', 'Failed', 'Skipped' + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.web.v2019_08_01.models.DnsVerificationTestResult - :ivar custom_domain_verification_failure_info: Raw failure information if - DNS verification fails. + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. :vartype custom_domain_verification_failure_info: ~azure.mgmt.web.v2019_08_01.models.ErrorEntity - :ivar has_conflict_on_scale_unit: true if there is a conflict - on a scale unit; otherwise, false. + :ivar has_conflict_on_scale_unit: :code:`true` if there is a conflict on a scale + unit; otherwise, :code:`false`. :vartype has_conflict_on_scale_unit: bool - :ivar has_conflict_across_subscription: true if there is a - conflict across subscriptions; otherwise, false. + :ivar has_conflict_across_subscription: :code:`true` if there is a conflict across + subscriptions; otherwise, :code:`false`. :vartype has_conflict_across_subscription: bool - :ivar conflicting_app_resource_id: Name of the conflicting app on scale - unit if it's within the same subscription. + :ivar conflicting_app_resource_id: Name of the conflicting app on scale unit if it's within the + same subscription. :vartype conflicting_app_resource_id: str :param c_name_records: CName records controller can see for this hostname. :type c_name_records: list[str] @@ -3823,11 +4698,9 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): :type txt_records: list[str] :param a_records: A records controller can see for this hostname. :type a_records: list[str] - :param alternate_cname_records: Alternate CName records controller can see - for this hostname. - :type alternate_cname_records: list[str] - :param alternate_txt_records: Alternate TXT records controller can see for - this hostname. + :param alternate_c_name_records: Alternate CName records controller can see for this hostname. + :type alternate_c_name_records: list[str] + :param alternate_txt_records: Alternate TXT records controller can see for this hostname. :type alternate_txt_records: list[str] """ @@ -3849,7 +4722,7 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'DnsVerificationTestResult'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'ErrorEntity'}, 'has_conflict_on_scale_unit': {'key': 'properties.hasConflictOnScaleUnit', 'type': 'bool'}, 'has_conflict_across_subscription': {'key': 'properties.hasConflictAcrossSubscription', 'type': 'bool'}, @@ -3857,11 +4730,21 @@ class CustomHostnameAnalysisResult(ProxyOnlyResource): 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_cname_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, } - def __init__(self, *, kind: str=None, c_name_records=None, txt_records=None, a_records=None, alternate_cname_records=None, alternate_txt_records=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + c_name_records: Optional[List[str]] = None, + txt_records: Optional[List[str]] = None, + a_records: Optional[List[str]] = None, + alternate_c_name_records: Optional[List[str]] = None, + alternate_txt_records: Optional[List[str]] = None, + **kwargs + ): super(CustomHostnameAnalysisResult, self).__init__(kind=kind, **kwargs) self.is_hostname_already_verified = None self.custom_domain_verification_test = None @@ -3872,28 +4755,27 @@ def __init__(self, *, kind: str=None, c_name_records=None, txt_records=None, a_r self.c_name_records = c_name_records self.txt_records = txt_records self.a_records = a_records - self.alternate_cname_records = alternate_cname_records + self.alternate_c_name_records = alternate_c_name_records self.alternate_txt_records = alternate_txt_records -class DatabaseBackupSetting(Model): +class DatabaseBackupSetting(msrest.serialization.Model): """Database backup settings. All required parameters must be populated in order to send to Azure. - :param database_type: Required. Database type (e.g. SqlAzure / MySql). - Possible values include: 'SqlAzure', 'MySql', 'LocalMySql', 'PostgreSql' - :type database_type: str or - ~azure.mgmt.web.v2019_08_01.models.DatabaseType + :param database_type: Required. Database type (e.g. SqlAzure / MySql). Possible values include: + "SqlAzure", "MySql", "LocalMySql", "PostgreSql". + :type database_type: str or ~azure.mgmt.web.v2019_08_01.models.DatabaseType :param name: :type name: str - :param connection_string_name: Contains a connection string name that is - linked to the SiteConfig.ConnectionStrings. + :param connection_string_name: Contains a connection string name that is linked to the + SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. :type connection_string_name: str - :param connection_string: Contains a connection string to a database which - is being backed up or restored. If the restore should happen to a new - database, the database name inside is the new one. + :param connection_string: Contains a connection string to a database which is being backed up + or restored. If the restore should happen to a new database, the database name inside is the + new one. :type connection_string: str """ @@ -3908,7 +4790,15 @@ class DatabaseBackupSetting(Model): 'connection_string': {'key': 'connectionString', 'type': 'str'}, } - def __init__(self, *, database_type, name: str=None, connection_string_name: str=None, connection_string: str=None, **kwargs) -> None: + def __init__( + self, + *, + database_type: Union[str, "DatabaseType"], + name: Optional[str] = None, + connection_string_name: Optional[str] = None, + connection_string: Optional[str] = None, + **kwargs + ): super(DatabaseBackupSetting, self).__init__(**kwargs) self.database_type = database_type self.name = name @@ -3916,14 +4806,13 @@ def __init__(self, *, database_type, name: str=None, connection_string_name: str self.connection_string = connection_string -class DataSource(Model): +class DataSource(msrest.serialization.Model): """Class representing data source used by the detectors. - :param instructions: Instructions if any for the data source + :param instructions: Instructions if any for the data source. :type instructions: list[str] - :param data_source_uri: Datasource Uri Links - :type data_source_uri: - list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] + :param data_source_uri: Datasource Uri Links. + :type data_source_uri: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] """ _attribute_map = { @@ -3931,20 +4820,26 @@ class DataSource(Model): 'data_source_uri': {'key': 'dataSourceUri', 'type': '[NameValuePair]'}, } - def __init__(self, *, instructions=None, data_source_uri=None, **kwargs) -> None: + def __init__( + self, + *, + instructions: Optional[List[str]] = None, + data_source_uri: Optional[List["NameValuePair"]] = None, + **kwargs + ): super(DataSource, self).__init__(**kwargs) self.instructions = instructions self.data_source_uri = data_source_uri -class DataTableResponseColumn(Model): +class DataTableResponseColumn(msrest.serialization.Model): """Column definition. - :param column_name: Name of the column + :param column_name: Name of the column. :type column_name: str :param data_type: Data type which looks like 'String' or 'Int32'. :type data_type: str - :param column_type: Column Type + :param column_type: Column Type. :type column_type: str """ @@ -3954,22 +4849,28 @@ class DataTableResponseColumn(Model): 'column_type': {'key': 'columnType', 'type': 'str'}, } - def __init__(self, *, column_name: str=None, data_type: str=None, column_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + column_name: Optional[str] = None, + data_type: Optional[str] = None, + column_type: Optional[str] = None, + **kwargs + ): super(DataTableResponseColumn, self).__init__(**kwargs) self.column_name = column_name self.data_type = data_type self.column_type = column_type -class DataTableResponseObject(Model): +class DataTableResponseObject(msrest.serialization.Model): """Data Table which defines columns and raw row values. - :param table_name: Name of the table + :param table_name: Name of the table. :type table_name: str - :param columns: List of columns with data types - :type columns: - list[~azure.mgmt.web.v2019_08_01.models.DataTableResponseColumn] - :param rows: Raw row values + :param columns: List of columns with data types. + :type columns: list[~azure.mgmt.web.v2019_08_01.models.DataTableResponseColumn] + :param rows: Raw row values. :type rows: list[list[str]] """ @@ -3979,22 +4880,27 @@ class DataTableResponseObject(Model): 'rows': {'key': 'rows', 'type': '[[str]]'}, } - def __init__(self, *, table_name: str=None, columns=None, rows=None, **kwargs) -> None: + def __init__( + self, + *, + table_name: Optional[str] = None, + columns: Optional[List["DataTableResponseColumn"]] = None, + rows: Optional[List[List[str]]] = None, + **kwargs + ): super(DataTableResponseObject, self).__init__(**kwargs) self.table_name = table_name self.columns = columns self.rows = rows -class DefaultErrorResponse(Model): +class DefaultErrorResponse(msrest.serialization.Model): """App Service error response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar error: Error model. - :vartype error: - ~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseError + :vartype error: ~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseError """ _validation = { @@ -4005,28 +4911,18 @@ class DefaultErrorResponse(Model): 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponse, self).__init__(**kwargs) self.error = None -class DefaultErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'DefaultErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(DefaultErrorResponseException, self).__init__(deserialize, response, 'DefaultErrorResponse', *args) - - -class DefaultErrorResponseError(Model): +class DefaultErrorResponseError(msrest.serialization.Model): """Error model. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -4035,8 +4931,7 @@ class DefaultErrorResponseError(Model): :ivar target: Detailed error description and debugging information. :vartype target: str :param details: - :type details: - list[~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseErrorDetailsItem] + :type details: list[~azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseErrorDetailsItem] :ivar innererror: More information to debug error. :vartype innererror: str """ @@ -4056,7 +4951,12 @@ class DefaultErrorResponseError(Model): 'innererror': {'key': 'innererror', 'type': 'str'}, } - def __init__(self, *, details=None, **kwargs) -> None: + def __init__( + self, + *, + details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + **kwargs + ): super(DefaultErrorResponseError, self).__init__(**kwargs) self.code = None self.message = None @@ -4065,11 +4965,10 @@ def __init__(self, *, details=None, **kwargs) -> None: self.innererror = None -class DefaultErrorResponseErrorDetailsItem(Model): +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): """Detailed errors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: Standardized string to programmatically identify the error. :vartype code: str @@ -4091,7 +4990,10 @@ class DefaultErrorResponseErrorDetailsItem(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = None self.message = None @@ -4101,8 +5003,7 @@ def __init__(self, **kwargs) -> None: class DeletedAppRestoreRequest(ProxyOnlyResource): """Details about restoring a deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4113,17 +5014,16 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param deleted_site_id: ARM resource ID of the deleted app. Example: - /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}. :type deleted_site_id: str - :param recover_configuration: If true, deleted site configuration, in - addition to content, will be restored. + :param recover_configuration: If true, deleted site configuration, in addition to content, will + be restored. :type recover_configuration: bool - :param snapshot_time: Point in time to restore the deleted app from, - formatted as a DateTime string. + :param snapshot_time: Point in time to restore the deleted app from, formatted as a DateTime + string. If unspecified, default value is the time that the app was deleted. :type snapshot_time: str - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -4144,7 +5044,16 @@ class DeletedAppRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, deleted_site_id: str=None, recover_configuration: bool=None, snapshot_time: str=None, use_dr_secondary: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + deleted_site_id: Optional[str] = None, + recover_configuration: Optional[bool] = None, + snapshot_time: Optional[str] = None, + use_dr_secondary: Optional[bool] = None, + **kwargs + ): super(DeletedAppRestoreRequest, self).__init__(kind=kind, **kwargs) self.deleted_site_id = deleted_site_id self.recover_configuration = recover_configuration @@ -4155,8 +5064,7 @@ def __init__(self, *, kind: str=None, deleted_site_id: str=None, recover_configu class DeletedSite(ProxyOnlyResource): """A deleted app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4166,21 +5074,21 @@ class DeletedSite(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deleted_site_id: Numeric id for the deleted site + :ivar deleted_site_id: Numeric id for the deleted site. :vartype deleted_site_id: int :ivar deleted_timestamp: Time in UTC when the app was deleted. :vartype deleted_timestamp: str - :ivar subscription: Subscription containing the deleted site + :ivar subscription: Subscription containing the deleted site. :vartype subscription: str - :ivar resource_group: ResourceGroup that contained the deleted site + :ivar resource_group: ResourceGroup that contained the deleted site. :vartype resource_group: str - :ivar deleted_site_name: Name of the deleted site + :ivar deleted_site_name: Name of the deleted site. :vartype deleted_site_name: str - :ivar slot: Slot of the deleted site + :ivar slot: Slot of the deleted site. :vartype slot: str - :ivar deleted_site_kind: Kind of site that was deleted - :vartype deleted_site_kind: str - :ivar geo_region_name: Geo Region of the deleted site + :ivar kind_properties_kind: Kind of site that was deleted. + :vartype kind_properties_kind: str + :ivar geo_region_name: Geo Region of the deleted site. :vartype geo_region_name: str """ @@ -4194,7 +5102,7 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'readonly': True}, 'deleted_site_name': {'readonly': True}, 'slot': {'readonly': True}, - 'deleted_site_kind': {'readonly': True}, + 'kind_properties_kind': {'readonly': True}, 'geo_region_name': {'readonly': True}, } @@ -4209,11 +5117,16 @@ class DeletedSite(ProxyOnlyResource): 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, 'deleted_site_name': {'key': 'properties.deletedSiteName', 'type': 'str'}, 'slot': {'key': 'properties.slot', 'type': 'str'}, - 'deleted_site_kind': {'key': 'properties.kind', 'type': 'str'}, + 'kind_properties_kind': {'key': 'properties.kind', 'type': 'str'}, 'geo_region_name': {'key': 'properties.geoRegionName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DeletedSite, self).__init__(kind=kind, **kwargs) self.deleted_site_id = None self.deleted_timestamp = None @@ -4221,15 +5134,48 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.resource_group = None self.deleted_site_name = None self.slot = None - self.deleted_site_kind = None + self.kind_properties_kind = None self.geo_region_name = None +class DeletedWebAppCollection(msrest.serialization.Model): + """Collection of deleted apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DeletedSite] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DeletedSite"], + **kwargs + ): + super(DeletedWebAppCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class Deployment(ProxyOnlyResource): """User credentials used for publishing activity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4250,11 +5196,11 @@ class Deployment(ProxyOnlyResource): :param author_email: Author email. :type author_email: str :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime - :param active: True if deployment is currently active, false if completed - and null if not started. + :type end_time: ~datetime.datetime + :param active: True if deployment is currently active, false if completed and null if not + started. :type active: bool :param details: Details on deployment. :type details: str @@ -4282,7 +5228,21 @@ class Deployment(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, *, kind: str=None, status: int=None, message: str=None, author: str=None, deployer: str=None, author_email: str=None, start_time=None, end_time=None, active: bool=None, details: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + status: Optional[int] = None, + message: Optional[str] = None, + author: Optional[str] = None, + deployer: Optional[str] = None, + author_email: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + active: Optional[bool] = None, + details: Optional[str] = None, + **kwargs + ): super(Deployment, self).__init__(kind=kind, **kwargs) self.status = status self.message = message @@ -4295,18 +5255,51 @@ def __init__(self, *, kind: str=None, status: int=None, message: str=None, autho self.details = details -class DeploymentLocations(Model): +class DeploymentCollection(msrest.serialization.Model): + """Collection of app deployments. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Deployment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Deployment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Deployment"], + **kwargs + ): + super(DeploymentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentLocations(msrest.serialization.Model): """List of available locations (regions or App Service Environments) for - deployment of App Service resources. +deployment of App Service resources. :param locations: Available regions. :type locations: list[~azure.mgmt.web.v2019_08_01.models.GeoRegion] - :param hosting_environments: Available App Service Environments with full - descriptions of the environments. - :type hosting_environments: - list[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironment] - :param hosting_environment_deployment_infos: Available App Service - Environments with basic information. + :param hosting_environments: Available App Service Environments with full descriptions of the + environments. + :type hosting_environments: list[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironment] + :param hosting_environment_deployment_infos: Available App Service Environments with basic + information. :type hosting_environment_deployment_infos: list[~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDeploymentInfo] """ @@ -4317,34 +5310,40 @@ class DeploymentLocations(Model): 'hosting_environment_deployment_infos': {'key': 'hostingEnvironmentDeploymentInfos', 'type': '[HostingEnvironmentDeploymentInfo]'}, } - def __init__(self, *, locations=None, hosting_environments=None, hosting_environment_deployment_infos=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List["GeoRegion"]] = None, + hosting_environments: Optional[List["AppServiceEnvironment"]] = None, + hosting_environment_deployment_infos: Optional[List["HostingEnvironmentDeploymentInfo"]] = None, + **kwargs + ): super(DeploymentLocations, self).__init__(**kwargs) self.locations = locations self.hosting_environments = hosting_environments self.hosting_environment_deployment_infos = hosting_environment_deployment_infos -class DetectorAbnormalTimePeriod(Model): +class DetectorAbnormalTimePeriod(msrest.serialization.Model): """Class representing Abnormal Time Period detected. - :param start_time: Start time of the correlated event - :type start_time: datetime - :param end_time: End time of the correlated event - :type end_time: datetime - :param message: Message describing the event + :param start_time: Start time of the correlated event. + :type start_time: ~datetime.datetime + :param end_time: End time of the correlated event. + :type end_time: ~datetime.datetime + :param message: Message describing the event. :type message: str - :param source: Represents the name of the Detector + :param source: Represents the name of the Detector. :type source: str - :param priority: Represents the rank of the Detector + :param priority: Represents the rank of the Detector. :type priority: float - :param meta_data: Downtime metadata - :type meta_data: - list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] - :param type: Represents the type of the Detector. Possible values include: - 'ServiceIncident', 'AppDeployment', 'AppCrash', 'RuntimeIssueDetected', - 'AseDeployment', 'UserIssue', 'PlatformIssue', 'Other' + :param meta_data: Downtime metadata. + :type meta_data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] + :param type: Represents the type of the Detector. Possible values include: "ServiceIncident", + "AppDeployment", "AppCrash", "RuntimeIssueDetected", "AseDeployment", "UserIssue", + "PlatformIssue", "Other". :type type: str or ~azure.mgmt.web.v2019_08_01.models.IssueType - :param solutions: List of proposed solutions + :param solutions: List of proposed solutions. :type solutions: list[~azure.mgmt.web.v2019_08_01.models.Solution] """ @@ -4355,11 +5354,23 @@ class DetectorAbnormalTimePeriod(Model): 'source': {'key': 'source', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'float'}, 'meta_data': {'key': 'metaData', 'type': '[[NameValuePair]]'}, - 'type': {'key': 'type', 'type': 'IssueType'}, + 'type': {'key': 'type', 'type': 'str'}, 'solutions': {'key': 'solutions', 'type': '[Solution]'}, } - def __init__(self, *, start_time=None, end_time=None, message: str=None, source: str=None, priority: float=None, meta_data=None, type=None, solutions=None, **kwargs) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + message: Optional[str] = None, + source: Optional[str] = None, + priority: Optional[float] = None, + meta_data: Optional[List[List["NameValuePair"]]] = None, + type: Optional[Union[str, "IssueType"]] = None, + solutions: Optional[List["Solution"]] = None, + **kwargs + ): super(DetectorAbnormalTimePeriod, self).__init__(**kwargs) self.start_time = start_time self.end_time = end_time @@ -4374,8 +5385,7 @@ def __init__(self, *, start_time=None, end_time=None, message: str=None, source: class DetectorDefinition(ProxyOnlyResource): """Class representing detector definition. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4385,11 +5395,11 @@ class DetectorDefinition(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar display_name: Display name of the detector + :ivar display_name: Display name of the detector. :vartype display_name: str - :ivar description: Description of the detector + :ivar description: Description of the detector. :vartype description: str - :ivar rank: Detector Rank + :ivar rank: Detector Rank. :vartype rank: float :ivar is_enabled: Flag representing whether detector is enabled or not. :vartype is_enabled: bool @@ -4416,7 +5426,12 @@ class DetectorDefinition(ProxyOnlyResource): 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DetectorDefinition, self).__init__(kind=kind, **kwargs) self.display_name = None self.description = None @@ -4424,19 +5439,18 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.is_enabled = None -class DetectorInfo(Model): +class DetectorInfo(msrest.serialization.Model): """Definition of Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Short description of the detector and its purpose + :ivar description: Short description of the detector and its purpose. :vartype description: str - :ivar category: Support Category + :ivar category: Support Category. :vartype category: str - :ivar sub_category: Support Sub Category + :ivar sub_category: Support Sub Category. :vartype sub_category: str - :ivar support_topic_id: Support Topic Id + :ivar support_topic_id: Support Topic Id. :vartype support_topic_id: str """ @@ -4454,7 +5468,10 @@ class DetectorInfo(Model): 'support_topic_id': {'key': 'supportTopicId', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DetectorInfo, self).__init__(**kwargs) self.description = None self.category = None @@ -4465,8 +5482,7 @@ def __init__(self, **kwargs) -> None: class DetectorResponse(ProxyOnlyResource): """Class representing Response from Detector. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4476,9 +5492,9 @@ class DetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param metadata: metadata for the detector + :param metadata: metadata for the detector. :type metadata: ~azure.mgmt.web.v2019_08_01.models.DetectorInfo - :param dataset: Data Set + :param dataset: Data Set. :type dataset: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticData] """ @@ -4497,17 +5513,57 @@ class DetectorResponse(ProxyOnlyResource): 'dataset': {'key': 'properties.dataset', 'type': '[DiagnosticData]'}, } - def __init__(self, *, kind: str=None, metadata=None, dataset=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + metadata: Optional["DetectorInfo"] = None, + dataset: Optional[List["DiagnosticData"]] = None, + **kwargs + ): super(DetectorResponse, self).__init__(kind=kind, **kwargs) self.metadata = metadata self.dataset = dataset +class DetectorResponseCollection(msrest.serialization.Model): + """Collection of detector responses. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DetectorResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DetectorResponse"], + **kwargs + ): + super(DetectorResponseCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticAnalysis(ProxyOnlyResource): """Class representing a diagnostic analysis done on an application. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4517,19 +5573,16 @@ class DiagnosticAnalysis(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param abnormal_time_periods: List of time periods. - :type abnormal_time_periods: - list[~azure.mgmt.web.v2019_08_01.models.AbnormalTimePeriod] - :param payload: Data by each detector + :type abnormal_time_periods: list[~azure.mgmt.web.v2019_08_01.models.AbnormalTimePeriod] + :param payload: Data by each detector. :type payload: list[~azure.mgmt.web.v2019_08_01.models.AnalysisData] - :param non_correlated_detectors: Data by each detector for detectors that - did not corelate - :type non_correlated_detectors: - list[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] + :param non_correlated_detectors: Data by each detector for detectors that did not corelate. + :type non_correlated_detectors: list[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] """ _validation = { @@ -4550,7 +5603,17 @@ class DiagnosticAnalysis(ProxyOnlyResource): 'non_correlated_detectors': {'key': 'properties.nonCorrelatedDetectors', 'type': '[DetectorDefinition]'}, } - def __init__(self, *, kind: str=None, start_time=None, end_time=None, abnormal_time_periods=None, payload=None, non_correlated_detectors=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + abnormal_time_periods: Optional[List["AbnormalTimePeriod"]] = None, + payload: Optional[List["AnalysisData"]] = None, + non_correlated_detectors: Optional[List["DetectorDefinition"]] = None, + **kwargs + ): super(DiagnosticAnalysis, self).__init__(kind=kind, **kwargs) self.start_time = start_time self.end_time = end_time @@ -4559,23 +5622,56 @@ def __init__(self, *, kind: str=None, start_time=None, end_time=None, abnormal_t self.non_correlated_detectors = non_correlated_detectors -class DiagnosticCategory(ProxyOnlyResource): - """Class representing detector definition. +class DiagnosticAnalysisCollection(msrest.serialization.Model): + """Collection of Diagnostic Analyses. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :param kind: Kind of resource. - :type kind: str - :ivar type: Resource type. - :vartype type: str - :ivar description: Description of the diagnostic category - :vartype description: str - """ + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AnalysisDefinition"], + **kwargs + ): + super(DiagnosticAnalysisCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DiagnosticCategory(ProxyOnlyResource): + """Class representing detector definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :ivar description: Description of the diagnostic category. + :vartype description: str + """ _validation = { 'id': {'readonly': True}, @@ -4592,18 +5688,56 @@ class DiagnosticCategory(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(DiagnosticCategory, self).__init__(kind=kind, **kwargs) self.description = None -class DiagnosticData(Model): +class DiagnosticCategoryCollection(msrest.serialization.Model): + """Collection of Diagnostic Categories. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticCategory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiagnosticCategory"], + **kwargs + ): + super(DiagnosticCategoryCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DiagnosticData(msrest.serialization.Model): """Set of data with rendering instructions. - :param table: Data in table form + :param table: Data in table form. :type table: ~azure.mgmt.web.v2019_08_01.models.DataTableResponseObject - :param rendering_properties: Properties that describe how the table should - be rendered + :param rendering_properties: Properties that describe how the table should be rendered. :type rendering_properties: ~azure.mgmt.web.v2019_08_01.models.Rendering """ @@ -4612,17 +5746,56 @@ class DiagnosticData(Model): 'rendering_properties': {'key': 'renderingProperties', 'type': 'Rendering'}, } - def __init__(self, *, table=None, rendering_properties=None, **kwargs) -> None: + def __init__( + self, + *, + table: Optional["DataTableResponseObject"] = None, + rendering_properties: Optional["Rendering"] = None, + **kwargs + ): super(DiagnosticData, self).__init__(**kwargs) self.table = table self.rendering_properties = rendering_properties +class DiagnosticDetectorCollection(msrest.serialization.Model): + """Collection of Diagnostic Detectors. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DetectorDefinition"], + **kwargs + ): + super(DiagnosticDetectorCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class DiagnosticDetectorResponse(ProxyOnlyResource): """Class representing Response from Diagnostic Detectors. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -4632,27 +5805,23 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime :param issue_detected: Flag representing Issue was detected. :type issue_detected: bool - :param detector_definition: Detector's definition - :type detector_definition: - ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition - :param metrics: Metrics provided by the detector - :type metrics: - list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] - :param abnormal_time_periods: List of Correlated events found by the - detector + :param detector_definition: Detector's definition. + :type detector_definition: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :param metrics: Metrics provided by the detector. + :type metrics: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSet] + :param abnormal_time_periods: List of Correlated events found by the detector. :type abnormal_time_periods: list[~azure.mgmt.web.v2019_08_01.models.DetectorAbnormalTimePeriod] :param data: Additional Data that detector wants to send. :type data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] - :param response_meta_data: Meta Data - :type response_meta_data: - ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData + :param response_meta_data: Meta Data. + :type response_meta_data: ~azure.mgmt.web.v2019_08_01.models.ResponseMetaData """ _validation = { @@ -4676,7 +5845,20 @@ class DiagnosticDetectorResponse(ProxyOnlyResource): 'response_meta_data': {'key': 'properties.responseMetaData', 'type': 'ResponseMetaData'}, } - def __init__(self, *, kind: str=None, start_time=None, end_time=None, issue_detected: bool=None, detector_definition=None, metrics=None, abnormal_time_periods=None, data=None, response_meta_data=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + issue_detected: Optional[bool] = None, + detector_definition: Optional["DetectorDefinition"] = None, + metrics: Optional[List["DiagnosticMetricSet"]] = None, + abnormal_time_periods: Optional[List["DetectorAbnormalTimePeriod"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + response_meta_data: Optional["ResponseMetaData"] = None, + **kwargs + ): super(DiagnosticDetectorResponse, self).__init__(kind=kind, **kwargs) self.start_time = start_time self.end_time = end_time @@ -4688,28 +5870,24 @@ def __init__(self, *, kind: str=None, start_time=None, end_time=None, issue_dete self.response_meta_data = response_meta_data -class DiagnosticMetricSample(Model): +class DiagnosticMetricSample(msrest.serialization.Model): """Class representing Diagnostic Metric. - :param timestamp: Time at which metric is measured - :type timestamp: datetime - :param role_instance: Role Instance. Null if this counter is not per - instance - This is returned and should be whichever instance name we desire to be - returned + :param timestamp: Time at which metric is measured. + :type timestamp: ~datetime.datetime + :param role_instance: Role Instance. Null if this counter is not per instance + This is returned and should be whichever instance name we desire to be returned i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) - where RDWORKERNAME is Machine name below and RoleInstance name in - parenthesis + where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis. :type role_instance: str - :param total: Total value of the metric. If multiple measurements are made - this will have sum of all. + :param total: Total value of the metric. If multiple measurements are made this will have sum + of all. :type total: float - :param maximum: Maximum of the metric sampled during the time period + :param maximum: Maximum of the metric sampled during the time period. :type maximum: float - :param minimum: Minimum of the metric sampled during the time period + :param minimum: Minimum of the metric sampled during the time period. :type minimum: float - :param is_aggregated: Whether the values are aggregates across all workers - or not + :param is_aggregated: Whether the values are aggregates across all workers or not. :type is_aggregated: bool """ @@ -4722,7 +5900,17 @@ class DiagnosticMetricSample(Model): 'is_aggregated': {'key': 'isAggregated', 'type': 'bool'}, } - def __init__(self, *, timestamp=None, role_instance: str=None, total: float=None, maximum: float=None, minimum: float=None, is_aggregated: bool=None, **kwargs) -> None: + def __init__( + self, + *, + timestamp: Optional[datetime.datetime] = None, + role_instance: Optional[str] = None, + total: Optional[float] = None, + maximum: Optional[float] = None, + minimum: Optional[float] = None, + is_aggregated: Optional[bool] = None, + **kwargs + ): super(DiagnosticMetricSample, self).__init__(**kwargs) self.timestamp = timestamp self.role_instance = role_instance @@ -4732,25 +5920,22 @@ def __init__(self, *, timestamp=None, role_instance: str=None, total: float=None self.is_aggregated = is_aggregated -class DiagnosticMetricSet(Model): +class DiagnosticMetricSet(msrest.serialization.Model): """Class representing Diagnostic Metric information. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param unit: Metric's unit + :param unit: Metric's unit. :type unit: str - :param start_time: Start time of the period - :type start_time: datetime - :param end_time: End time of the period - :type end_time: datetime - :param time_grain: Presented time grain. Supported grains at the moment - are PT1M, PT1H, P1D + :param start_time: Start time of the period. + :type start_time: ~datetime.datetime + :param end_time: End time of the period. + :type end_time: ~datetime.datetime + :param time_grain: Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D. :type time_grain: str - :param values: Collection of metric values for the selected period based - on the - {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} - :type values: - list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSample] + :param values: Collection of metric values for the selected period based on the + {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain}. + :type values: list[~azure.mgmt.web.v2019_08_01.models.DiagnosticMetricSample] """ _attribute_map = { @@ -4762,7 +5947,17 @@ class DiagnosticMetricSet(Model): 'values': {'key': 'values', 'type': '[DiagnosticMetricSample]'}, } - def __init__(self, *, name: str=None, unit: str=None, start_time=None, end_time=None, time_grain: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + unit: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + values: Optional[List["DiagnosticMetricSample"]] = None, + **kwargs + ): super(DiagnosticMetricSet, self).__init__(**kwargs) self.name = name self.unit = unit @@ -4772,10 +5967,9 @@ def __init__(self, *, name: str=None, unit: str=None, start_time=None, end_time= self.values = values -class Dimension(Model): - """Dimension of a resource metric. For e.g. instance specific HTTP requests - for a web app, - where instance name is dimension of the metric HTTP request. +class Dimension(msrest.serialization.Model): + """Dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +where instance name is dimension of the metric HTTP request. :param name: :type name: str @@ -4794,7 +5988,15 @@ class Dimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, internal_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -4805,8 +6007,7 @@ def __init__(self, *, name: str=None, display_name: str=None, internal_name: str class Domain(Resource): """Information about a domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -4820,62 +6021,58 @@ class Domain(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2019_08_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2019_08_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2019_08_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2019_08_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2019_08_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2019_08_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.DomainPropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType :param auth_code: :type auth_code: str @@ -4886,10 +6083,6 @@ class Domain(Resource): 'name': {'readonly': True}, 'location': {'required': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -4898,7 +6091,6 @@ class Domain(Resource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -4913,8 +6105,8 @@ class Domain(Resource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -4925,13 +6117,31 @@ class Domain(Resource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, *, location: str, contact_admin, contact_billing, contact_registrant, contact_tech, consent, kind: str=None, tags=None, privacy: bool=None, auto_renew: bool=True, dns_type=None, dns_zone_id: str=None, target_dns_type=None, auth_code: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + contact_admin: Optional["Contact"] = None, + contact_billing: Optional["Contact"] = None, + contact_registrant: Optional["Contact"] = None, + contact_tech: Optional["Contact"] = None, + privacy: Optional[bool] = None, + auto_renew: Optional[bool] = True, + consent: Optional["DomainPurchaseConsent"] = None, + dns_type: Optional[Union[str, "DnsType"]] = None, + dns_zone_id: Optional[str] = None, + target_dns_type: Optional[Union[str, "DnsType"]] = None, + auth_code: Optional[str] = None, + **kwargs + ): super(Domain, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.contact_admin = contact_admin self.contact_billing = contact_billing @@ -4955,46 +6165,85 @@ def __init__(self, *, location: str, contact_admin, contact_billing, contact_reg self.auth_code = auth_code -class DomainAvailabilityCheckResult(Model): +class DomainAvailabilityCheckResult(msrest.serialization.Model): """Domain availability check result. :param name: Name of the domain. :type name: str - :param available: true if domain can be purchased using - CreateDomain API; otherwise, false. + :param available: :code:`true` if domain can be purchased using CreateDomain API; + otherwise, :code:`false`. :type available: bool - :param domain_type: Valid values are Regular domain: Azure will charge the - full price of domain registration, SoftDeleted: Purchasing this domain - will simply restore it and this operation will not cost anything. Possible - values include: 'Regular', 'SoftDeleted' + :param domain_type: Valid values are Regular domain: Azure will charge the full price of domain + registration, SoftDeleted: Purchasing this domain will simply restore it and this operation + will not cost anything. Possible values include: "Regular", "SoftDeleted". :type domain_type: str or ~azure.mgmt.web.v2019_08_01.models.DomainType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'available': {'key': 'available', 'type': 'bool'}, - 'domain_type': {'key': 'domainType', 'type': 'DomainType'}, + 'domain_type': {'key': 'domainType', 'type': 'str'}, } - def __init__(self, *, name: str=None, available: bool=None, domain_type=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available: Optional[bool] = None, + domain_type: Optional[Union[str, "DomainType"]] = None, + **kwargs + ): super(DomainAvailabilityCheckResult, self).__init__(**kwargs) self.name = name self.available = available self.domain_type = domain_type -class DomainControlCenterSsoRequest(Model): +class DomainCollection(msrest.serialization.Model): + """Collection of domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Domain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Domain"], + **kwargs + ): + super(DomainCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DomainControlCenterSsoRequest(msrest.serialization.Model): """Single sign-on request information for domain management. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar url: URL where the single sign-on request is to be made. :vartype url: str :ivar post_parameter_key: Post parameter key. :vartype post_parameter_key: str - :ivar post_parameter_value: Post parameter value. Client should use - 'application/x-www-form-urlencoded' encoding for this value. + :ivar post_parameter_value: Post parameter value. Client should use 'application/x-www-form- + urlencoded' encoding for this value. :vartype post_parameter_value: str """ @@ -5010,7 +6259,10 @@ class DomainControlCenterSsoRequest(Model): 'post_parameter_value': {'key': 'postParameterValue', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DomainControlCenterSsoRequest, self).__init__(**kwargs) self.url = None self.post_parameter_key = None @@ -5020,8 +6272,7 @@ def __init__(self, **kwargs) -> None: class DomainOwnershipIdentifier(ProxyOnlyResource): """Domain ownership Identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5049,19 +6300,56 @@ class DomainOwnershipIdentifier(ProxyOnlyResource): 'ownership_id': {'key': 'properties.ownershipId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, ownership_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + ownership_id: Optional[str] = None, + **kwargs + ): super(DomainOwnershipIdentifier, self).__init__(kind=kind, **kwargs) self.ownership_id = ownership_id -class DomainPatchResource(ProxyOnlyResource): - """ARM resource for a domain. +class DomainOwnershipIdentifierCollection(msrest.serialization.Model): + """Collection of domain ownership identifiers. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DomainOwnershipIdentifier"], + **kwargs + ): + super(DomainOwnershipIdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DomainPatchResource(ProxyOnlyResource): + """ARM resource for a domain. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -5070,60 +6358,56 @@ class DomainPatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param contact_admin: Required. Administrative contact. + :param contact_admin: Administrative contact. :type contact_admin: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_billing: Required. Billing contact. + :param contact_billing: Billing contact. :type contact_billing: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_registrant: Required. Registrant contact. + :param contact_registrant: Registrant contact. :type contact_registrant: ~azure.mgmt.web.v2019_08_01.models.Contact - :param contact_tech: Required. Technical contact. + :param contact_tech: Technical contact. :type contact_tech: ~azure.mgmt.web.v2019_08_01.models.Contact - :ivar registration_status: Domain registration status. Possible values - include: 'Active', 'Awaiting', 'Cancelled', 'Confiscated', 'Disabled', - 'Excluded', 'Expired', 'Failed', 'Held', 'Locked', 'Parked', 'Pending', - 'Reserved', 'Reverted', 'Suspended', 'Transferred', 'Unknown', 'Unlocked', - 'Unparked', 'Updated', 'JsonConverterFailed' - :vartype registration_status: str or - ~azure.mgmt.web.v2019_08_01.models.DomainStatus - :ivar provisioning_state: Domain provisioning state. Possible values - include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', 'Deleting' - :vartype provisioning_state: str or - ~azure.mgmt.web.v2019_08_01.models.ProvisioningState + :ivar registration_status: Domain registration status. Possible values include: "Active", + "Awaiting", "Cancelled", "Confiscated", "Disabled", "Excluded", "Expired", "Failed", "Held", + "Locked", "Parked", "Pending", "Reserved", "Reverted", "Suspended", "Transferred", "Unknown", + "Unlocked", "Unparked", "Updated", "JsonConverterFailed". + :vartype registration_status: str or ~azure.mgmt.web.v2019_08_01.models.DomainStatus + :ivar provisioning_state: Domain provisioning state. Possible values include: "Succeeded", + "Failed", "Canceled", "InProgress", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.ProvisioningState :ivar name_servers: Name servers. :vartype name_servers: list[str] - :param privacy: true if domain privacy is enabled for this - domain; otherwise, false. + :param privacy: :code:`true` if domain privacy is enabled for this domain; + otherwise, :code:`false`. :type privacy: bool :ivar created_time: Domain creation timestamp. - :vartype created_time: datetime + :vartype created_time: ~datetime.datetime :ivar expiration_time: Domain expiration timestamp. - :vartype expiration_time: datetime + :vartype expiration_time: ~datetime.datetime :ivar last_renewed_time: Timestamp when the domain was renewed last time. - :vartype last_renewed_time: datetime - :param auto_renew: true if the domain should be automatically - renewed; otherwise, false. Default value: True . + :vartype last_renewed_time: ~datetime.datetime + :param auto_renew: :code:`true` if the domain should be automatically renewed; + otherwise, :code:`false`. :type auto_renew: bool - :ivar ready_for_dns_record_management: true if Azure can - assign this domain to App Service apps; otherwise, false. - This value will be true if domain registration status is - active and - it is hosted on name servers Azure has programmatic access to. + :ivar ready_for_dns_record_management: :code:`true` if Azure can assign this + domain to App Service apps; otherwise, :code:`false`. This value will be + :code:`true` if domain registration status is active and + it is hosted on name servers Azure has programmatic access to. :vartype ready_for_dns_record_management: bool - :ivar managed_host_names: All hostnames derived from the domain and - assigned to Azure resources. - :vartype managed_host_names: - list[~azure.mgmt.web.v2019_08_01.models.HostName] - :param consent: Required. Legal agreement consent. + :ivar managed_host_names: All hostnames derived from the domain and assigned to Azure + resources. + :vartype managed_host_names: list[~azure.mgmt.web.v2019_08_01.models.HostName] + :param consent: Legal agreement consent. :type consent: ~azure.mgmt.web.v2019_08_01.models.DomainPurchaseConsent :ivar domain_not_renewable_reasons: Reasons why domain is not renewable. - :vartype domain_not_renewable_reasons: list[str] - :param dns_type: Current DNS type. Possible values include: 'AzureDns', - 'DefaultDomainRegistrarDns' + :vartype domain_not_renewable_reasons: list[str or + ~azure.mgmt.web.v2019_08_01.models.DomainPatchResourcePropertiesDomainNotRenewableReasonsItem] + :param dns_type: Current DNS type. Possible values include: "AzureDns", + "DefaultDomainRegistrarDns". :type dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType - :param dns_zone_id: Azure DNS Zone to use + :param dns_zone_id: Azure DNS Zone to use. :type dns_zone_id: str - :param target_dns_type: Target DNS type (would be used for migration). - Possible values include: 'AzureDns', 'DefaultDomainRegistrarDns' + :param target_dns_type: Target DNS type (would be used for migration). Possible values include: + "AzureDns", "DefaultDomainRegistrarDns". :type target_dns_type: str or ~azure.mgmt.web.v2019_08_01.models.DnsType :param auth_code: :type auth_code: str @@ -5133,10 +6417,6 @@ class DomainPatchResource(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'contact_admin': {'required': True}, - 'contact_billing': {'required': True}, - 'contact_registrant': {'required': True}, - 'contact_tech': {'required': True}, 'registration_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'name_servers': {'readonly': True}, @@ -5145,7 +6425,6 @@ class DomainPatchResource(ProxyOnlyResource): 'last_renewed_time': {'readonly': True}, 'ready_for_dns_record_management': {'readonly': True}, 'managed_host_names': {'readonly': True}, - 'consent': {'required': True}, 'domain_not_renewable_reasons': {'readonly': True}, } @@ -5158,8 +6437,8 @@ class DomainPatchResource(ProxyOnlyResource): 'contact_billing': {'key': 'properties.contactBilling', 'type': 'Contact'}, 'contact_registrant': {'key': 'properties.contactRegistrant', 'type': 'Contact'}, 'contact_tech': {'key': 'properties.contactTech', 'type': 'Contact'}, - 'registration_status': {'key': 'properties.registrationStatus', 'type': 'DomainStatus'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, + 'registration_status': {'key': 'properties.registrationStatus', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name_servers': {'key': 'properties.nameServers', 'type': '[str]'}, 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, @@ -5170,13 +6449,29 @@ class DomainPatchResource(ProxyOnlyResource): 'managed_host_names': {'key': 'properties.managedHostNames', 'type': '[HostName]'}, 'consent': {'key': 'properties.consent', 'type': 'DomainPurchaseConsent'}, 'domain_not_renewable_reasons': {'key': 'properties.domainNotRenewableReasons', 'type': '[str]'}, - 'dns_type': {'key': 'properties.dnsType', 'type': 'DnsType'}, + 'dns_type': {'key': 'properties.dnsType', 'type': 'str'}, 'dns_zone_id': {'key': 'properties.dnsZoneId', 'type': 'str'}, - 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'DnsType'}, + 'target_dns_type': {'key': 'properties.targetDnsType', 'type': 'str'}, 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, } - def __init__(self, *, contact_admin, contact_billing, contact_registrant, contact_tech, consent, kind: str=None, privacy: bool=None, auto_renew: bool=True, dns_type=None, dns_zone_id: str=None, target_dns_type=None, auth_code: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + contact_admin: Optional["Contact"] = None, + contact_billing: Optional["Contact"] = None, + contact_registrant: Optional["Contact"] = None, + contact_tech: Optional["Contact"] = None, + privacy: Optional[bool] = None, + auto_renew: Optional[bool] = True, + consent: Optional["DomainPurchaseConsent"] = None, + dns_type: Optional[Union[str, "DnsType"]] = None, + dns_zone_id: Optional[str] = None, + target_dns_type: Optional[Union[str, "DnsType"]] = None, + auth_code: Optional[str] = None, + **kwargs + ): super(DomainPatchResource, self).__init__(kind=kind, **kwargs) self.contact_admin = contact_admin self.contact_billing = contact_billing @@ -5200,18 +6495,16 @@ def __init__(self, *, contact_admin, contact_billing, contact_registrant, contac self.auth_code = auth_code -class DomainPurchaseConsent(Model): - """Domain purchase consent object, representing acceptance of applicable legal - agreements. +class DomainPurchaseConsent(msrest.serialization.Model): + """Domain purchase consent object, representing acceptance of applicable legal agreements. - :param agreement_keys: List of applicable legal agreement keys. This list - can be retrieved using ListLegalAgreements API under - TopLevelDomain resource. + :param agreement_keys: List of applicable legal agreement keys. This list can be retrieved + using ListLegalAgreements API under :code:`TopLevelDomain` resource. :type agreement_keys: list[str] :param agreed_by: Client IP address. :type agreed_by: str :param agreed_at: Timestamp when the agreements were accepted. - :type agreed_at: datetime + :type agreed_at: ~datetime.datetime """ _attribute_map = { @@ -5220,18 +6513,24 @@ class DomainPurchaseConsent(Model): 'agreed_at': {'key': 'agreedAt', 'type': 'iso-8601'}, } - def __init__(self, *, agreement_keys=None, agreed_by: str=None, agreed_at=None, **kwargs) -> None: + def __init__( + self, + *, + agreement_keys: Optional[List[str]] = None, + agreed_by: Optional[str] = None, + agreed_at: Optional[datetime.datetime] = None, + **kwargs + ): super(DomainPurchaseConsent, self).__init__(**kwargs) self.agreement_keys = agreement_keys self.agreed_by = agreed_by self.agreed_at = agreed_at -class DomainRecommendationSearchParameters(Model): +class DomainRecommendationSearchParameters(msrest.serialization.Model): """Domain recommendation search parameters. - :param keywords: Keywords to be used for generating domain - recommendations. + :param keywords: Keywords to be used for generating domain recommendations. :type keywords: str :param max_domain_recommendations: Maximum number of recommendations. :type max_domain_recommendations: int @@ -5242,17 +6541,23 @@ class DomainRecommendationSearchParameters(Model): 'max_domain_recommendations': {'key': 'maxDomainRecommendations', 'type': 'int'}, } - def __init__(self, *, keywords: str=None, max_domain_recommendations: int=None, **kwargs) -> None: + def __init__( + self, + *, + keywords: Optional[str] = None, + max_domain_recommendations: Optional[int] = None, + **kwargs + ): super(DomainRecommendationSearchParameters, self).__init__(**kwargs) self.keywords = keywords self.max_domain_recommendations = max_domain_recommendations -class EnabledConfig(Model): +class EnabledConfig(msrest.serialization.Model): """Enabled configuration. - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -5260,21 +6565,23 @@ class EnabledConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(EnabledConfig, self).__init__(**kwargs) self.enabled = enabled -class EndpointDependency(Model): - """A domain name that a service is reached at, including details of the - current connection status. +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at, including details of the current connection status. :param domain_name: The domain name of the dependency. :type domain_name: str - :param endpoint_details: The IP Addresses and Ports used when connecting - to DomainName. - :type endpoint_details: - list[~azure.mgmt.web.v2019_08_01.models.EndpointDetail] + :param endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :type endpoint_details: list[~azure.mgmt.web.v2019_08_01.models.EndpointDetail] """ _attribute_map = { @@ -5282,26 +6589,30 @@ class EndpointDependency(Model): 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, } - def __init__(self, *, domain_name: str=None, endpoint_details=None, **kwargs) -> None: + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["EndpointDetail"]] = None, + **kwargs + ): super(EndpointDependency, self).__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(Model): - """Current TCP connectivity information from the App Service Environment to a - single endpoint. +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the App Service Environment to a single endpoint. :param ip_address: An IP Address that Domain Name currently resolves to. :type ip_address: str :param port: The port an endpoint is connected to. :type port: int - :param latency: The time in milliseconds it takes for a TCP connection to - be created from the App Service Environment to this IpAddress at this - Port. + :param latency: The time in milliseconds it takes for a TCP connection to be created from the + App Service Environment to this IpAddress at this Port. :type latency: float - :param is_accessible: Whether it is possible to create a TCP connection - from the App Service Environment to this IpAddress at this Port. + :param is_accessible: Whether it is possible to create a TCP connection from the App Service + Environment to this IpAddress at this Port. :type is_accessible: bool """ @@ -5312,7 +6623,15 @@ class EndpointDetail(Model): 'is_accessible': {'key': 'isAccessible', 'type': 'bool'}, } - def __init__(self, *, ip_address: str=None, port: int=None, latency: float=None, is_accessible: bool=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + latency: Optional[float] = None, + is_accessible: Optional[bool] = None, + **kwargs + ): super(EndpointDetail, self).__init__(**kwargs) self.ip_address = ip_address self.port = port @@ -5320,7 +6639,7 @@ def __init__(self, *, ip_address: str=None, port: int=None, latency: float=None, self.is_accessible = is_accessible -class ErrorEntity(Model): +class ErrorEntity(msrest.serialization.Model): """Body of the error response returned from the API. :param extended_code: Type of error. @@ -5346,7 +6665,17 @@ class ErrorEntity(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, extended_code: str=None, message_template: str=None, parameters=None, inner_errors=None, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["ErrorEntity"]] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ErrorEntity, self).__init__(**kwargs) self.extended_code = extended_code self.message_template = message_template @@ -5356,7 +6685,7 @@ def __init__(self, *, extended_code: str=None, message_template: str=None, param self.message = message -class Experiments(Model): +class Experiments(msrest.serialization.Model): """Routing rules in production experiments. :param ramp_up_rules: List of ramp-up rules. @@ -5367,33 +6696,42 @@ class Experiments(Model): 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } - def __init__(self, *, ramp_up_rules=None, **kwargs) -> None: + def __init__( + self, + *, + ramp_up_rules: Optional[List["RampUpRule"]] = None, + **kwargs + ): super(Experiments, self).__init__(**kwargs) self.ramp_up_rules = ramp_up_rules -class FileSystemApplicationLogsConfig(Model): +class FileSystemApplicationLogsConfig(msrest.serialization.Model): """Application logs to file system configuration. - :param level: Log level. Possible values include: 'Off', 'Verbose', - 'Information', 'Warning', 'Error'. Default value: "Off" . + :param level: Log level. Possible values include: "Off", "Verbose", "Information", "Warning", + "Error". :type level: str or ~azure.mgmt.web.v2019_08_01.models.LogLevel """ _attribute_map = { - 'level': {'key': 'level', 'type': 'LogLevel'}, + 'level': {'key': 'level', 'type': 'str'}, } - def __init__(self, *, level="Off", **kwargs) -> None: + def __init__( + self, + *, + level: Optional[Union[str, "LogLevel"]] = None, + **kwargs + ): super(FileSystemApplicationLogsConfig, self).__init__(**kwargs) self.level = level -class FileSystemHttpLogsConfig(Model): +class FileSystemHttpLogsConfig(msrest.serialization.Model): """Http logs to file system configuration. - :param retention_in_mb: Maximum size in megabytes that http log files can - use. + :param retention_in_mb: Maximum size in megabytes that http log files can use. When reached old log files will be removed to make space for new ones. Value can range between 25 and 100. :type retention_in_mb: int @@ -5401,8 +6739,8 @@ class FileSystemHttpLogsConfig(Model): Remove files older than X days. 0 or lower means no retention. :type retention_in_days: int - :param enabled: True if configuration is enabled, false if it is disabled - and null if configuration is not set. + :param enabled: True if configuration is enabled, false if it is disabled and null if + configuration is not set. :type enabled: bool """ @@ -5416,7 +6754,14 @@ class FileSystemHttpLogsConfig(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, retention_in_mb: int=None, retention_in_days: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + retention_in_mb: Optional[int] = None, + retention_in_days: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(FileSystemHttpLogsConfig, self).__init__(**kwargs) self.retention_in_mb = retention_in_mb self.retention_in_days = retention_in_days @@ -5426,8 +6771,7 @@ def __init__(self, *, retention_in_mb: int=None, retention_in_days: int=None, en class FunctionEnvelope(ProxyOnlyResource): """Function information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5457,12 +6801,11 @@ class FunctionEnvelope(ProxyOnlyResource): :type files: dict[str, str] :param test_data: Test data used when testing via the Azure Portal. :type test_data: str - :param invoke_url_template: The invocation URL + :param invoke_url_template: The invocation URL. :type invoke_url_template: str - :param language: The function language + :param language: The function language. :type language: str - :param is_disabled: Gets or sets a value indicating whether the function - is disabled + :param is_disabled: Gets or sets a value indicating whether the function is disabled. :type is_disabled: bool """ @@ -5492,7 +6835,25 @@ class FunctionEnvelope(ProxyOnlyResource): 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, function_app_id: str=None, script_root_path_href: str=None, script_href: str=None, config_href: str=None, test_data_href: str=None, secrets_file_href: str=None, href: str=None, config=None, files=None, test_data: str=None, invoke_url_template: str=None, language: str=None, is_disabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + function_app_id: Optional[str] = None, + script_root_path_href: Optional[str] = None, + script_href: Optional[str] = None, + config_href: Optional[str] = None, + test_data_href: Optional[str] = None, + secrets_file_href: Optional[str] = None, + href: Optional[str] = None, + config: Optional[object] = None, + files: Optional[Dict[str, str]] = None, + test_data: Optional[str] = None, + invoke_url_template: Optional[str] = None, + language: Optional[str] = None, + is_disabled: Optional[bool] = None, + **kwargs + ): super(FunctionEnvelope, self).__init__(kind=kind, **kwargs) self.function_app_id = function_app_id self.script_root_path_href = script_root_path_href @@ -5509,11 +6870,44 @@ def __init__(self, *, kind: str=None, function_app_id: str=None, script_root_pat self.is_disabled = is_disabled +class FunctionEnvelopeCollection(msrest.serialization.Model): + """Collection of Kudu function information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["FunctionEnvelope"], + **kwargs + ): + super(FunctionEnvelopeCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class FunctionSecrets(ProxyOnlyResource): """Function secrets. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5544,7 +6938,14 @@ class FunctionSecrets(ProxyOnlyResource): 'trigger_url': {'key': 'properties.trigger_url', 'type': 'str'}, } - def __init__(self, *, kind: str=None, key: str=None, trigger_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key: Optional[str] = None, + trigger_url: Optional[str] = None, + **kwargs + ): super(FunctionSecrets, self).__init__(kind=kind, **kwargs) self.key = key self.trigger_url = trigger_url @@ -5553,8 +6954,7 @@ def __init__(self, *, kind: str=None, key: str=None, trigger_url: str=None, **kw class GeoRegion(ProxyOnlyResource): """Geographical region. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5591,14 +6991,53 @@ class GeoRegion(ProxyOnlyResource): 'org_domain': {'key': 'properties.orgDomain', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(GeoRegion, self).__init__(kind=kind, **kwargs) self.description = None self.display_name = None self.org_domain = None -class GlobalCsmSkuDescription(Model): +class GeoRegionCollection(msrest.serialization.Model): + """Collection of geographical regions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.GeoRegion] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GeoRegion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GeoRegion"], + **kwargs + ): + super(GeoRegionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class GlobalCsmSkuDescription(msrest.serialization.Model): """A Global SKU Description. :param name: Name of the resource SKU. @@ -5613,8 +7052,7 @@ class GlobalCsmSkuDescription(Model): :type capacity: ~azure.mgmt.web.v2019_08_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2019_08_01.models.Capability] """ @@ -5628,7 +7066,18 @@ class GlobalCsmSkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(GlobalCsmSkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5639,19 +7088,16 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class HandlerMapping(Model): - """The IIS handler mappings used to define which handler processes HTTP - requests with certain extension. - For example, it is used to configure php-cgi.exe process to handle all HTTP - requests with *.php extension. +class HandlerMapping(msrest.serialization.Model): + """The IIS handler mappings used to define which handler processes HTTP requests with certain extension. +For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension. - :param extension: Requests with this extension will be handled using the - specified FastCGI application. + :param extension: Requests with this extension will be handled using the specified FastCGI + application. :type extension: str :param script_processor: The absolute path to the FastCGI application. :type script_processor: str - :param arguments: Command-line arguments to be passed to the script - processor. + :param arguments: Command-line arguments to be passed to the script processor. :type arguments: str """ @@ -5661,14 +7107,21 @@ class HandlerMapping(Model): 'arguments': {'key': 'arguments', 'type': 'str'}, } - def __init__(self, *, extension: str=None, script_processor: str=None, arguments: str=None, **kwargs) -> None: + def __init__( + self, + *, + extension: Optional[str] = None, + script_processor: Optional[str] = None, + arguments: Optional[str] = None, + **kwargs + ): super(HandlerMapping, self).__init__(**kwargs) self.extension = extension self.script_processor = script_processor self.arguments = arguments -class HostingEnvironmentDeploymentInfo(Model): +class HostingEnvironmentDeploymentInfo(msrest.serialization.Model): """Information needed to create resources on an App Service Environment. :param name: Name of the App Service Environment. @@ -5682,13 +7135,19 @@ class HostingEnvironmentDeploymentInfo(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, name: str=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentDeploymentInfo, self).__init__(**kwargs) self.name = name self.location = location -class HostingEnvironmentDiagnostics(Model): +class HostingEnvironmentDiagnostics(msrest.serialization.Model): """Diagnostics for an App Service Environment. :param name: Name/identifier of the diagnostics. @@ -5702,17 +7161,22 @@ class HostingEnvironmentDiagnostics(Model): 'diagnostics_output': {'key': 'diagnosticsOutput', 'type': 'str'}, } - def __init__(self, *, name: str=None, diagnostics_output: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + diagnostics_output: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentDiagnostics, self).__init__(**kwargs) self.name = name self.diagnostics_output = diagnostics_output -class HostingEnvironmentProfile(Model): +class HostingEnvironmentProfile(msrest.serialization.Model): """Specification for an App Service Environment to use for this resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID of the App Service Environment. :type id: str @@ -5733,14 +7197,19 @@ class HostingEnvironmentProfile(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(HostingEnvironmentProfile, self).__init__(**kwargs) self.id = id self.name = None self.type = None -class HostKeys(Model): +class HostKeys(msrest.serialization.Model): """Functions host level keys. :param master_key: Secret key. @@ -5757,50 +7226,63 @@ class HostKeys(Model): 'system_keys': {'key': 'systemKeys', 'type': '{str}'}, } - def __init__(self, *, master_key: str=None, function_keys=None, system_keys=None, **kwargs) -> None: + def __init__( + self, + *, + master_key: Optional[str] = None, + function_keys: Optional[Dict[str, str]] = None, + system_keys: Optional[Dict[str, str]] = None, + **kwargs + ): super(HostKeys, self).__init__(**kwargs) self.master_key = master_key self.function_keys = function_keys self.system_keys = system_keys -class HostName(Model): +class HostName(msrest.serialization.Model): """Details of a hostname derived from a domain. :param name: Name of the hostname. :type name: str - :param site_names: List of apps the hostname is assigned to. This list - will have more than one app only if the hostname is pointing to a Traffic - Manager. + :param site_names: List of apps the hostname is assigned to. This list will have more than one + app only if the hostname is pointing to a Traffic Manager. :type site_names: list[str] - :param azure_resource_name: Name of the Azure resource the hostname is - assigned to. If it is assigned to a Traffic Manager then it will be the - Traffic Manager name otherwise it will be the app name. + :param azure_resource_name: Name of the Azure resource the hostname is assigned to. If it is + assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the + app name. :type azure_resource_name: str - :param azure_resource_type: Type of the Azure resource the hostname is - assigned to. Possible values include: 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2019_08_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Type of the DNS record. Possible - values include: 'CName', 'A' + :param azure_resource_type: Type of the Azure resource the hostname is assigned to. Possible + values include: "Website", "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2019_08_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Type of the DNS record. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2019_08_01.models.CustomHostNameDnsRecordType - :param host_name_type: Type of the hostname. Possible values include: - 'Verified', 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2019_08_01.models.HostNameType + :param host_name_type: Type of the hostname. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2019_08_01.models.HostNameType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'site_names': {'key': 'siteNames', 'type': '[str]'}, 'azure_resource_name': {'key': 'azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'hostNameType', 'type': 'HostNameType'}, - } - - def __init__(self, *, name: str=None, site_names=None, azure_resource_name: str=None, azure_resource_type=None, custom_host_name_dns_record_type=None, host_name_type=None, **kwargs) -> None: + 'azure_resource_type': {'key': 'azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'hostNameType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + site_names: Optional[List[str]] = None, + azure_resource_name: Optional[str] = None, + azure_resource_type: Optional[Union[str, "AzureResourceType"]] = None, + custom_host_name_dns_record_type: Optional[Union[str, "CustomHostNameDnsRecordType"]] = None, + host_name_type: Optional[Union[str, "HostNameType"]] = None, + **kwargs + ): super(HostName, self).__init__(**kwargs) self.name = name self.site_names = site_names @@ -5813,8 +7295,7 @@ def __init__(self, *, name: str=None, site_names=None, azure_resource_name: str= class HostNameBinding(ProxyOnlyResource): """A hostname binding object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5830,25 +7311,21 @@ class HostNameBinding(ProxyOnlyResource): :type domain_id: str :param azure_resource_name: Azure resource name. :type azure_resource_name: str - :param azure_resource_type: Azure resource type. Possible values include: - 'Website', 'TrafficManager' - :type azure_resource_type: str or - ~azure.mgmt.web.v2019_08_01.models.AzureResourceType - :param custom_host_name_dns_record_type: Custom DNS record type. Possible - values include: 'CName', 'A' + :param azure_resource_type: Azure resource type. Possible values include: "Website", + "TrafficManager". + :type azure_resource_type: str or ~azure.mgmt.web.v2019_08_01.models.AzureResourceType + :param custom_host_name_dns_record_type: Custom DNS record type. Possible values include: + "CName", "A". :type custom_host_name_dns_record_type: str or ~azure.mgmt.web.v2019_08_01.models.CustomHostNameDnsRecordType - :param host_name_type: Hostname type. Possible values include: 'Verified', - 'Managed' - :type host_name_type: str or - ~azure.mgmt.web.v2019_08_01.models.HostNameType - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param host_name_type: Hostname type. Possible values include: "Verified", "Managed". + :type host_name_type: str or ~azure.mgmt.web.v2019_08_01.models.HostNameType + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2019_08_01.models.SslState - :param thumbprint: SSL certificate thumbprint + :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :ivar virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :vartype virtual_ip: str """ @@ -5867,15 +7344,28 @@ class HostNameBinding(ProxyOnlyResource): 'site_name': {'key': 'properties.siteName', 'type': 'str'}, 'domain_id': {'key': 'properties.domainId', 'type': 'str'}, 'azure_resource_name': {'key': 'properties.azureResourceName', 'type': 'str'}, - 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'AzureResourceType'}, - 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'CustomHostNameDnsRecordType'}, - 'host_name_type': {'key': 'properties.hostNameType', 'type': 'HostNameType'}, - 'ssl_state': {'key': 'properties.sslState', 'type': 'SslState'}, + 'azure_resource_type': {'key': 'properties.azureResourceType', 'type': 'str'}, + 'custom_host_name_dns_record_type': {'key': 'properties.customHostNameDnsRecordType', 'type': 'str'}, + 'host_name_type': {'key': 'properties.hostNameType', 'type': 'str'}, + 'ssl_state': {'key': 'properties.sslState', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'virtual_ip': {'key': 'properties.virtualIP', 'type': 'str'}, } - def __init__(self, *, kind: str=None, site_name: str=None, domain_id: str=None, azure_resource_name: str=None, azure_resource_type=None, custom_host_name_dns_record_type=None, host_name_type=None, ssl_state=None, thumbprint: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + site_name: Optional[str] = None, + domain_id: Optional[str] = None, + azure_resource_name: Optional[str] = None, + azure_resource_type: Optional[Union[str, "AzureResourceType"]] = None, + custom_host_name_dns_record_type: Optional[Union[str, "CustomHostNameDnsRecordType"]] = None, + host_name_type: Optional[Union[str, "HostNameType"]] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + thumbprint: Optional[str] = None, + **kwargs + ): super(HostNameBinding, self).__init__(kind=kind, **kwargs) self.site_name = site_name self.domain_id = domain_id @@ -5888,36 +7378,79 @@ def __init__(self, *, kind: str=None, site_name: str=None, domain_id: str=None, self.virtual_ip = None -class HostNameSslState(Model): +class HostNameBindingCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.HostNameBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostNameBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["HostNameBinding"], + **kwargs + ): + super(HostNameBindingCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class HostNameSslState(msrest.serialization.Model): """SSL-enabled hostname. :param name: Hostname. :type name: str - :param ssl_state: SSL type. Possible values include: 'Disabled', - 'SniEnabled', 'IpBasedEnabled' + :param ssl_state: SSL type. Possible values include: "Disabled", "SniEnabled", + "IpBasedEnabled". :type ssl_state: str or ~azure.mgmt.web.v2019_08_01.models.SslState - :param virtual_ip: Virtual IP address assigned to the hostname if IP based - SSL is enabled. + :param virtual_ip: Virtual IP address assigned to the hostname if IP based SSL is enabled. :type virtual_ip: str :param thumbprint: SSL certificate thumbprint. :type thumbprint: str - :param to_update: Set to true to update existing hostname. + :param to_update: Set to :code:`true` to update existing hostname. :type to_update: bool - :param host_type: Indicates whether the hostname is a standard or - repository hostname. Possible values include: 'Standard', 'Repository' + :param host_type: Indicates whether the hostname is a standard or repository hostname. Possible + values include: "Standard", "Repository". :type host_type: str or ~azure.mgmt.web.v2019_08_01.models.HostType """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'ssl_state': {'key': 'sslState', 'type': 'SslState'}, + 'ssl_state': {'key': 'sslState', 'type': 'str'}, 'virtual_ip': {'key': 'virtualIP', 'type': 'str'}, 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, 'to_update': {'key': 'toUpdate', 'type': 'bool'}, - 'host_type': {'key': 'hostType', 'type': 'HostType'}, - } - - def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thumbprint: str=None, to_update: bool=None, host_type=None, **kwargs) -> None: + 'host_type': {'key': 'hostType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + ssl_state: Optional[Union[str, "SslState"]] = None, + virtual_ip: Optional[str] = None, + thumbprint: Optional[str] = None, + to_update: Optional[bool] = None, + host_type: Optional[Union[str, "HostType"]] = None, + **kwargs + ): super(HostNameSslState, self).__init__(**kwargs) self.name = name self.ssl_state = ssl_state @@ -5927,15 +7460,13 @@ def __init__(self, *, name: str=None, ssl_state=None, virtual_ip: str=None, thum self.host_type = host_type -class HttpLogsConfig(Model): +class HttpLogsConfig(msrest.serialization.Model): """Http logs configuration. :param file_system: Http logs to file system configuration. - :type file_system: - ~azure.mgmt.web.v2019_08_01.models.FileSystemHttpLogsConfig + :type file_system: ~azure.mgmt.web.v2019_08_01.models.FileSystemHttpLogsConfig :param azure_blob_storage: Http logs to azure blob storage configuration. - :type azure_blob_storage: - ~azure.mgmt.web.v2019_08_01.models.AzureBlobStorageHttpLogsConfig + :type azure_blob_storage: ~azure.mgmt.web.v2019_08_01.models.AzureBlobStorageHttpLogsConfig """ _attribute_map = { @@ -5943,7 +7474,13 @@ class HttpLogsConfig(Model): 'azure_blob_storage': {'key': 'azureBlobStorage', 'type': 'AzureBlobStorageHttpLogsConfig'}, } - def __init__(self, *, file_system=None, azure_blob_storage=None, **kwargs) -> None: + def __init__( + self, + *, + file_system: Optional["FileSystemHttpLogsConfig"] = None, + azure_blob_storage: Optional["AzureBlobStorageHttpLogsConfig"] = None, + **kwargs + ): super(HttpLogsConfig, self).__init__(**kwargs) self.file_system = file_system self.azure_blob_storage = azure_blob_storage @@ -5952,8 +7489,7 @@ def __init__(self, *, file_system=None, azure_blob_storage=None, **kwargs) -> No class HybridConnection(ProxyOnlyResource): """Hybrid Connection contract. This is used to configure a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -5973,15 +7509,15 @@ class HybridConnection(ProxyOnlyResource): :type hostname: str :param port: The port of the endpoint. :type port: int - :param send_key_name: The name of the Service Bus key which has Send - permissions. This is used to authenticate to Service Bus. + :param send_key_name: The name of the Service Bus key which has Send permissions. This is used + to authenticate to Service Bus. :type send_key_name: str - :param send_key_value: The value of the Service Bus key. This is used to - authenticate to Service Bus. In ARM this key will not be returned + :param send_key_value: The value of the Service Bus key. This is used to authenticate to + Service Bus. In ARM this key will not be returned normally, use the POST /listKeys API instead. :type send_key_value: str - :param service_bus_suffix: The suffix for the service bus endpoint. By - default this is .servicebus.windows.net + :param service_bus_suffix: The suffix for the service bus endpoint. By default this is + .servicebus.windows.net. :type service_bus_suffix: str """ @@ -6006,7 +7542,20 @@ class HybridConnection(ProxyOnlyResource): 'service_bus_suffix': {'key': 'properties.serviceBusSuffix', 'type': 'str'}, } - def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_name: str=None, relay_arm_uri: str=None, hostname: str=None, port: int=None, send_key_name: str=None, send_key_value: str=None, service_bus_suffix: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + service_bus_namespace: Optional[str] = None, + relay_name: Optional[str] = None, + relay_arm_uri: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + send_key_name: Optional[str] = None, + send_key_value: Optional[str] = None, + service_bus_suffix: Optional[str] = None, + **kwargs + ): super(HybridConnection, self).__init__(kind=kind, **kwargs) self.service_bus_namespace = service_bus_namespace self.relay_name = relay_name @@ -6018,12 +7567,44 @@ def __init__(self, *, kind: str=None, service_bus_namespace: str=None, relay_nam self.service_bus_suffix = service_bus_suffix +class HybridConnectionCollection(msrest.serialization.Model): + """Collection of hostname bindings. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.HybridConnection] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HybridConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["HybridConnection"], + **kwargs + ): + super(HybridConnectionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class HybridConnectionKey(ProxyOnlyResource): - """Hybrid Connection key contract. This has the send key name and value for a - Hybrid Connection. + """Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6056,18 +7637,21 @@ class HybridConnectionKey(ProxyOnlyResource): 'send_key_value': {'key': 'properties.sendKeyValue', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionKey, self).__init__(kind=kind, **kwargs) self.send_key_name = None self.send_key_value = None class HybridConnectionLimits(ProxyOnlyResource): - """Hybrid Connection limits contract. This is used to return the plan limits - of Hybrid Connections. + """Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6100,7 +7684,12 @@ class HybridConnectionLimits(ProxyOnlyResource): 'maximum': {'key': 'properties.maximum', 'type': 'int'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(HybridConnectionLimits, self).__init__(kind=kind, **kwargs) self.current = None self.maximum = None @@ -6109,8 +7698,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class Identifier(ProxyOnlyResource): """A domain specific resource identifier. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6138,23 +7726,59 @@ class Identifier(ProxyOnlyResource): 'value': {'key': 'properties.id', 'type': 'str'}, } - def __init__(self, *, kind: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(Identifier, self).__init__(kind=kind, **kwargs) self.value = value -class InboundEnvironmentEndpoint(Model): - """The IP Addresses and Ports that require inbound network access to and - within the subnet of the App Service Environment. +class IdentifierCollection(msrest.serialization.Model): + """Collection of identifiers. + + Variables are only populated by the server, and will be ignored when sending a request. - :param description: Short text describing the purpose of the network - traffic. + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Identifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Identifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Identifier"], + **kwargs + ): + super(IdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class InboundEnvironmentEndpoint(msrest.serialization.Model): + """The IP Addresses and Ports that require inbound network access to and within the subnet of the App Service Environment. + + :param description: Short text describing the purpose of the network traffic. :type description: str - :param endpoints: The IP addresses that network traffic will originate - from in cidr notation. + :param endpoints: The IP addresses that network traffic will originate from in cidr notation. :type endpoints: list[str] - :param ports: The ports that network traffic will arrive to the App - Service Environment at. + :param ports: The ports that network traffic will arrive to the App Service Environment at. :type ports: list[str] """ @@ -6164,14 +7788,55 @@ class InboundEnvironmentEndpoint(Model): 'ports': {'key': 'ports', 'type': '[str]'}, } - def __init__(self, *, description: str=None, endpoints=None, ports=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + endpoints: Optional[List[str]] = None, + ports: Optional[List[str]] = None, + **kwargs + ): super(InboundEnvironmentEndpoint, self).__init__(**kwargs) self.description = description self.endpoints = endpoints self.ports = ports -class IpSecurityRestriction(Model): +class InboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Inbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.InboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["InboundEnvironmentEndpoint"], + **kwargs + ): + super(InboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IpSecurityRestriction(msrest.serialization.Model): """IP security restriction on an app. :param ip_address: IP address the security restriction is valid for. @@ -6179,20 +7844,18 @@ class IpSecurityRestriction(Model): CIDR notation such as ipv4/mask (leading bit match). For CIDR, SubnetMask property must not be specified. :type ip_address: str - :param subnet_mask: Subnet mask for the range of IP addresses the - restriction is valid for. + :param subnet_mask: Subnet mask for the range of IP addresses the restriction is valid for. :type subnet_mask: str - :param vnet_subnet_resource_id: Virtual network resource id + :param vnet_subnet_resource_id: Virtual network resource id. :type vnet_subnet_resource_id: str - :param vnet_traffic_tag: (internal) Vnet traffic tag + :param vnet_traffic_tag: (internal) Vnet traffic tag. :type vnet_traffic_tag: int - :param subnet_traffic_tag: (internal) Subnet traffic tag + :param subnet_traffic_tag: (internal) Subnet traffic tag. :type subnet_traffic_tag: int :param action: Allow or Deny access for this IP range. :type action: str - :param tag: Defines what this IP filter will be used for. This is to - support IP filtering on proxies. Possible values include: 'Default', - 'XffProxy' + :param tag: Defines what this IP filter will be used for. This is to support IP filtering on + proxies. Possible values include: "Default", "XffProxy". :type tag: str or ~azure.mgmt.web.v2019_08_01.models.IpFilterTag :param priority: Priority of IP restriction rule. :type priority: int @@ -6209,13 +7872,27 @@ class IpSecurityRestriction(Model): 'vnet_traffic_tag': {'key': 'vnetTrafficTag', 'type': 'int'}, 'subnet_traffic_tag': {'key': 'subnetTrafficTag', 'type': 'int'}, 'action': {'key': 'action', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'IpFilterTag'}, + 'tag': {'key': 'tag', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, ip_address: str=None, subnet_mask: str=None, vnet_subnet_resource_id: str=None, vnet_traffic_tag: int=None, subnet_traffic_tag: int=None, action: str=None, tag=None, priority: int=None, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + ip_address: Optional[str] = None, + subnet_mask: Optional[str] = None, + vnet_subnet_resource_id: Optional[str] = None, + vnet_traffic_tag: Optional[int] = None, + subnet_traffic_tag: Optional[int] = None, + action: Optional[str] = None, + tag: Optional[Union[str, "IpFilterTag"]] = None, + priority: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(IpSecurityRestriction, self).__init__(**kwargs) self.ip_address = ip_address self.subnet_mask = subnet_mask @@ -6229,12 +7906,12 @@ def __init__(self, *, ip_address: str=None, subnet_mask: str=None, vnet_subnet_r self.description = description -class KeyInfo(Model): +class KeyInfo(msrest.serialization.Model): """Function key info. - :param name: Key name + :param name: Key name. :type name: str - :param value: Key value + :param value: Key value. :type value: str """ @@ -6243,7 +7920,13 @@ class KeyInfo(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(KeyInfo, self).__init__(**kwargs) self.name = name self.value = value @@ -6252,8 +7935,7 @@ def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: class KeyVaultReferenceCollection(ProxyOnlyResource): """Web app key vault reference and status ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6263,9 +7945,8 @@ class KeyVaultReferenceCollection(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param key_to_reference_statuses: - :type key_to_reference_statuses: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ApiKVReference] + :param key_to_reference_statuses: Dictionary of :code:``. + :type key_to_reference_statuses: dict[str, ~azure.mgmt.web.v2019_08_01.models.ApiKVReference] """ _validation = { @@ -6282,7 +7963,13 @@ class KeyVaultReferenceCollection(ProxyOnlyResource): 'key_to_reference_statuses': {'key': 'properties.keyToReferenceStatuses', 'type': '{ApiKVReference}'}, } - def __init__(self, *, kind: str=None, key_to_reference_statuses=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_to_reference_statuses: Optional[Dict[str, "ApiKVReference"]] = None, + **kwargs + ): super(KeyVaultReferenceCollection, self).__init__(kind=kind, **kwargs) self.key_to_reference_statuses = key_to_reference_statuses @@ -6290,8 +7977,7 @@ def __init__(self, *, kind: str=None, key_to_reference_statuses=None, **kwargs) class KeyVaultReferenceResource(ProxyOnlyResource): """Web app key vault reference and status ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6303,9 +7989,9 @@ class KeyVaultReferenceResource(ProxyOnlyResource): :vartype type: str :param reference: :type reference: str - :param status: Possible values include: 'Initialized', 'Resolved', - 'InvalidSyntax', 'MSINotEnabled', 'VaultNotFound', 'SecretNotFound', - 'SecretVersionNotFound', 'AccessToKeyVaultDenied', 'OtherReasons' + :param status: Possible values include: "Initialized", "Resolved", "InvalidSyntax", + "MSINotEnabled", "VaultNotFound", "SecretNotFound", "SecretVersionNotFound", + "AccessToKeyVaultDenied", "OtherReasons". :type status: str or ~azure.mgmt.web.v2019_08_01.models.ResolveStatus :param vault_name: :type vault_name: str @@ -6313,24 +7999,23 @@ class KeyVaultReferenceResource(ProxyOnlyResource): :type secret_name: str :param secret_version: :type secret_version: str - :param identity_type: Possible values include: 'None', 'SystemAssigned', - 'UserAssigned' - :type identity_type: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType + :param identity_type: Type of managed service identity. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type identity_type: str or ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType :param details: :type details: str - :param source: Possible values include: 'KeyVault' - :type source: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceSource - :param location: Possible values include: 'ApplicationSetting' - :type location: str or - ~azure.mgmt.web.v2019_08_01.models.ConfigReferenceLocation + :ivar source: Default value: "KeyVault". + :vartype source: str + :ivar location: Default value: "ApplicationSetting". + :vartype location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'source': {'constant': True}, + 'location': {'constant': True}, } _attribute_map = { @@ -6339,17 +8024,32 @@ class KeyVaultReferenceResource(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'reference': {'key': 'properties.reference', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'ResolveStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'vault_name': {'key': 'properties.vaultName', 'type': 'str'}, 'secret_name': {'key': 'properties.secretName', 'type': 'str'}, 'secret_version': {'key': 'properties.secretVersion', 'type': 'str'}, - 'identity_type': {'key': 'properties.identityType', 'type': 'ManagedServiceIdentityType'}, + 'identity_type': {'key': 'properties.identityType', 'type': 'str'}, 'details': {'key': 'properties.details', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'ConfigReferenceSource'}, - 'location': {'key': 'properties.location', 'type': 'ConfigReferenceLocation'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'location': {'key': 'properties.location', 'type': 'str'}, } - def __init__(self, *, kind: str=None, reference: str=None, status=None, vault_name: str=None, secret_name: str=None, secret_version: str=None, identity_type=None, details: str=None, source=None, location=None, **kwargs) -> None: + source = "KeyVault" + location = "ApplicationSetting" + + def __init__( + self, + *, + kind: Optional[str] = None, + reference: Optional[str] = None, + status: Optional[Union[str, "ResolveStatus"]] = None, + vault_name: Optional[str] = None, + secret_name: Optional[str] = None, + secret_version: Optional[str] = None, + identity_type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + details: Optional[str] = None, + **kwargs + ): super(KeyVaultReferenceResource, self).__init__(kind=kind, **kwargs) self.reference = reference self.status = status @@ -6358,11 +8058,9 @@ def __init__(self, *, kind: str=None, reference: str=None, status=None, vault_na self.secret_version = secret_version self.identity_type = identity_type self.details = details - self.source = source - self.location = location -class LocalizableString(Model): +class LocalizableString(msrest.serialization.Model): """Localizable string object containing the name and a localized value. :param value: Non-localized name. @@ -6376,13 +8074,19 @@ class LocalizableString(Model): 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): super(LocalizableString, self).__init__(**kwargs) self.value = value self.localized_value = localized_value -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log Definition of a single resource metric. :param name: @@ -6399,33 +8103,37 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ManagedServiceIdentity(Model): +class ManagedServiceIdentity(msrest.serialization.Model): """Managed service identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityType :ivar tenant_id: Tenant of managed service identity. :vartype tenant_id: str :ivar principal_id: Principal Id of managed service identity. :vartype principal_id: str - :param user_assigned_identities: The list of user assigned identities - associated with the resource. The user identity dictionary key references - will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + :param user_assigned_identities: The list of user assigned identities associated with the + resource. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. :type user_assigned_identities: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + ~azure.mgmt.web.v2019_08_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -6434,13 +8142,19 @@ class ManagedServiceIdentity(Model): } _attribute_map = { - 'type': {'key': 'type', 'type': 'ManagedServiceIdentityType'}, + 'type': {'key': 'type', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, } - def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = type self.tenant_id = None @@ -6448,35 +8162,7 @@ def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> Non self.user_assigned_identities = user_assigned_identities -class ManagedServiceIdentityUserAssignedIdentitiesValue(Model): - """ManagedServiceIdentityUserAssignedIdentitiesValue. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar principal_id: Principal Id of user assigned identity - :vartype principal_id: str - :ivar client_id: Client Id of user assigned 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) -> None: - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class MetricAvailability(Model): +class MetricAvailability(msrest.serialization.Model): """Retention policy of a resource metric. :param time_grain: @@ -6490,13 +8176,19 @@ class MetricAvailability(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, time_grain: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(MetricAvailability, self).__init__(**kwargs) self.time_grain = time_grain self.blob_duration = blob_duration -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Definition of a single resource metric. :param name: @@ -6528,8 +8220,7 @@ class MetricSpecification(Model): :param category: :type category: str :param availabilities: - :type availabilities: - list[~azure.mgmt.web.v2019_08_01.models.MetricAvailability] + :type availabilities: list[~azure.mgmt.web.v2019_08_01.models.MetricAvailability] :param supported_time_grain_types: :type supported_time_grain_types: list[str] """ @@ -6553,7 +8244,27 @@ class MetricSpecification(Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, supports_instance_level_aggregation: bool=None, enable_regional_mdm_account: bool=None, source_mdm_account: str=None, source_mdm_namespace: str=None, metric_filter_pattern: str=None, fill_gap_with_zero: bool=None, is_internal: bool=None, dimensions=None, category: str=None, availabilities=None, supported_time_grain_types=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supports_instance_level_aggregation: Optional[bool] = None, + enable_regional_mdm_account: Optional[bool] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + metric_filter_pattern: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + is_internal: Optional[bool] = None, + dimensions: Optional[List["Dimension"]] = None, + category: Optional[str] = None, + availabilities: Optional[List["MetricAvailability"]] = None, + supported_time_grain_types: Optional[List[str]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -6576,10 +8287,7 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio class MigrateMySqlRequest(ProxyOnlyResource): """MySQL migration request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6589,21 +8297,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param connection_string: Required. Connection string to the remote MySQL - database. + :param connection_string: Connection string to the remote MySQL database. :type connection_string: str - :param migration_type: Required. The type of migration operation to be - done. Possible values include: 'LocalToRemote', 'RemoteToLocal' - :type migration_type: str or - ~azure.mgmt.web.v2019_08_01.models.MySqlMigrationType + :param migration_type: The type of migration operation to be done. Possible values include: + "LocalToRemote", "RemoteToLocal". + :type migration_type: str or ~azure.mgmt.web.v2019_08_01.models.MySqlMigrationType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'connection_string': {'required': True}, - 'migration_type': {'required': True}, } _attribute_map = { @@ -6612,10 +8316,17 @@ class MigrateMySqlRequest(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'migration_type': {'key': 'properties.migrationType', 'type': 'MySqlMigrationType'}, + 'migration_type': {'key': 'properties.migrationType', 'type': 'str'}, } - def __init__(self, *, connection_string: str, migration_type, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + connection_string: Optional[str] = None, + migration_type: Optional[Union[str, "MySqlMigrationType"]] = None, + **kwargs + ): super(MigrateMySqlRequest, self).__init__(kind=kind, **kwargs) self.connection_string = connection_string self.migration_type = migration_type @@ -6624,8 +8335,7 @@ def __init__(self, *, connection_string: str, migration_type, kind: str=None, ** class MigrateMySqlStatus(ProxyOnlyResource): """MySQL migration status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6635,13 +8345,12 @@ class MigrateMySqlStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar migration_operation_status: Status of the migration task. Possible - values include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' - :vartype migration_operation_status: str or - ~azure.mgmt.web.v2019_08_01.models.OperationStatus + :ivar migration_operation_status: Status of the migration task. Possible values include: + "InProgress", "Failed", "Succeeded", "TimedOut", "Created". + :vartype migration_operation_status: str or ~azure.mgmt.web.v2019_08_01.models.OperationStatus :ivar operation_id: Operation ID for the migration task. :vartype operation_id: str - :ivar local_my_sql_enabled: True if the web app has in app MySql enabled + :ivar local_my_sql_enabled: True if the web app has in app MySql enabled. :vartype local_my_sql_enabled: bool """ @@ -6659,12 +8368,17 @@ class MigrateMySqlStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'OperationStatus'}, + 'migration_operation_status': {'key': 'properties.migrationOperationStatus', 'type': 'str'}, 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, 'local_my_sql_enabled': {'key': 'properties.localMySqlEnabled', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MigrateMySqlStatus, self).__init__(kind=kind, **kwargs) self.migration_operation_status = None self.operation_id = None @@ -6674,8 +8388,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class MSDeploy(ProxyOnlyResource): """MSDeploy ARM PUT information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6685,29 +8398,24 @@ class MSDeploy(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param package_uri: Package URI + :param package_uri: Package URI. :type package_uri: str - :param connection_string: SQL Connection String + :param connection_string: SQL Connection String. :type connection_string: str - :param db_type: Database Type + :param db_type: Database Type. :type db_type: str - :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must - not be set if SetParameters is used. + :param set_parameters_xml_file_uri: URI of MSDeploy Parameters file. Must not be set if + SetParameters is used. :type set_parameters_xml_file_uri: str - :param set_parameters: MSDeploy Parameters. Must not be set if - SetParametersXmlFileUri is used. + :param set_parameters: MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. :type set_parameters: dict[str, str] - :param skip_app_data: Controls whether the MSDeploy operation skips the - App_Data directory. - If set to true, the existing App_Data directory on the - destination - will not be deleted, and any App_Data directory in the source will be - ignored. - Setting is false by default. + :param skip_app_data: Controls whether the MSDeploy operation skips the App_Data directory. + If set to :code:`true`, the existing App_Data directory on the destination + will not be deleted, and any App_Data directory in the source will be ignored. + Setting is :code:`false` by default. :type skip_app_data: bool - :param app_offline: Sets the AppOffline rule while the MSDeploy operation - executes. - Setting is false by default. + :param app_offline: Sets the AppOffline rule while the MSDeploy operation executes. + Setting is :code:`false` by default. :type app_offline: bool """ @@ -6731,7 +8439,19 @@ class MSDeploy(ProxyOnlyResource): 'app_offline': {'key': 'properties.appOffline', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, package_uri: str=None, connection_string: str=None, db_type: str=None, set_parameters_xml_file_uri: str=None, set_parameters=None, skip_app_data: bool=None, app_offline: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + package_uri: Optional[str] = None, + connection_string: Optional[str] = None, + db_type: Optional[str] = None, + set_parameters_xml_file_uri: Optional[str] = None, + set_parameters: Optional[Dict[str, str]] = None, + skip_app_data: Optional[bool] = None, + app_offline: Optional[bool] = None, + **kwargs + ): super(MSDeploy, self).__init__(kind=kind, **kwargs) self.package_uri = package_uri self.connection_string = connection_string @@ -6745,8 +8465,7 @@ def __init__(self, *, kind: str=None, package_uri: str=None, connection_string: class MSDeployLog(ProxyOnlyResource): """MSDeploy log. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6756,9 +8475,8 @@ class MSDeployLog(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar entries: List of log entry messages - :vartype entries: - list[~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntry] + :ivar entries: List of log entry messages. + :vartype entries: list[~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntry] """ _validation = { @@ -6776,24 +8494,26 @@ class MSDeployLog(ProxyOnlyResource): 'entries': {'key': 'properties.entries', 'type': '[MSDeployLogEntry]'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MSDeployLog, self).__init__(kind=kind, **kwargs) self.entries = None -class MSDeployLogEntry(Model): +class MSDeployLogEntry(msrest.serialization.Model): """MSDeploy log entry. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar time: Timestamp of log entry - :vartype time: datetime - :ivar type: Log entry type. Possible values include: 'Message', 'Warning', - 'Error' - :vartype type: str or - ~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntryType - :ivar message: Log entry message + :ivar time: Timestamp of log entry. + :vartype time: ~datetime.datetime + :ivar type: Log entry type. Possible values include: "Message", "Warning", "Error". + :vartype type: str or ~azure.mgmt.web.v2019_08_01.models.MSDeployLogEntryType + :ivar message: Log entry message. :vartype message: str """ @@ -6805,11 +8525,14 @@ class MSDeployLogEntry(Model): _attribute_map = { 'time': {'key': 'time', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'MSDeployLogEntryType'}, + 'type': {'key': 'type', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(MSDeployLogEntry, self).__init__(**kwargs) self.time = None self.type = None @@ -6819,8 +8542,7 @@ def __init__(self, **kwargs) -> None: class MSDeployStatus(ProxyOnlyResource): """MSDeploy ARM response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6830,17 +8552,17 @@ class MSDeployStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar deployer: Username of deployer + :ivar deployer: Username of deployer. :vartype deployer: str - :ivar provisioning_state: Provisioning state. Possible values include: - 'accepted', 'running', 'succeeded', 'failed', 'canceled' + :ivar provisioning_state: Provisioning state. Possible values include: "accepted", "running", + "succeeded", "failed", "canceled". :vartype provisioning_state: str or ~azure.mgmt.web.v2019_08_01.models.MSDeployProvisioningState - :ivar start_time: Start time of deploy operation - :vartype start_time: datetime - :ivar end_time: End time of deploy operation - :vartype end_time: datetime - :ivar complete: Whether the deployment operation has completed + :ivar start_time: Start time of deploy operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of deploy operation. + :vartype end_time: ~datetime.datetime + :ivar complete: Whether the deployment operation has completed. :vartype complete: bool """ @@ -6861,13 +8583,18 @@ class MSDeployStatus(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'deployer': {'key': 'properties.deployer', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'MSDeployProvisioningState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, 'complete': {'key': 'properties.complete', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(MSDeployStatus, self).__init__(kind=kind, **kwargs) self.deployer = None self.provisioning_state = None @@ -6876,7 +8603,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.complete = None -class NameIdentifier(Model): +class NameIdentifier(msrest.serialization.Model): """Identifies an object. :param name: Name of the object. @@ -6887,12 +8614,51 @@ class NameIdentifier(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): super(NameIdentifier, self).__init__(**kwargs) self.name = name -class NameValuePair(Model): +class NameIdentifierCollection(msrest.serialization.Model): + """Collection of domain name identifiers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.NameIdentifier] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NameIdentifier]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["NameIdentifier"], + **kwargs + ): + super(NameIdentifierCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NameValuePair(msrest.serialization.Model): """Name value pair. :param name: Pair name. @@ -6906,18 +8672,23 @@ class NameValuePair(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(NameValuePair, self).__init__(**kwargs) self.name = name self.value = value -class NetworkAccessControlEntry(Model): +class NetworkAccessControlEntry(msrest.serialization.Model): """Network access control entry. - :param action: Action object. Possible values include: 'Permit', 'Deny' - :type action: str or - ~azure.mgmt.web.v2019_08_01.models.AccessControlEntryAction + :param action: Action object. Possible values include: "Permit", "Deny". + :type action: str or ~azure.mgmt.web.v2019_08_01.models.AccessControlEntryAction :param description: Description of network access control entry. :type description: str :param order: Order of precedence. @@ -6927,13 +8698,21 @@ class NetworkAccessControlEntry(Model): """ _attribute_map = { - 'action': {'key': 'action', 'type': 'AccessControlEntryAction'}, + 'action': {'key': 'action', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'remote_subnet': {'key': 'remoteSubnet', 'type': 'str'}, } - def __init__(self, *, action=None, description: str=None, order: int=None, remote_subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + action: Optional[Union[str, "AccessControlEntryAction"]] = None, + description: Optional[str] = None, + order: Optional[int] = None, + remote_subnet: Optional[str] = None, + **kwargs + ): super(NetworkAccessControlEntry, self).__init__(**kwargs) self.action = action self.description = description @@ -6942,11 +8721,9 @@ def __init__(self, *, action=None, description: str=None, order: int=None, remot class NetworkFeatures(ProxyOnlyResource): - """Full view of network features for an app (presently VNET integration and - Hybrid Connections). + """Full view of network features for an app (presently VNET integration and Hybrid Connections). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -6959,14 +8736,12 @@ class NetworkFeatures(ProxyOnlyResource): :ivar virtual_network_name: The Virtual Network name. :vartype virtual_network_name: str :ivar virtual_network_connection: The Virtual Network summary view. - :vartype virtual_network_connection: - ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :vartype virtual_network_connection: ~azure.mgmt.web.v2019_08_01.models.VnetInfo :ivar hybrid_connections: The Hybrid Connections summary view. :vartype hybrid_connections: list[~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity] :ivar hybrid_connections_v2: The Hybrid Connection V2 (Service Bus) view. - :vartype hybrid_connections_v2: - list[~azure.mgmt.web.v2019_08_01.models.HybridConnection] + :vartype hybrid_connections_v2: list[~azure.mgmt.web.v2019_08_01.models.HybridConnection] """ _validation = { @@ -6990,7 +8765,12 @@ class NetworkFeatures(ProxyOnlyResource): 'hybrid_connections_v2': {'key': 'properties.hybridConnectionsV2', 'type': '[HybridConnection]'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(NetworkFeatures, self).__init__(kind=kind, **kwargs) self.virtual_network_name = None self.virtual_network_connection = None @@ -6998,16 +8778,16 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.hybrid_connections_v2 = None -class NetworkTrace(Model): +class NetworkTrace(msrest.serialization.Model): """Network trace. :param path: Local file path for the captured network trace file. :type path: str - :param status: Current status of the network trace operation, same as - Operation.Status (InProgress/Succeeded/Failed). + :param status: Current status of the network trace operation, same as Operation.Status + (InProgress/Succeeded/Failed). :type status: str - :param message: Detailed message of a network trace operation, e.g. error - message in case of failure. + :param message: Detailed message of a network trace operation, e.g. error message in case of + failure. :type message: str """ @@ -7017,31 +8797,38 @@ class NetworkTrace(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, path: str=None, status: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + path: Optional[str] = None, + status: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(NetworkTrace, self).__init__(**kwargs) self.path = path self.status = status self.message = message -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation on a resource. :param id: Operation ID. :type id: str :param name: Operation name. :type name: str - :param status: The current status of the operation. Possible values - include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', 'Created' + :param status: The current status of the operation. Possible values include: "InProgress", + "Failed", "Succeeded", "TimedOut", "Created". :type status: str or ~azure.mgmt.web.v2019_08_01.models.OperationStatus :param errors: Any errors associate with the operation. :type errors: list[~azure.mgmt.web.v2019_08_01.models.ErrorEntity] :param created_time: Time when operation has started. - :type created_time: datetime + :type created_time: ~datetime.datetime :param modified_time: Time when operation has been updated. - :type modified_time: datetime + :type modified_time: ~datetime.datetime :param expiration_time: Time when operation will expire. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime :param geo_master_operation_id: Applicable only for stamp operation ids. :type geo_master_operation_id: str """ @@ -7049,7 +8836,7 @@ class Operation(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'OperationStatus'}, + 'status': {'key': 'status', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[ErrorEntity]'}, 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'}, @@ -7057,7 +8844,19 @@ class Operation(Model): 'geo_master_operation_id': {'key': 'geoMasterOperationId', 'type': 'str'}, } - def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, created_time=None, modified_time=None, expiration_time=None, geo_master_operation_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "OperationStatus"]] = None, + errors: Optional[List["ErrorEntity"]] = None, + created_time: Optional[datetime.datetime] = None, + modified_time: Optional[datetime.datetime] = None, + expiration_time: Optional[datetime.datetime] = None, + geo_master_operation_id: Optional[str] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.id = id self.name = name @@ -7069,32 +8868,102 @@ def __init__(self, *, id: str=None, name: str=None, status=None, errors=None, cr self.geo_master_operation_id = geo_master_operation_id -class OutboundEnvironmentEndpoint(Model): - """Endpoints accessed for a common purpose that the App Service Environment - requires outbound network access to. +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the App Service Environment requires outbound network access to. - :param category: The type of service accessed by the App Service - Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active - Directory. + :param category: The type of service accessed by the App Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. :type category: str - :param endpoints: The endpoints that the App Service Environment reaches - the service at. - :type endpoints: - list[~azure.mgmt.web.v2019_08_01.models.EndpointDependency] + :param endpoints: The endpoints that the App Service Environment reaches the service at. + :type endpoints: list[~azure.mgmt.web.v2019_08_01.models.EndpointDependency] + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["EndpointDependency"]] = None, + **kwargs + ): + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["OutboundEnvironmentEndpoint"], + **kwargs + ): + super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PerfMonCounterCollection(msrest.serialization.Model): + """Collection of performance monitor counters. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.PerfMonResponse] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + 'value': {'key': 'value', 'type': '[PerfMonResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, category: str=None, endpoints=None, **kwargs) -> None: - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) - self.category = category - self.endpoints = endpoints + def __init__( + self, + *, + value: List["PerfMonResponse"], + **kwargs + ): + super(PerfMonCounterCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None -class PerfMonResponse(Model): +class PerfMonResponse(msrest.serialization.Model): """Performance monitor API response. :param code: The response code. @@ -7111,18 +8980,25 @@ class PerfMonResponse(Model): 'data': {'key': 'data', 'type': 'PerfMonSet'}, } - def __init__(self, *, code: str=None, message: str=None, data=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + data: Optional["PerfMonSet"] = None, + **kwargs + ): super(PerfMonResponse, self).__init__(**kwargs) self.code = code self.message = message self.data = data -class PerfMonSample(Model): +class PerfMonSample(msrest.serialization.Model): """Performance monitor sample in a set. :param time: Point in time for which counter was measured. - :type time: datetime + :type time: ~datetime.datetime :param instance_name: Name of the server on which the measurement is made. :type instance_name: str :param value: Value of counter at a certain time. @@ -7135,22 +9011,29 @@ class PerfMonSample(Model): 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, time=None, instance_name: str=None, value: float=None, **kwargs) -> None: + def __init__( + self, + *, + time: Optional[datetime.datetime] = None, + instance_name: Optional[str] = None, + value: Optional[float] = None, + **kwargs + ): super(PerfMonSample, self).__init__(**kwargs) self.time = time self.instance_name = instance_name self.value = value -class PerfMonSet(Model): +class PerfMonSet(msrest.serialization.Model): """Metric information. :param name: Unique key name of the counter. :type name: str :param start_time: Start time of the period. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time of the period. - :type end_time: datetime + :type end_time: ~datetime.datetime :param time_grain: Presented time grain. :type time_grain: str :param values: Collection of workers that are active during this time. @@ -7165,7 +9048,16 @@ class PerfMonSet(Model): 'values': {'key': 'values', 'type': '[PerfMonSample]'}, } - def __init__(self, *, name: str=None, start_time=None, end_time=None, time_grain: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + time_grain: Optional[str] = None, + values: Optional[List["PerfMonSample"]] = None, + **kwargs + ): super(PerfMonSet, self).__init__(**kwargs) self.name = name self.start_time = start_time @@ -7177,8 +9069,7 @@ def __init__(self, *, name: str=None, start_time=None, end_time=None, time_grain class PremierAddOn(Resource): """Premier add-on. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -7192,7 +9083,7 @@ class PremierAddOn(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Premier add on SKU. :type sku: str @@ -7227,7 +9118,19 @@ class PremierAddOn(Resource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, sku: str=None, product: str=None, vendor: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOn, self).__init__(kind=kind, location=location, tags=tags, **kwargs) self.sku = sku self.product = product @@ -7239,8 +9142,7 @@ def __init__(self, *, location: str, kind: str=None, tags=None, sku: str=None, p class PremierAddOnOffer(ProxyOnlyResource): """Premier add-on offer. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7256,14 +9158,13 @@ class PremierAddOnOffer(ProxyOnlyResource): :type product: str :param vendor: Premier add on offer Vendor. :type vendor: str - :param promo_code_required: true if promotion code is - required; otherwise, false. + :param promo_code_required: :code:`true` if promotion code is required; otherwise, + :code:`false`. :type promo_code_required: bool :param quota: Premier add on offer Quota. :type quota: int - :param web_hosting_plan_restrictions: App Service plans this offer is - restricted to. Possible values include: 'None', 'Free', 'Shared', 'Basic', - 'Standard', 'Premium' + :param web_hosting_plan_restrictions: App Service plans this offer is restricted to. Possible + values include: "None", "Free", "Shared", "Basic", "Standard", "Premium". :type web_hosting_plan_restrictions: str or ~azure.mgmt.web.v2019_08_01.models.AppServicePlanRestrictions :param privacy_policy_url: Privacy policy URL. @@ -7292,14 +9193,29 @@ class PremierAddOnOffer(ProxyOnlyResource): 'vendor': {'key': 'properties.vendor', 'type': 'str'}, 'promo_code_required': {'key': 'properties.promoCodeRequired', 'type': 'bool'}, 'quota': {'key': 'properties.quota', 'type': 'int'}, - 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'AppServicePlanRestrictions'}, + 'web_hosting_plan_restrictions': {'key': 'properties.webHostingPlanRestrictions', 'type': 'str'}, 'privacy_policy_url': {'key': 'properties.privacyPolicyUrl', 'type': 'str'}, 'legal_terms_url': {'key': 'properties.legalTermsUrl', 'type': 'str'}, 'marketplace_publisher': {'key': 'properties.marketplacePublisher', 'type': 'str'}, 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: str=None, promo_code_required: bool=None, quota: int=None, web_hosting_plan_restrictions=None, privacy_policy_url: str=None, legal_terms_url: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + promo_code_required: Optional[bool] = None, + quota: Optional[int] = None, + web_hosting_plan_restrictions: Optional[Union[str, "AppServicePlanRestrictions"]] = None, + privacy_policy_url: Optional[str] = None, + legal_terms_url: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOnOffer, self).__init__(kind=kind, **kwargs) self.sku = sku self.product = product @@ -7313,11 +9229,44 @@ def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: self.marketplace_offer = marketplace_offer +class PremierAddOnOfferCollection(msrest.serialization.Model): + """Collection of premier add-on offers. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOffer] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremierAddOnOffer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PremierAddOnOffer"], + **kwargs + ): + super(PremierAddOnOfferCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class PremierAddOnPatchResource(ProxyOnlyResource): """ARM resource for a PremierAddOn. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7357,7 +9306,17 @@ class PremierAddOnPatchResource(ProxyOnlyResource): 'marketplace_offer': {'key': 'properties.marketplaceOffer', 'type': 'str'}, } - def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: str=None, marketplace_publisher: str=None, marketplace_offer: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional[str] = None, + product: Optional[str] = None, + vendor: Optional[str] = None, + marketplace_publisher: Optional[str] = None, + marketplace_offer: Optional[str] = None, + **kwargs + ): super(PremierAddOnPatchResource, self).__init__(kind=kind, **kwargs) self.sku = sku self.product = product @@ -7369,8 +9328,7 @@ def __init__(self, *, kind: str=None, sku: str=None, product: str=None, vendor: class PrivateAccess(ProxyOnlyResource): """Description of the parameters of Private Access for a Web Site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7382,10 +9340,9 @@ class PrivateAccess(ProxyOnlyResource): :vartype type: str :param enabled: Whether private access is enabled or not. :type enabled: bool - :param virtual_networks: The Virtual Networks (and subnets) allowed to - access the site privately. - :type virtual_networks: - list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessVirtualNetwork] + :param virtual_networks: The Virtual Networks (and subnets) allowed to access the site + privately. + :type virtual_networks: list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessVirtualNetwork] """ _validation = { @@ -7403,15 +9360,21 @@ class PrivateAccess(ProxyOnlyResource): 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[PrivateAccessVirtualNetwork]'}, } - def __init__(self, *, kind: str=None, enabled: bool=None, virtual_networks=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + enabled: Optional[bool] = None, + virtual_networks: Optional[List["PrivateAccessVirtualNetwork"]] = None, + **kwargs + ): super(PrivateAccess, self).__init__(kind=kind, **kwargs) self.enabled = enabled self.virtual_networks = virtual_networks -class PrivateAccessSubnet(Model): - """Description of a Virtual Network subnet that is useable for private site - access. +class PrivateAccessSubnet(msrest.serialization.Model): + """Description of a Virtual Network subnet that is useable for private site access. :param name: The name of the subnet. :type name: str @@ -7424,26 +9387,31 @@ class PrivateAccessSubnet(Model): 'key': {'key': 'key', 'type': 'int'}, } - def __init__(self, *, name: str=None, key: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + key: Optional[int] = None, + **kwargs + ): super(PrivateAccessSubnet, self).__init__(**kwargs) self.name = name self.key = key -class PrivateAccessVirtualNetwork(Model): +class PrivateAccessVirtualNetwork(msrest.serialization.Model): """Description of a Virtual Network that is useable for private site access. :param name: The name of the Virtual Network. :type name: str :param key: The key (ID) of the Virtual Network. :type key: int - :param resource_id: The ARM uri of the Virtual Network + :param resource_id: The ARM uri of the Virtual Network. :type resource_id: str - :param subnets: A List of subnets that access is allowed to on this - Virtual Network. An empty array (but not null) is interpreted to mean that - all subnets are allowed within this Virtual Network. - :type subnets: - list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessSubnet] + :param subnets: A List of subnets that access is allowed to on this Virtual Network. An empty + array (but not null) is interpreted to mean that all subnets are allowed within this Virtual + Network. + :type subnets: list[~azure.mgmt.web.v2019_08_01.models.PrivateAccessSubnet] """ _attribute_map = { @@ -7453,7 +9421,15 @@ class PrivateAccessVirtualNetwork(Model): 'subnets': {'key': 'subnets', 'type': '[PrivateAccessSubnet]'}, } - def __init__(self, *, name: str=None, key: int=None, resource_id: str=None, subnets=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + key: Optional[int] = None, + resource_id: Optional[str] = None, + subnets: Optional[List["PrivateAccessSubnet"]] = None, + **kwargs + ): super(PrivateAccessVirtualNetwork, self).__init__(**kwargs) self.name = name self.key = key @@ -7464,8 +9440,7 @@ def __init__(self, *, name: str=None, key: int=None, resource_id: str=None, subn class PrivateEndpointConnectionResource(ProxyOnlyResource): """Private Endpoint Connection ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7477,10 +9452,9 @@ class PrivateEndpointConnectionResource(ProxyOnlyResource): :vartype type: str :ivar provisioning_state: :vartype provisioning_state: str - :param private_endpoint: PrivateEndpoint of a remote private endpoint - connection + :param private_endpoint: PrivateEndpoint of a remote private endpoint connection. :type private_endpoint: ~azure.mgmt.web.v2019_08_01.models.ArmIdWrapper - :param private_link_service_connection_state: + :param private_link_service_connection_state: The state of a private link connection. :type private_link_service_connection_state: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionState """ @@ -7502,7 +9476,14 @@ class PrivateEndpointConnectionResource(ProxyOnlyResource): 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkConnectionState'}, } - def __init__(self, *, kind: str=None, private_endpoint=None, private_link_service_connection_state=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + private_endpoint: Optional["ArmIdWrapper"] = None, + private_link_service_connection_state: Optional["PrivateLinkConnectionState"] = None, + **kwargs + ): super(PrivateEndpointConnectionResource, self).__init__(kind=kind, **kwargs) self.provisioning_state = None self.private_endpoint = private_endpoint @@ -7512,8 +9493,7 @@ def __init__(self, *, kind: str=None, private_endpoint=None, private_link_servic class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): """Private Endpoint Connection Approval ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7523,7 +9503,7 @@ class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param private_link_service_connection_state: + :param private_link_service_connection_state: The state of a private link connection. :type private_link_service_connection_state: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionState """ @@ -7542,19 +9522,25 @@ class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkConnectionState'}, } - def __init__(self, *, kind: str=None, private_link_service_connection_state=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + private_link_service_connection_state: Optional["PrivateLinkConnectionState"] = None, + **kwargs + ): super(PrivateLinkConnectionApprovalRequestResource, self).__init__(kind=kind, **kwargs) self.private_link_service_connection_state = private_link_service_connection_state -class PrivateLinkConnectionState(Model): +class PrivateLinkConnectionState(msrest.serialization.Model): """The state of a private link connection. - :param status: Status of a private link connection + :param status: Status of a private link connection. :type status: str - :param description: Description of a private link connection + :param description: Description of a private link connection. :type description: str - :param actions_required: ActionsRequired for a private link connection + :param actions_required: ActionsRequired for a private link connection. :type actions_required: str """ @@ -7564,27 +9550,33 @@ class PrivateLinkConnectionState(Model): 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } - def __init__(self, *, status: str=None, description: str=None, actions_required: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[str] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): super(PrivateLinkConnectionState, self).__init__(**kwargs) self.status = status self.description = description self.actions_required = actions_required -class PrivateLinkResource(Model): +class PrivateLinkResource(msrest.serialization.Model): """A private link resource. All required parameters must be populated in order to send to Azure. :param id: Required. :type id: str - :param name: Required. Name of a private link resource + :param name: Required. Name of a private link resource. :type name: str :param type: Required. :type type: str - :param properties: Required. Properties of a private link resource - :type properties: - ~azure.mgmt.web.v2019_08_01.models.PrivateLinkResourceProperties + :param properties: Required. Properties of a private link resource. + :type properties: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkResourceProperties """ _validation = { @@ -7601,7 +9593,15 @@ class PrivateLinkResource(Model): 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, } - def __init__(self, *, id: str, name: str, type: str, properties, **kwargs) -> None: + def __init__( + self, + *, + id: str, + name: str, + type: str, + properties: "PrivateLinkResourceProperties", + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) self.id = id self.name = name @@ -7609,17 +9609,16 @@ def __init__(self, *, id: str, name: str, type: str, properties, **kwargs) -> No self.properties = properties -class PrivateLinkResourceProperties(Model): +class PrivateLinkResourceProperties(msrest.serialization.Model): """Properties of a private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar group_id: GroupId of a private link resource + :ivar group_id: GroupId of a private link resource. :vartype group_id: str - :ivar required_members: RequiredMembers of a private link resource + :ivar required_members: RequiredMembers of a private link resource. :vartype required_members: list[str] - :ivar required_zone_names: RequiredZoneNames of a private link resource + :ivar required_zone_names: RequiredZoneNames of a private link resource. :vartype required_zone_names: list[str] """ @@ -7635,14 +9634,17 @@ class PrivateLinkResourceProperties(Model): 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PrivateLinkResourceProperties, self).__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = None -class PrivateLinkResourcesWrapper(Model): +class PrivateLinkResourcesWrapper(msrest.serialization.Model): """Wrapper for a collection of private link resources. All required parameters must be populated in order to send to Azure. @@ -7659,7 +9661,12 @@ class PrivateLinkResourcesWrapper(Model): 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["PrivateLinkResource"], + **kwargs + ): super(PrivateLinkResourcesWrapper, self).__init__(**kwargs) self.value = value @@ -7667,8 +9674,7 @@ def __init__(self, *, value, **kwargs) -> None: class ProcessInfo(ProxyOnlyResource): """Process Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7686,9 +9692,9 @@ class ProcessInfo(ProxyOnlyResource): :type href: str :param minidump: Minidump URI. :type minidump: str - :param is_profile_running: Is profile running? + :param is_profile_running: Is profile running?. :type is_profile_running: bool - :param is_iis_profile_running: Is the IIS Profile running? + :param is_iis_profile_running: Is the IIS Profile running?. :type is_iis_profile_running: bool :param iis_profile_timeout_in_seconds: IIS Profile timeout (seconds). :type iis_profile_timeout_in_seconds: float @@ -7715,7 +9721,7 @@ class ProcessInfo(ProxyOnlyResource): :param thread_count: Thread count. :type thread_count: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_cpu_time: Total CPU time. :type total_cpu_time: str :param user_cpu_time: User CPU time. @@ -7741,12 +9747,12 @@ class ProcessInfo(ProxyOnlyResource): :param peak_paged_memory: Peak paged memory. :type peak_paged_memory: long :param time_stamp: Time stamp. - :type time_stamp: datetime + :type time_stamp: ~datetime.datetime :param environment_variables: List of environment variables. :type environment_variables: dict[str, str] - :param is_scm_site: Is this the SCM site? + :param is_scm_site: Is this the SCM site?. :type is_scm_site: bool - :param is_webjob: Is this a Web Job? + :param is_webjob: Is this a Web Job?. :type is_webjob: bool :param description: Description of process. :type description: str @@ -7802,7 +9808,47 @@ class ProcessInfo(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, deployment_name: str=None, href: str=None, minidump: str=None, is_profile_running: bool=None, is_iis_profile_running: bool=None, iis_profile_timeout_in_seconds: float=None, parent: str=None, children=None, threads=None, open_file_handles=None, modules=None, file_name: str=None, command_line: str=None, user_name: str=None, handle_count: int=None, module_count: int=None, thread_count: int=None, start_time=None, total_cpu_time: str=None, user_cpu_time: str=None, privileged_cpu_time: str=None, working_set: int=None, peak_working_set: int=None, private_memory: int=None, virtual_memory: int=None, peak_virtual_memory: int=None, paged_system_memory: int=None, non_paged_system_memory: int=None, paged_memory: int=None, peak_paged_memory: int=None, time_stamp=None, environment_variables=None, is_scm_site: bool=None, is_webjob: bool=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + deployment_name: Optional[str] = None, + href: Optional[str] = None, + minidump: Optional[str] = None, + is_profile_running: Optional[bool] = None, + is_iis_profile_running: Optional[bool] = None, + iis_profile_timeout_in_seconds: Optional[float] = None, + parent: Optional[str] = None, + children: Optional[List[str]] = None, + threads: Optional[List["ProcessThreadInfo"]] = None, + open_file_handles: Optional[List[str]] = None, + modules: Optional[List["ProcessModuleInfo"]] = None, + file_name: Optional[str] = None, + command_line: Optional[str] = None, + user_name: Optional[str] = None, + handle_count: Optional[int] = None, + module_count: Optional[int] = None, + thread_count: Optional[int] = None, + start_time: Optional[datetime.datetime] = None, + total_cpu_time: Optional[str] = None, + user_cpu_time: Optional[str] = None, + privileged_cpu_time: Optional[str] = None, + working_set: Optional[int] = None, + peak_working_set: Optional[int] = None, + private_memory: Optional[int] = None, + virtual_memory: Optional[int] = None, + peak_virtual_memory: Optional[int] = None, + paged_system_memory: Optional[int] = None, + non_paged_system_memory: Optional[int] = None, + paged_memory: Optional[int] = None, + peak_paged_memory: Optional[int] = None, + time_stamp: Optional[datetime.datetime] = None, + environment_variables: Optional[Dict[str, str]] = None, + is_scm_site: Optional[bool] = None, + is_webjob: Optional[bool] = None, + description: Optional[str] = None, + **kwargs + ): super(ProcessInfo, self).__init__(kind=kind, **kwargs) self.identifier = None self.deployment_name = deployment_name @@ -7842,11 +9888,44 @@ def __init__(self, *, kind: str=None, deployment_name: str=None, href: str=None, self.description = description +class ProcessInfoCollection(msrest.serialization.Model): + """Collection of Kudu process information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ProcessInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessInfo"], + **kwargs + ): + super(ProcessInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ProcessModuleInfo(ProxyOnlyResource): """Process Module Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7856,8 +9935,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param base_address: Base address. Used as module identifier in ARM - resource URI. + :param base_address: Base address. Used as module identifier in ARM resource URI. :type base_address: str :param file_name: File name. :type file_name: str @@ -7875,7 +9953,7 @@ class ProcessModuleInfo(ProxyOnlyResource): :type product: str :param product_version: Product version. :type product_version: str - :param is_debug: Is debug? + :param is_debug: Is debug?. :type is_debug: bool :param language: Module language (locale). :type language: str @@ -7905,7 +9983,23 @@ class ProcessModuleInfo(ProxyOnlyResource): 'language': {'key': 'properties.language', 'type': 'str'}, } - def __init__(self, *, kind: str=None, base_address: str=None, file_name: str=None, href: str=None, file_path: str=None, module_memory_size: int=None, file_version: str=None, file_description: str=None, product: str=None, product_version: str=None, is_debug: bool=None, language: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + base_address: Optional[str] = None, + file_name: Optional[str] = None, + href: Optional[str] = None, + file_path: Optional[str] = None, + module_memory_size: Optional[int] = None, + file_version: Optional[str] = None, + file_description: Optional[str] = None, + product: Optional[str] = None, + product_version: Optional[str] = None, + is_debug: Optional[bool] = None, + language: Optional[str] = None, + **kwargs + ): super(ProcessModuleInfo, self).__init__(kind=kind, **kwargs) self.base_address = base_address self.file_name = file_name @@ -7920,11 +10014,44 @@ def __init__(self, *, kind: str=None, base_address: str=None, file_name: str=Non self.language = language +class ProcessModuleInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessModuleInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessModuleInfo"], + **kwargs + ): + super(ProcessModuleInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ProcessThreadInfo(ProxyOnlyResource): """Process Thread Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -7949,7 +10076,7 @@ class ProcessThreadInfo(ProxyOnlyResource): :param base_priority: Base priority. :type base_priority: int :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param total_processor_time: Total processor time. :type total_processor_time: str :param user_processor_time: User processor time. @@ -7986,7 +10113,23 @@ class ProcessThreadInfo(ProxyOnlyResource): 'wait_reason': {'key': 'properties.wait_reason', 'type': 'str'}, } - def __init__(self, *, kind: str=None, href: str=None, process: str=None, start_address: str=None, current_priority: int=None, priority_level: str=None, base_priority: int=None, start_time=None, total_processor_time: str=None, user_processor_time: str=None, state: str=None, wait_reason: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + href: Optional[str] = None, + process: Optional[str] = None, + start_address: Optional[str] = None, + current_priority: Optional[int] = None, + priority_level: Optional[str] = None, + base_priority: Optional[int] = None, + start_time: Optional[datetime.datetime] = None, + total_processor_time: Optional[str] = None, + user_processor_time: Optional[str] = None, + state: Optional[str] = None, + wait_reason: Optional[str] = None, + **kwargs + ): super(ProcessThreadInfo, self).__init__(kind=kind, **kwargs) self.identifier = None self.href = href @@ -8002,11 +10145,44 @@ def __init__(self, *, kind: str=None, href: str=None, process: str=None, start_a self.wait_reason = wait_reason +class ProcessThreadInfoCollection(msrest.serialization.Model): + """Collection of Kudu thread information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProcessThreadInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProcessThreadInfo"], + **kwargs + ): + super(ProcessThreadInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class PublicCertificate(ProxyOnlyResource): """Public certificate object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8016,13 +10192,13 @@ class PublicCertificate(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param blob: Public Certificate byte array + :param blob: Public Certificate byte array. :type blob: bytearray - :param public_certificate_location: Public Certificate Location. Possible - values include: 'CurrentUserMy', 'LocalMachineMy', 'Unknown' + :param public_certificate_location: Public Certificate Location. Possible values include: + "CurrentUserMy", "LocalMachineMy", "Unknown". :type public_certificate_location: str or ~azure.mgmt.web.v2019_08_01.models.PublicCertificateLocation - :ivar thumbprint: Certificate Thumbprint + :ivar thumbprint: Certificate Thumbprint. :vartype thumbprint: str """ @@ -8039,25 +10215,63 @@ class PublicCertificate(ProxyOnlyResource): 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'blob': {'key': 'properties.blob', 'type': 'bytearray'}, - 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'PublicCertificateLocation'}, + 'public_certificate_location': {'key': 'properties.publicCertificateLocation', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, } - def __init__(self, *, kind: str=None, blob: bytearray=None, public_certificate_location=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + blob: Optional[bytearray] = None, + public_certificate_location: Optional[Union[str, "PublicCertificateLocation"]] = None, + **kwargs + ): super(PublicCertificate, self).__init__(kind=kind, **kwargs) self.blob = blob self.public_certificate_location = public_certificate_location self.thumbprint = None -class PushSettings(ProxyOnlyResource): - """Push settings for the App. +class PublicCertificateCollection(msrest.serialization.Model): + """Collection of public certificates. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.PublicCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublicCertificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["PublicCertificate"], + **kwargs + ): + super(PublicCertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PushSettings(ProxyOnlyResource): + """Push settings for the App. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -8066,22 +10280,19 @@ class PushSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param is_push_enabled: Required. Gets or sets a flag indicating whether - the Push endpoint is enabled. + :param is_push_enabled: Gets or sets a flag indicating whether the Push endpoint is enabled. :type is_push_enabled: bool - :param tag_whitelist_json: Gets or sets a JSON string containing a list of - tags that are whitelisted for use by the push registration endpoint. + :param tag_whitelist_json: Gets or sets a JSON string containing a list of tags that are + whitelisted for use by the push registration endpoint. :type tag_whitelist_json: str - :param tags_requiring_auth: Gets or sets a JSON string containing a list - of tags that require user authentication to be used in the push - registration endpoint. + :param tags_requiring_auth: Gets or sets a JSON string containing a list of tags that require + user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler. :type tags_requiring_auth: str - :param dynamic_tags_json: Gets or sets a JSON string containing a list of - dynamic tags that will be evaluated from user claims in the push - registration endpoint. + :param dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that + will be evaluated from user claims in the push registration endpoint. :type dynamic_tags_json: str """ @@ -8089,7 +10300,6 @@ class PushSettings(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'is_push_enabled': {'required': True}, } _attribute_map = { @@ -8103,7 +10313,16 @@ class PushSettings(ProxyOnlyResource): 'dynamic_tags_json': {'key': 'properties.dynamicTagsJson', 'type': 'str'}, } - def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: str=None, tags_requiring_auth: str=None, dynamic_tags_json: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + is_push_enabled: Optional[bool] = None, + tag_whitelist_json: Optional[str] = None, + tags_requiring_auth: Optional[str] = None, + dynamic_tags_json: Optional[str] = None, + **kwargs + ): super(PushSettings, self).__init__(kind=kind, **kwargs) self.is_push_enabled = is_push_enabled self.tag_whitelist_json = tag_whitelist_json @@ -8111,41 +10330,39 @@ def __init__(self, *, is_push_enabled: bool, kind: str=None, tag_whitelist_json: self.dynamic_tags_json = dynamic_tags_json -class RampUpRule(Model): - """Routing rules for ramp up testing. This rule allows to redirect static - traffic % to a slot or to gradually change routing % based on performance. +class RampUpRule(msrest.serialization.Model): + """Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance. - :param action_host_name: Hostname of a slot to which the traffic will be - redirected if decided to. E.g. myapp-stage.azurewebsites.net. + :param action_host_name: Hostname of a slot to which the traffic will be redirected if decided + to. E.g. myapp-stage.azurewebsites.net. :type action_host_name: str - :param reroute_percentage: Percentage of the traffic which will be - redirected to ActionHostName. + :param reroute_percentage: Percentage of the traffic which will be redirected to + :code:`ActionHostName`. :type reroute_percentage: float - :param change_step: In auto ramp up scenario this is the step to - add/remove from ReroutePercentage until it reaches - \\nMinReroutePercentage or - MaxReroutePercentage. Site metrics are checked every N - minutes specified in ChangeIntervalInMinutes.\\nCustom - decision algorithm - can be provided in TiPCallback site extension which URL can be specified - in ChangeDecisionCallbackUrl. + :param change_step: In auto ramp up scenario this is the step to add/remove from + :code:`ReroutePercentage` until it reaches + \n:code:`MinReroutePercentage` or + :code:`MaxReroutePercentage`. Site metrics are checked every N minutes specified + in :code:`ChangeIntervalInMinutes`.\nCustom decision algorithm + can be provided in TiPCallback site extension which URL can be specified in + :code:`ChangeDecisionCallbackUrl`. :type change_step: float - :param change_interval_in_minutes: Specifies interval in minutes to - reevaluate ReroutePercentage. + :param change_interval_in_minutes: Specifies interval in minutes to reevaluate + ReroutePercentage. :type change_interval_in_minutes: int - :param min_reroute_percentage: Specifies lower boundary above which - ReroutePercentage will stay. + :param min_reroute_percentage: Specifies lower boundary above which ReroutePercentage will + stay. :type min_reroute_percentage: float - :param max_reroute_percentage: Specifies upper boundary below which - ReroutePercentage will stay. + :param max_reroute_percentage: Specifies upper boundary below which ReroutePercentage will + stay. :type max_reroute_percentage: float - :param change_decision_callback_url: Custom decision algorithm can be - provided in TiPCallback site extension which URL can be specified. See - TiPCallback site extension for the scaffold and contracts. - https://www.siteextensions.net/packages/TiPCallback/ + :param change_decision_callback_url: Custom decision algorithm can be provided in TiPCallback + site extension which URL can be specified. See TiPCallback site extension for the scaffold and + contracts. + https://www.siteextensions.net/packages/TiPCallback/. :type change_decision_callback_url: str - :param name: Name of the routing rule. The recommended name would be to - point to the slot which will receive the traffic in the experiment. + :param name: Name of the routing rule. The recommended name would be to point to the slot which + will receive the traffic in the experiment. :type name: str """ @@ -8160,7 +10377,19 @@ class RampUpRule(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None, change_step: float=None, change_interval_in_minutes: int=None, min_reroute_percentage: float=None, max_reroute_percentage: float=None, change_decision_callback_url: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + action_host_name: Optional[str] = None, + reroute_percentage: Optional[float] = None, + change_step: Optional[float] = None, + change_interval_in_minutes: Optional[int] = None, + min_reroute_percentage: Optional[float] = None, + max_reroute_percentage: Optional[float] = None, + change_decision_callback_url: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(RampUpRule, self).__init__(**kwargs) self.action_host_name = action_host_name self.reroute_percentage = reroute_percentage @@ -8175,8 +10404,7 @@ def __init__(self, *, action_host_name: str=None, reroute_percentage: float=None class Recommendation(ProxyOnlyResource): """Represents a recommendation result generated by the recommendation engine. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8187,68 +10415,58 @@ class Recommendation(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param creation_time: Timestamp when this instance was created. - :type creation_time: datetime - :param recommendation_id: A GUID value that each recommendation object is - associated with. + :type creation_time: ~datetime.datetime + :param recommendation_id: A GUID value that each recommendation object is associated with. :type recommendation_id: str - :param resource_id: Full ARM resource ID string that this recommendation - object is associated with. + :param resource_id: Full ARM resource ID string that this recommendation object is associated + with. :type resource_id: str - :param resource_scope: Name of a resource type this recommendation - applies, e.g. Subscription, ServerFarm, Site. Possible values include: - 'ServerFarm', 'Subscription', 'WebSite' - :type resource_scope: str or - ~azure.mgmt.web.v2019_08_01.models.ResourceScopeType + :param resource_scope: Name of a resource type this recommendation applies, e.g. Subscription, + ServerFarm, Site. Possible values include: "ServerFarm", "Subscription", "WebSite". + :type resource_scope: str or ~azure.mgmt.web.v2019_08_01.models.ResourceScopeType :param rule_name: Unique name of the rule. :type rule_name: str :param display_name: UI friendly name of the rule (may not be unique). :type display_name: str :param message: Recommendation text. :type message: str - :param level: Level indicating how critical this recommendation can - impact. Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level indicating how critical this recommendation can impact. Possible values + include: "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2019_08_01.models.NotificationLevel - :param channels: List of channels that this recommendation can apply. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of channels that this recommendation can apply. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2019_08_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - belongs to. + :ivar category_tags: The list of category tags that this recommendation belongs to. :vartype category_tags: list[str] :param action_name: Name of action recommended by this object. :type action_name: str - :param enabled: True if this recommendation is still valid (i.e. - "actionable"). False if it is invalid. + :param enabled: True if this recommendation is still valid (i.e. "actionable"). False if it is + invalid. :type enabled: int - :param states: The list of states of this recommendation. If it's null - then it should be considered "Active". + :param states: The list of states of this recommendation. If it's null then it should be + considered "Active". :type states: list[str] - :param start_time: The beginning time in UTC of a range that the - recommendation refers to. - :type start_time: datetime - :param end_time: The end time in UTC of a range that the recommendation - refers to. - :type end_time: datetime - :param next_notification_time: When to notify this recommendation next in - UTC. Null means that this will never be notified anymore. - :type next_notification_time: datetime - :param notification_expiration_time: Date and time in UTC when this - notification expires. - :type notification_expiration_time: datetime - :param notified_time: Last timestamp in UTC this instance was actually - notified. Null means that this recommendation hasn't been notified yet. - :type notified_time: datetime + :param start_time: The beginning time in UTC of a range that the recommendation refers to. + :type start_time: ~datetime.datetime + :param end_time: The end time in UTC of a range that the recommendation refers to. + :type end_time: ~datetime.datetime + :param next_notification_time: When to notify this recommendation next in UTC. Null means that + this will never be notified anymore. + :type next_notification_time: ~datetime.datetime + :param notification_expiration_time: Date and time in UTC when this notification expires. + :type notification_expiration_time: ~datetime.datetime + :param notified_time: Last timestamp in UTC this instance was actually notified. Null means + that this recommendation hasn't been notified yet. + :type notified_time: ~datetime.datetime :param score: A metric value measured by the rule. :type score: float - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool :param extension_name: Extension name of the portal if exists. :type extension_name: str :param blade_name: Deep link to a blade on the portal. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. + :param forward_link: Forward link to an external document associated with the rule. :type forward_link: str """ @@ -8271,8 +10489,8 @@ class Recommendation(ProxyOnlyResource): 'rule_name': {'key': 'properties.ruleName', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'message': {'key': 'properties.message', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'int'}, @@ -8289,7 +10507,34 @@ class Recommendation(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, creation_time=None, recommendation_id: str=None, resource_id: str=None, resource_scope=None, rule_name: str=None, display_name: str=None, message: str=None, level=None, channels=None, action_name: str=None, enabled: int=None, states=None, start_time=None, end_time=None, next_notification_time=None, notification_expiration_time=None, notified_time=None, score: float=None, is_dynamic: bool=None, extension_name: str=None, blade_name: str=None, forward_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + recommendation_id: Optional[str] = None, + resource_id: Optional[str] = None, + resource_scope: Optional[Union[str, "ResourceScopeType"]] = None, + rule_name: Optional[str] = None, + display_name: Optional[str] = None, + message: Optional[str] = None, + level: Optional[Union[str, "NotificationLevel"]] = None, + channels: Optional[Union[str, "Channels"]] = None, + action_name: Optional[str] = None, + enabled: Optional[int] = None, + states: Optional[List[str]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + next_notification_time: Optional[datetime.datetime] = None, + notification_expiration_time: Optional[datetime.datetime] = None, + notified_time: Optional[datetime.datetime] = None, + score: Optional[float] = None, + is_dynamic: Optional[bool] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + forward_link: Optional[str] = None, + **kwargs + ): super(Recommendation, self).__init__(kind=kind, **kwargs) self.creation_time = creation_time self.recommendation_id = recommendation_id @@ -8316,12 +10561,44 @@ def __init__(self, *, kind: str=None, creation_time=None, recommendation_id: str self.forward_link = forward_link +class RecommendationCollection(msrest.serialization.Model): + """Collection of recommendations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Recommendation] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Recommendation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Recommendation"], + **kwargs + ): + super(RecommendationCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class RecommendationRule(ProxyOnlyResource): - """Represents a recommendation rule that the recommendation engine can - perform. + """Represents a recommendation rule that the recommendation engine can perform. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8337,36 +10614,30 @@ class RecommendationRule(ProxyOnlyResource): :type display_name: str :param message: Localized name of the rule (Good for UI). :type message: str - :param recommendation_id: Recommendation ID of an associated - recommendation object tied to the rule, if exists. + :param recommendation_id: Recommendation ID of an associated recommendation object tied to the + rule, if exists. If such an object doesn't exist, it is set to null. :type recommendation_id: str :param description: Localized detailed description of the rule. :type description: str - :param action_name: Name of action that is recommended by this rule in - string. + :param action_name: Name of action that is recommended by this rule in string. :type action_name: str - :param level: Level of impact indicating how critical this rule is. - Possible values include: 'Critical', 'Warning', 'Information', - 'NonUrgentSuggestion' + :param level: Level of impact indicating how critical this rule is. Possible values include: + "Critical", "Warning", "Information", "NonUrgentSuggestion". :type level: str or ~azure.mgmt.web.v2019_08_01.models.NotificationLevel - :param channels: List of available channels that this rule applies. - Possible values include: 'Notification', 'Api', 'Email', 'Webhook', 'All' + :param channels: List of available channels that this rule applies. Possible values include: + "Notification", "Api", "Email", "Webhook", "All". :type channels: str or ~azure.mgmt.web.v2019_08_01.models.Channels - :ivar category_tags: The list of category tags that this recommendation - rule belongs to. + :ivar category_tags: The list of category tags that this recommendation rule belongs to. :vartype category_tags: list[str] - :param is_dynamic: True if this is associated with a dynamically added - rule + :param is_dynamic: True if this is associated with a dynamically added rule. :type is_dynamic: bool - :param extension_name: Extension name of the portal if exists. Applicable - to dynamic rule only. + :param extension_name: Extension name of the portal if exists. Applicable to dynamic rule only. :type extension_name: str - :param blade_name: Deep link to a blade on the portal. Applicable to - dynamic rule only. + :param blade_name: Deep link to a blade on the portal. Applicable to dynamic rule only. :type blade_name: str - :param forward_link: Forward link to an external document associated with - the rule. Applicable to dynamic rule only. + :param forward_link: Forward link to an external document associated with the rule. Applicable + to dynamic rule only. :type forward_link: str """ @@ -8388,8 +10659,8 @@ class RecommendationRule(ProxyOnlyResource): 'recommendation_id': {'key': 'properties.recommendationId', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'action_name': {'key': 'properties.actionName', 'type': 'str'}, - 'level': {'key': 'properties.level', 'type': 'NotificationLevel'}, - 'channels': {'key': 'properties.channels', 'type': 'Channels'}, + 'level': {'key': 'properties.level', 'type': 'str'}, + 'channels': {'key': 'properties.channels', 'type': 'str'}, 'category_tags': {'key': 'properties.categoryTags', 'type': '[str]'}, 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, 'extension_name': {'key': 'properties.extensionName', 'type': 'str'}, @@ -8397,7 +10668,24 @@ class RecommendationRule(ProxyOnlyResource): 'forward_link': {'key': 'properties.forwardLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, recommendation_name: str=None, display_name: str=None, message: str=None, recommendation_id: str=None, description: str=None, action_name: str=None, level=None, channels=None, is_dynamic: bool=None, extension_name: str=None, blade_name: str=None, forward_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + recommendation_name: Optional[str] = None, + display_name: Optional[str] = None, + message: Optional[str] = None, + recommendation_id: Optional[str] = None, + description: Optional[str] = None, + action_name: Optional[str] = None, + level: Optional[Union[str, "NotificationLevel"]] = None, + channels: Optional[Union[str, "Channels"]] = None, + is_dynamic: Optional[bool] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + forward_link: Optional[str] = None, + **kwargs + ): super(RecommendationRule, self).__init__(kind=kind, **kwargs) self.recommendation_name = recommendation_name self.display_name = display_name @@ -8417,8 +10705,7 @@ def __init__(self, *, kind: str=None, recommendation_name: str=None, display_nam class ReissueCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate reissue request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8430,13 +10717,13 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): :vartype type: str :param key_size: Certificate Key Size. :type key_size: int - :param delay_existing_revoke_in_hours: Delay in hours to revoke existing - certificate after the new certificate is issued. + :param delay_existing_revoke_in_hours: Delay in hours to revoke existing certificate after the + new certificate is issued. :type delay_existing_revoke_in_hours: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -8457,7 +10744,16 @@ class ReissueCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, key_size: int=None, delay_existing_revoke_in_hours: int=None, csr: str=None, is_private_key_external: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_size: Optional[int] = None, + delay_existing_revoke_in_hours: Optional[int] = None, + csr: Optional[str] = None, + is_private_key_external: Optional[bool] = None, + **kwargs + ): super(ReissueCertificateOrderRequest, self).__init__(kind=kind, **kwargs) self.key_size = key_size self.delay_existing_revoke_in_hours = delay_existing_revoke_in_hours @@ -8468,8 +10764,7 @@ def __init__(self, *, kind: str=None, key_size: int=None, delay_existing_revoke_ class RelayServiceConnectionEntity(ProxyOnlyResource): """Hybrid Connection for an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8515,7 +10810,19 @@ class RelayServiceConnectionEntity(ProxyOnlyResource): 'biztalk_uri': {'key': 'properties.biztalkUri', 'type': 'str'}, } - def __init__(self, *, kind: str=None, entity_name: str=None, entity_connection_string: str=None, resource_type: str=None, resource_connection_string: str=None, hostname: str=None, port: int=None, biztalk_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + entity_name: Optional[str] = None, + entity_connection_string: Optional[str] = None, + resource_type: Optional[str] = None, + resource_connection_string: Optional[str] = None, + hostname: Optional[str] = None, + port: Optional[int] = None, + biztalk_uri: Optional[str] = None, + **kwargs + ): super(RelayServiceConnectionEntity, self).__init__(kind=kind, **kwargs) self.entity_name = entity_name self.entity_connection_string = entity_connection_string @@ -8526,26 +10833,32 @@ def __init__(self, *, kind: str=None, entity_name: str=None, entity_connection_s self.biztalk_uri = biztalk_uri -class Rendering(Model): +class Rendering(msrest.serialization.Model): """Instructions for rendering the data. - :param type: Rendering Type. Possible values include: 'NoGraph', 'Table', - 'TimeSeries', 'TimeSeriesPerInstance' + :param type: Rendering Type. Possible values include: "NoGraph", "Table", "TimeSeries", + "TimeSeriesPerInstance". :type type: str or ~azure.mgmt.web.v2019_08_01.models.RenderingType - :param title: Title of data + :param title: Title of data. :type title: str - :param description: Description of the data that will help it be - interpreted + :param description: Description of the data that will help it be interpreted. :type description: str """ _attribute_map = { - 'type': {'key': 'type', 'type': 'RenderingType'}, + 'type': {'key': 'type', 'type': 'str'}, 'title': {'key': 'title', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, type=None, title: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "RenderingType"]] = None, + title: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(Rendering, self).__init__(**kwargs) self.type = type self.title = title @@ -8555,8 +10868,7 @@ def __init__(self, *, type=None, title: str=None, description: str=None, **kwarg class RenewCertificateOrderRequest(ProxyOnlyResource): """Class representing certificate renew request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8570,8 +10882,8 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): :type key_size: int :param csr: Csr to be used for re-key operation. :type csr: str - :param is_private_key_external: Should we change the ASC type (from - managed private key to external private key and vice versa). + :param is_private_key_external: Should we change the ASC type (from managed private key to + external private key and vice versa). :type is_private_key_external: bool """ @@ -8591,14 +10903,22 @@ class RenewCertificateOrderRequest(ProxyOnlyResource): 'is_private_key_external': {'key': 'properties.isPrivateKeyExternal', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, key_size: int=None, csr: str=None, is_private_key_external: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + key_size: Optional[int] = None, + csr: Optional[str] = None, + is_private_key_external: Optional[bool] = None, + **kwargs + ): super(RenewCertificateOrderRequest, self).__init__(kind=kind, **kwargs) self.key_size = key_size self.csr = csr self.is_private_key_external = is_private_key_external -class RequestsBasedTrigger(Model): +class RequestsBasedTrigger(msrest.serialization.Model): """Trigger based on total requests. :param count: Request Count. @@ -8612,17 +10932,56 @@ class RequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(RequestsBasedTrigger, self).__init__(**kwargs) self.count = count self.time_interval = time_interval +class ResourceCollection(msrest.serialization.Model): + """Collection of resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[str] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List[str], + **kwargs + ): + super(ResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ResourceHealthMetadata(ProxyOnlyResource): """Used for getting ResourceHealthCheck settings. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8632,10 +10991,9 @@ class ResourceHealthMetadata(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param category: The category that the resource matches in the RHC Policy - File + :param category: The category that the resource matches in the RHC Policy File. :type category: str - :param signal_availability: Is there a health signal for the resource + :param signal_availability: Is there a health signal for the resource. :type signal_availability: bool """ @@ -8654,17 +11012,57 @@ class ResourceHealthMetadata(ProxyOnlyResource): 'signal_availability': {'key': 'properties.signalAvailability', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, category: str=None, signal_availability: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + category: Optional[str] = None, + signal_availability: Optional[bool] = None, + **kwargs + ): super(ResourceHealthMetadata, self).__init__(kind=kind, **kwargs) self.category = category self.signal_availability = signal_availability -class ResourceMetricAvailability(Model): +class ResourceHealthMetadataCollection(msrest.serialization.Model): + """Collection of resource health metadata. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceHealthMetadata]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceHealthMetadata"], + **kwargs + ): + super(ResourceHealthMetadataCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceMetricAvailability(msrest.serialization.Model): """Metrics availability and retention. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar time_grain: Time grain . :vartype time_grain: str @@ -8682,7 +11080,10 @@ class ResourceMetricAvailability(Model): 'retention': {'key': 'retention', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ResourceMetricAvailability, self).__init__(**kwargs) self.time_grain = None self.retention = None @@ -8691,8 +11092,7 @@ def __init__(self, **kwargs) -> None: class ResourceMetricDefinition(ProxyOnlyResource): """Metadata for the metrics. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8706,8 +11106,8 @@ class ResourceMetricDefinition(ProxyOnlyResource): :vartype unit: str :ivar primary_aggregation_type: Primary aggregation type. :vartype primary_aggregation_type: str - :ivar metric_availabilities: List of time grains supported for the metric - together with retention period. + :ivar metric_availabilities: List of time grains supported for the metric together with + retention period. :vartype metric_availabilities: list[~azure.mgmt.web.v2019_08_01.models.ResourceMetricAvailability] :ivar resource_uri: Resource URI. @@ -8739,7 +11139,12 @@ class ResourceMetricDefinition(ProxyOnlyResource): 'properties': {'key': 'properties.properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(ResourceMetricDefinition, self).__init__(kind=kind, **kwargs) self.unit = None self.primary_aggregation_type = None @@ -8748,24 +11153,55 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.properties = None -class ResourceNameAvailability(Model): +class ResourceMetricDefinitionCollection(msrest.serialization.Model): + """Collection of metric definitions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinition] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceMetricDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ResourceMetricDefinition"], + **kwargs + ): + super(ResourceMetricDefinitionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceNameAvailability(msrest.serialization.Model): """Information regarding availability of a resource name. - :param name_available: true indicates name is valid and - available. false indicates the name is invalid, unavailable, - or both. + :param name_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. :type name_available: bool - :param reason: Invalid indicates the name provided does not - match Azure App Service naming requirements. AlreadyExists - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.web.v2019_08_01.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why - the given name is invalid, and provide the resource naming requirements so - that the user can select a valid name. If reason == AlreadyExists, explain - that resource name is already in use, and direct them to select a - different name. + :param reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.web.v2019_08_01.models.InAvailabilityReasonType + :param message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. :type message: str """ @@ -8775,26 +11211,32 @@ class ResourceNameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "InAvailabilityReasonType"]] = None, + message: Optional[str] = None, + **kwargs + ): super(ResourceNameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class ResourceNameAvailabilityRequest(Model): +class ResourceNameAvailabilityRequest(msrest.serialization.Model): """Resource name availability request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes + :param type: Required. Resource type used for verification. Possible values include: "Site", + "Slot", "HostingEnvironment", "PublishingUser", "Microsoft.Web/sites", + "Microsoft.Web/sites/slots", "Microsoft.Web/hostingEnvironments", + "Microsoft.Web/publishingUsers". + :type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool """ @@ -8810,17 +11252,24 @@ class ResourceNameAvailabilityRequest(Model): 'is_fqdn': {'key': 'isFqdn', 'type': 'bool'}, } - def __init__(self, *, name: str, type, is_fqdn: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + type: Union[str, "CheckNameResourceTypes"], + is_fqdn: Optional[bool] = None, + **kwargs + ): super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type self.is_fqdn = is_fqdn -class ResponseMetaData(Model): +class ResponseMetaData(msrest.serialization.Model): """ResponseMetaData. - :param data_source: Source of the Data + :param data_source: Source of the Data. :type data_source: ~azure.mgmt.web.v2019_08_01.models.DataSource """ @@ -8828,7 +11277,12 @@ class ResponseMetaData(Model): 'data_source': {'key': 'dataSource', 'type': 'DataSource'}, } - def __init__(self, *, data_source=None, **kwargs) -> None: + def __init__( + self, + *, + data_source: Optional["DataSource"] = None, + **kwargs + ): super(ResponseMetaData, self).__init__(**kwargs) self.data_source = data_source @@ -8836,10 +11290,7 @@ def __init__(self, *, data_source=None, **kwargs) -> None: class RestoreRequest(ProxyOnlyResource): """Description of a restore request. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -8849,42 +11300,37 @@ class RestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param storage_account_url: Required. SAS URL to the container. + :param storage_account_url: SAS URL to the container. :type storage_account_url: str :param blob_name: Name of a blob which contains the backup. :type blob_name: str - :param overwrite: Required. true if the restore operation can - overwrite target app; otherwise, false. true is - needed if trying to restore over an existing app. + :param overwrite: :code:`true` if the restore operation can overwrite target app; + otherwise, :code:`false`. :code:`true` is needed if trying to restore + over an existing app. :type overwrite: bool :param site_name: Name of an app. :type site_name: str - :param databases: Collection of databases which should be restored. This - list has to match the list of databases included in the backup. - :type databases: - list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] - :param ignore_conflicting_host_names: Changes a logic when restoring an - app with custom domains. true to remove custom domains - automatically. If false, custom domains are added to - the app's object when it is being restored, but that might fail due to - conflicts during the operation. Default value: False . + :param databases: Collection of databases which should be restored. This list has to match the + list of databases included in the backup. + :type databases: list[~azure.mgmt.web.v2019_08_01.models.DatabaseBackupSetting] + :param ignore_conflicting_host_names: Changes a logic when restoring an app with custom + domains. :code:`true` to remove custom domains automatically. If + :code:`false`, custom domains are added to + the app's object when it is being restored, but that might fail due to conflicts during the + operation. :type ignore_conflicting_host_names: bool - :param ignore_databases: Ignore the databases and only restore the site - content. Default value: False . + :param ignore_databases: Ignore the databases and only restore the site content. :type ignore_databases: bool - :param app_service_plan: Specify app service plan that will own restored - site. + :param app_service_plan: Specify app service plan that will own restored site. :type app_service_plan: str - :param operation_type: Operation type. Possible values include: 'Default', - 'Clone', 'Relocation', 'Snapshot', 'CloudFS'. Default value: "Default" . - :type operation_type: str or - ~azure.mgmt.web.v2019_08_01.models.BackupRestoreOperationType - :param adjust_connection_strings: true if - SiteConfig.ConnectionStrings should be set in new app; otherwise, - false. + :param operation_type: Operation type. Possible values include: "Default", "Clone", + "Relocation", "Snapshot", "CloudFS". Default value: "Default". + :type operation_type: str or ~azure.mgmt.web.v2019_08_01.models.BackupRestoreOperationType + :param adjust_connection_strings: :code:`true` if SiteConfig.ConnectionStrings + should be set in new app; otherwise, :code:`false`. :type adjust_connection_strings: bool - :param hosting_environment: App Service Environment name, if needed (only - when restoring an app to an App Service Environment). + :param hosting_environment: App Service Environment name, if needed (only when restoring an app + to an App Service Environment). :type hosting_environment: str """ @@ -8892,8 +11338,6 @@ class RestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'storage_account_url': {'required': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -8909,12 +11353,28 @@ class RestoreRequest(ProxyOnlyResource): 'ignore_conflicting_host_names': {'key': 'properties.ignoreConflictingHostNames', 'type': 'bool'}, 'ignore_databases': {'key': 'properties.ignoreDatabases', 'type': 'bool'}, 'app_service_plan': {'key': 'properties.appServicePlan', 'type': 'str'}, - 'operation_type': {'key': 'properties.operationType', 'type': 'BackupRestoreOperationType'}, + 'operation_type': {'key': 'properties.operationType', 'type': 'str'}, 'adjust_connection_strings': {'key': 'properties.adjustConnectionStrings', 'type': 'bool'}, 'hosting_environment': {'key': 'properties.hostingEnvironment', 'type': 'str'}, } - def __init__(self, *, storage_account_url: str, overwrite: bool, kind: str=None, blob_name: str=None, site_name: str=None, databases=None, ignore_conflicting_host_names: bool=False, ignore_databases: bool=False, app_service_plan: str=None, operation_type="Default", adjust_connection_strings: bool=None, hosting_environment: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + storage_account_url: Optional[str] = None, + blob_name: Optional[str] = None, + overwrite: Optional[bool] = None, + site_name: Optional[str] = None, + databases: Optional[List["DatabaseBackupSetting"]] = None, + ignore_conflicting_host_names: Optional[bool] = False, + ignore_databases: Optional[bool] = False, + app_service_plan: Optional[str] = None, + operation_type: Optional[Union[str, "BackupRestoreOperationType"]] = "Default", + adjust_connection_strings: Optional[bool] = None, + hosting_environment: Optional[str] = None, + **kwargs + ): super(RestoreRequest, self).__init__(kind=kind, **kwargs) self.storage_account_url = storage_account_url self.blob_name = blob_name @@ -8929,15 +11389,13 @@ def __init__(self, *, storage_account_url: str, overwrite: bool, kind: str=None, self.hosting_environment = hosting_environment -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """Resource metrics service provided by Microsoft.Insights resource provider. :param metric_specifications: - :type metric_specifications: - list[~azure.mgmt.web.v2019_08_01.models.MetricSpecification] + :type metric_specifications: list[~azure.mgmt.web.v2019_08_01.models.MetricSpecification] :param log_specifications: - :type log_specifications: - list[~azure.mgmt.web.v2019_08_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.web.v2019_08_01.models.LogSpecification] """ _attribute_map = { @@ -8945,7 +11403,13 @@ class ServiceSpecification(Model): 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, *, metric_specifications=None, log_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -8954,8 +11418,7 @@ def __init__(self, *, metric_specifications=None, log_specifications=None, **kwa class Site(Resource): """A web app, a mobile app backend, or an API app. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -8969,127 +11432,109 @@ class Site(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2019_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants except dataComponent. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants except dataComponent. Read- + only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2019_08_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2019_08_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2019_08_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param identity: - :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity """ _validation = { @@ -9124,13 +11569,14 @@ class Site(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -9158,13 +11604,39 @@ class Site(Resource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, client_cert_exclusion_paths: str=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, https_only: bool=None, redundancy_mode=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + client_cert_exclusion_paths: Optional[str] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + https_only: Optional[bool] = None, + redundancy_mode: Optional[Union[str, "RedundancyMode"]] = None, + **kwargs + ): super(Site, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -9201,15 +11673,12 @@ def __init__(self, *, location: str, kind: str=None, tags=None, enabled: bool=No self.https_only = https_only self.redundancy_mode = redundancy_mode self.in_progress_operation_id = None - self.identity = identity class SiteAuthSettings(ProxyOnlyResource): - """Configuration settings for the Azure App Service Authentication / - Authorization feature. + """Configuration settings for the Azure App Service Authentication / Authorization feature. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9219,152 +11688,128 @@ class SiteAuthSettings(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param enabled: true if the Authentication / Authorization - feature is enabled for the current app; otherwise, false. + :param enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. :type enabled: bool - :param runtime_version: The RuntimeVersion of the Authentication / - Authorization feature in use for the current app. - The setting in this value can control the behavior of certain features in - the Authentication / Authorization module. + :param runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. :type runtime_version: str - :param unauthenticated_client_action: The action to take when an - unauthenticated client attempts to access the app. Possible values - include: 'RedirectToLoginPage', 'AllowAnonymous' + :param unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous". :type unauthenticated_client_action: str or ~azure.mgmt.web.v2019_08_01.models.UnauthenticatedClientAction - :param token_store_enabled: true to durably store - platform-specific security tokens that are obtained during login flows; - otherwise, false. - The default is false. + :param token_store_enabled: :code:`true` to durably store platform-specific + security tokens that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. :type token_store_enabled: bool - :param allowed_external_redirect_urls: External URLs that can be - redirected to as part of logging in or logging out of the app. Note that - the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store - application backends. + :param allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. :type allowed_external_redirect_urls: list[str] - :param default_provider: The default authentication provider to use when - multiple providers are configured. - This setting is only needed if multiple providers are configured and the - unauthenticated client - action is set to "RedirectToLoginPage". Possible values include: - 'AzureActiveDirectory', 'Facebook', 'Google', 'MicrosoftAccount', - 'Twitter' - :type default_provider: str or - ~azure.mgmt.web.v2019_08_01.models.BuiltInAuthenticationProvider - :param token_refresh_extension_hours: The number of hours after session - token expiration that a session token can be used to + :param default_provider: The default authentication provider to use when multiple providers are + configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". Possible values include: "AzureActiveDirectory", + "Facebook", "Google", "MicrosoftAccount", "Twitter". + :type default_provider: str or ~azure.mgmt.web.v2019_08_01.models.BuiltInAuthenticationProvider + :param token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to call the token refresh API. The default is 72 hours. :type token_refresh_extension_hours: float - :param client_id: The Client ID of this relying party application, known - as the client_id. - This setting is required for enabling OpenID Connection authentication - with Azure Active Directory or + :param client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or other 3rd party OpenID Connect providers. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_id: str - :param client_secret: The Client Secret of this relying party application - (in Azure Active Directory, this is also referred to as the Key). - This setting is optional. If no client secret is configured, the OpenID - Connect implicit auth flow is used to authenticate end users. - Otherwise, the OpenID Connect Authorization Code Flow is used to - authenticate end users. - More information on OpenID Connect: - http://openid.net/specs/openid-connect-core-1_0.html + :param client_secret: The Client Secret of this relying party application (in Azure Active + Directory, this is also referred to as the Key). + This setting is optional. If no client secret is configured, the OpenID Connect implicit auth + flow is used to authenticate end users. + Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. :type client_secret: str - :param client_secret_certificate_thumbprint: An alternative to the client - secret, that is the thumbprint of a certificate used for signing purposes. - This property acts as + :param client_secret_certificate_thumbprint: An alternative to the client secret, that is the + thumbprint of a certificate used for signing purposes. This property acts as a replacement for the Client Secret. It is also optional. :type client_secret_certificate_thumbprint: str - :param issuer: The OpenID Connect Issuer URI that represents the entity - which issues access tokens for this application. - When using Azure Active Directory, this value is the URI of the directory - tenant, e.g. https://sts.windows.net/{tenant-guid}/. + :param issuer: The OpenID Connect Issuer URI that represents the entity which issues access + tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://sts.windows.net/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. - More information on OpenID Connect Discovery: - http://openid.net/specs/openid-connect-discovery-1_0.html + More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect- + discovery-1_0.html. :type issuer: str - :param validate_issuer: Gets a value indicating whether the issuer should - be a valid HTTPS url and be validated as such. + :param validate_issuer: Gets a value indicating whether the issuer should be a valid HTTPS url + and be validated as such. :type validate_issuer: bool - :param allowed_audiences: Allowed audience values to consider when - validating JWTs issued by - Azure Active Directory. Note that the ClientID value is - always considered an + :param allowed_audiences: Allowed audience values to consider when validating JWTs issued by + Azure Active Directory. Note that the :code:`ClientID` value is always considered + an allowed audience, regardless of this setting. :type allowed_audiences: list[str] - :param additional_login_params: Login parameters to send to the OpenID - Connect authorization endpoint when + :param additional_login_params: Login parameters to send to the OpenID Connect authorization + endpoint when a user logs in. Each parameter must be in the form "key=value". :type additional_login_params: list[str] - :param google_client_id: The OpenID Connect Client ID for the Google web - application. + :param google_client_id: The OpenID Connect Client ID for the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_id: str - :param google_client_secret: The client secret associated with the Google - web application. + :param google_client_secret: The client secret associated with the Google web application. This setting is required for enabling Google Sign-In. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. :type google_client_secret: str - :param google_oauth_scopes: The OAuth 2.0 scopes that will be requested as - part of Google Sign-In authentication. - This setting is optional. If not specified, "openid", "profile", and - "email" are used as default scopes. - Google Sign-In documentation: - https://developers.google.com/identity/sign-in/web/ - :type google_oauth_scopes: list[str] + :param google_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Google + Sign-In authentication. + This setting is optional. If not specified, "openid", "profile", and "email" are used as + default scopes. + Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/. + :type google_o_auth_scopes: list[str] :param facebook_app_id: The App ID of the Facebook app used for login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_id: str - :param facebook_app_secret: The App Secret of the Facebook app used for - Facebook Login. + :param facebook_app_secret: The App Secret of the Facebook app used for Facebook Login. This setting is required for enabling Facebook Login. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. :type facebook_app_secret: str - :param facebook_oauth_scopes: The OAuth 2.0 scopes that will be requested - as part of Facebook Login authentication. + :param facebook_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of Facebook + Login authentication. This setting is optional. - Facebook Login documentation: - https://developers.facebook.com/docs/facebook-login - :type facebook_oauth_scopes: list[str] - :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter - application used for sign-in. + Facebook Login documentation: https://developers.facebook.com/docs/facebook-login. + :type facebook_o_auth_scopes: list[str] + :param twitter_consumer_key: The OAuth 1.0a consumer key of the Twitter application used for + sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_key: str - :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the - Twitter application used for sign-in. + :param twitter_consumer_secret: The OAuth 1.0a consumer secret of the Twitter application used + for sign-in. This setting is required for enabling Twitter Sign-In. - Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. :type twitter_consumer_secret: str - :param microsoft_account_client_id: The OAuth 2.0 client ID that was - created for the app used for authentication. + :param microsoft_account_client_id: The OAuth 2.0 client ID that was created for the app used + for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_id: str - :param microsoft_account_client_secret: The OAuth 2.0 client secret that - was created for the app used for authentication. + :param microsoft_account_client_secret: The OAuth 2.0 client secret that was created for the + app used for authentication. This setting is required for enabling Microsoft Account authentication. - Microsoft Account OAuth documentation: - https://dev.onedrive.com/auth/msa_oauth.htm + Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm. :type microsoft_account_client_secret: str - :param microsoft_account_oauth_scopes: The OAuth 2.0 scopes that will be - requested as part of Microsoft Account authentication. - This setting is optional. If not specified, "wl.basic" is used as the - default scope. - Microsoft Account Scopes and permissions documentation: - https://msdn.microsoft.com/en-us/library/dn631845.aspx - :type microsoft_account_oauth_scopes: list[str] + :param microsoft_account_o_auth_scopes: The OAuth 2.0 scopes that will be requested as part of + Microsoft Account authentication. + This setting is optional. If not specified, "wl.basic" is used as the default scope. + Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en- + us/library/dn631845.aspx. + :type microsoft_account_o_auth_scopes: list[str] """ _validation = { @@ -9380,10 +11825,10 @@ class SiteAuthSettings(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, - 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'UnauthenticatedClientAction'}, + 'unauthenticated_client_action': {'key': 'properties.unauthenticatedClientAction', 'type': 'str'}, 'token_store_enabled': {'key': 'properties.tokenStoreEnabled', 'type': 'bool'}, 'allowed_external_redirect_urls': {'key': 'properties.allowedExternalRedirectUrls', 'type': '[str]'}, - 'default_provider': {'key': 'properties.defaultProvider', 'type': 'BuiltInAuthenticationProvider'}, + 'default_provider': {'key': 'properties.defaultProvider', 'type': 'str'}, 'token_refresh_extension_hours': {'key': 'properties.tokenRefreshExtensionHours', 'type': 'float'}, 'client_id': {'key': 'properties.clientId', 'type': 'str'}, 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, @@ -9394,18 +11839,48 @@ class SiteAuthSettings(ProxyOnlyResource): 'additional_login_params': {'key': 'properties.additionalLoginParams', 'type': '[str]'}, 'google_client_id': {'key': 'properties.googleClientId', 'type': 'str'}, 'google_client_secret': {'key': 'properties.googleClientSecret', 'type': 'str'}, - 'google_oauth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, + 'google_o_auth_scopes': {'key': 'properties.googleOAuthScopes', 'type': '[str]'}, 'facebook_app_id': {'key': 'properties.facebookAppId', 'type': 'str'}, 'facebook_app_secret': {'key': 'properties.facebookAppSecret', 'type': 'str'}, - 'facebook_oauth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, + 'facebook_o_auth_scopes': {'key': 'properties.facebookOAuthScopes', 'type': '[str]'}, 'twitter_consumer_key': {'key': 'properties.twitterConsumerKey', 'type': 'str'}, 'twitter_consumer_secret': {'key': 'properties.twitterConsumerSecret', 'type': 'str'}, 'microsoft_account_client_id': {'key': 'properties.microsoftAccountClientId', 'type': 'str'}, 'microsoft_account_client_secret': {'key': 'properties.microsoftAccountClientSecret', 'type': 'str'}, - 'microsoft_account_oauth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, - } - - def __init__(self, *, kind: str=None, enabled: bool=None, runtime_version: str=None, unauthenticated_client_action=None, token_store_enabled: bool=None, allowed_external_redirect_urls=None, default_provider=None, token_refresh_extension_hours: float=None, client_id: str=None, client_secret: str=None, client_secret_certificate_thumbprint: str=None, issuer: str=None, validate_issuer: bool=None, allowed_audiences=None, additional_login_params=None, google_client_id: str=None, google_client_secret: str=None, google_oauth_scopes=None, facebook_app_id: str=None, facebook_app_secret: str=None, facebook_oauth_scopes=None, twitter_consumer_key: str=None, twitter_consumer_secret: str=None, microsoft_account_client_id: str=None, microsoft_account_client_secret: str=None, microsoft_account_oauth_scopes=None, **kwargs) -> None: + 'microsoft_account_o_auth_scopes': {'key': 'properties.microsoftAccountOAuthScopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + enabled: Optional[bool] = None, + runtime_version: Optional[str] = None, + unauthenticated_client_action: Optional[Union[str, "UnauthenticatedClientAction"]] = None, + token_store_enabled: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + default_provider: Optional[Union[str, "BuiltInAuthenticationProvider"]] = None, + token_refresh_extension_hours: Optional[float] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + client_secret_certificate_thumbprint: Optional[str] = None, + issuer: Optional[str] = None, + validate_issuer: Optional[bool] = None, + allowed_audiences: Optional[List[str]] = None, + additional_login_params: Optional[List[str]] = None, + google_client_id: Optional[str] = None, + google_client_secret: Optional[str] = None, + google_o_auth_scopes: Optional[List[str]] = None, + facebook_app_id: Optional[str] = None, + facebook_app_secret: Optional[str] = None, + facebook_o_auth_scopes: Optional[List[str]] = None, + twitter_consumer_key: Optional[str] = None, + twitter_consumer_secret: Optional[str] = None, + microsoft_account_client_id: Optional[str] = None, + microsoft_account_client_secret: Optional[str] = None, + microsoft_account_o_auth_scopes: Optional[List[str]] = None, + **kwargs + ): super(SiteAuthSettings, self).__init__(kind=kind, **kwargs) self.enabled = enabled self.runtime_version = runtime_version @@ -9423,46 +11898,50 @@ def __init__(self, *, kind: str=None, enabled: bool=None, runtime_version: str=N self.additional_login_params = additional_login_params self.google_client_id = google_client_id self.google_client_secret = google_client_secret - self.google_oauth_scopes = google_oauth_scopes + self.google_o_auth_scopes = google_o_auth_scopes self.facebook_app_id = facebook_app_id self.facebook_app_secret = facebook_app_secret - self.facebook_oauth_scopes = facebook_oauth_scopes + self.facebook_o_auth_scopes = facebook_o_auth_scopes self.twitter_consumer_key = twitter_consumer_key self.twitter_consumer_secret = twitter_consumer_secret self.microsoft_account_client_id = microsoft_account_client_id self.microsoft_account_client_secret = microsoft_account_client_secret - self.microsoft_account_oauth_scopes = microsoft_account_oauth_scopes + self.microsoft_account_o_auth_scopes = microsoft_account_o_auth_scopes -class SiteCloneability(Model): +class SiteCloneability(msrest.serialization.Model): """Represents whether or not an app is cloneable. - :param result: Name of app. Possible values include: 'Cloneable', - 'PartiallyCloneable', 'NotCloneable' + :param result: Name of app. Possible values include: "Cloneable", "PartiallyCloneable", + "NotCloneable". :type result: str or ~azure.mgmt.web.v2019_08_01.models.CloneAbilityResult - :param blocking_features: List of features enabled on app that prevent - cloning. - :type blocking_features: - list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] - :param unsupported_features: List of features enabled on app that are - non-blocking but cannot be cloned. The app can still be cloned + :param blocking_features: List of features enabled on app that prevent cloning. + :type blocking_features: list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] + :param unsupported_features: List of features enabled on app that are non-blocking but cannot + be cloned. The app can still be cloned but the features in this list will not be set up on cloned app. - :type unsupported_features: - list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] - :param blocking_characteristics: List of blocking application - characteristics. + :type unsupported_features: list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] + :param blocking_characteristics: List of blocking application characteristics. :type blocking_characteristics: list[~azure.mgmt.web.v2019_08_01.models.SiteCloneabilityCriterion] """ _attribute_map = { - 'result': {'key': 'result', 'type': 'CloneAbilityResult'}, + 'result': {'key': 'result', 'type': 'str'}, 'blocking_features': {'key': 'blockingFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'unsupported_features': {'key': 'unsupportedFeatures', 'type': '[SiteCloneabilityCriterion]'}, 'blocking_characteristics': {'key': 'blockingCharacteristics', 'type': '[SiteCloneabilityCriterion]'}, } - def __init__(self, *, result=None, blocking_features=None, unsupported_features=None, blocking_characteristics=None, **kwargs) -> None: + def __init__( + self, + *, + result: Optional[Union[str, "CloneAbilityResult"]] = None, + blocking_features: Optional[List["SiteCloneabilityCriterion"]] = None, + unsupported_features: Optional[List["SiteCloneabilityCriterion"]] = None, + blocking_characteristics: Optional[List["SiteCloneabilityCriterion"]] = None, + **kwargs + ): super(SiteCloneability, self).__init__(**kwargs) self.result = result self.blocking_features = blocking_features @@ -9470,7 +11949,7 @@ def __init__(self, *, result=None, blocking_features=None, unsupported_features= self.blocking_characteristics = blocking_characteristics -class SiteCloneabilityCriterion(Model): +class SiteCloneabilityCriterion(msrest.serialization.Model): """An app cloneability criterion. :param name: Name of criterion. @@ -9484,24 +11963,28 @@ class SiteCloneabilityCriterion(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(SiteCloneabilityCriterion, self).__init__(**kwargs) self.name = name self.description = description -class SiteConfig(Model): +class SiteConfig(msrest.serialization.Model): """Configuration of an App Service app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param number_of_workers: Number of workers. :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9511,54 +11994,57 @@ class SiteConfig(Model): :type node_version: str :param power_shell_version: Version of PowerShell. :type power_shell_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool + :param acr_use_managed_identity_creds: Flag to use Managed Identity Creds for ACR pull. + :type acr_use_managed_identity_creds: bool + :param acr_user_managed_identity_id: If using user managed identity, the user managed identity + ClientId. + :type acr_user_managed_identity_id: str :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2019_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO', 'VSTSRM' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO", "VSTSRM". :type scm_type: str or ~azure.mgmt.web.v2019_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9568,24 +12054,20 @@ class SiteConfig(Model): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2019_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2019_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2019_08_01.models.AutoHealRules @@ -9597,46 +12079,39 @@ class SiteConfig(Model): :type cors: ~azure.mgmt.web.v2019_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2019_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2019_08_01.models.ApiDefinitionInfo - :param api_management_config: Azure API management settings linked to the - app. - :type api_management_config: - ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig + :param api_management_config: Azure API management settings linked to the app. + :type api_management_config: ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2019_08_01.models.FtpsState :param pre_warmed_instance_count: Number of preWarmed instances. - This setting only applies to the Consumption and Elastic Plans + This setting only applies to the Consumption and Elastic Plans. :type pre_warmed_instance_count: int - :param health_check_path: Health check path + :param health_check_path: Health check path. :type health_check_path: str """ @@ -9660,6 +12135,8 @@ class SiteConfig(Model): 'remote_debugging_enabled': {'key': 'remoteDebuggingEnabled', 'type': 'bool'}, 'remote_debugging_version': {'key': 'remoteDebuggingVersion', 'type': 'str'}, 'http_logging_enabled': {'key': 'httpLoggingEnabled', 'type': 'bool'}, + 'acr_use_managed_identity_creds': {'key': 'acrUseManagedIdentityCreds', 'type': 'bool'}, + 'acr_user_managed_identity_id': {'key': 'acrUserManagedIdentityID', 'type': 'str'}, 'logs_directory_size_limit': {'key': 'logsDirectorySizeLimit', 'type': 'int'}, 'detailed_error_logging_enabled': {'key': 'detailedErrorLoggingEnabled', 'type': 'bool'}, 'publishing_username': {'key': 'publishingUsername', 'type': 'str'}, @@ -9676,9 +12153,9 @@ class SiteConfig(Model): 'java_container': {'key': 'javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'loadBalancing', 'type': 'str'}, 'experiments': {'key': 'experiments', 'type': 'Experiments'}, 'limits': {'key': 'limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'autoHealEnabled', 'type': 'bool'}, @@ -9703,7 +12180,67 @@ class SiteConfig(Model): 'health_check_path': {'key': 'healthCheckPath', 'type': 'str'}, } - def __init__(self, *, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, power_shell_version: str=None, linux_fx_version: str=None, windows_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, api_management_config=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, managed_service_identity_id: int=None, x_managed_service_identity_id: int=None, ip_security_restrictions=None, scm_ip_security_restrictions=None, scm_ip_security_restrictions_use_main: bool=None, http20_enabled: bool=True, min_tls_version=None, ftps_state=None, pre_warmed_instance_count: int=None, health_check_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + power_shell_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + windows_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + acr_use_managed_identity_creds: Optional[bool] = None, + acr_user_managed_identity_id: Optional[str] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + api_management_config: Optional["ApiManagementConfig"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + managed_service_identity_id: Optional[int] = None, + x_managed_service_identity_id: Optional[int] = None, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions_use_main: Optional[bool] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + ftps_state: Optional[Union[str, "FtpsState"]] = None, + pre_warmed_instance_count: Optional[int] = None, + health_check_path: Optional[str] = None, + **kwargs + ): super(SiteConfig, self).__init__(**kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -9719,6 +12256,8 @@ def __init__(self, *, number_of_workers: int=None, default_documents=None, net_f self.remote_debugging_enabled = remote_debugging_enabled self.remote_debugging_version = remote_debugging_version self.http_logging_enabled = http_logging_enabled + self.acr_use_managed_identity_creds = acr_use_managed_identity_creds + self.acr_user_managed_identity_id = acr_user_managed_identity_id self.logs_directory_size_limit = logs_directory_size_limit self.detailed_error_logging_enabled = detailed_error_logging_enabled self.publishing_username = publishing_username @@ -9765,8 +12304,7 @@ def __init__(self, *, number_of_workers: int=None, default_documents=None, net_f class SiteConfigResource(ProxyOnlyResource): """Web app configuration ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -9780,8 +12318,7 @@ class SiteConfigResource(ProxyOnlyResource): :type number_of_workers: int :param default_documents: Default documents. :type default_documents: list[str] - :param net_framework_version: .NET Framework version. Default value: - "v4.6" . + :param net_framework_version: .NET Framework version. :type net_framework_version: str :param php_version: Version of PHP. :type php_version: str @@ -9791,54 +12328,57 @@ class SiteConfigResource(ProxyOnlyResource): :type node_version: str :param power_shell_version: Version of PowerShell. :type power_shell_version: str - :param linux_fx_version: Linux App Framework and version + :param linux_fx_version: Linux App Framework and version. :type linux_fx_version: str - :param windows_fx_version: Xenon App Framework and version + :param windows_fx_version: Xenon App Framework and version. :type windows_fx_version: str - :param request_tracing_enabled: true if request tracing is - enabled; otherwise, false. + :param request_tracing_enabled: :code:`true` if request tracing is enabled; + otherwise, :code:`false`. :type request_tracing_enabled: bool :param request_tracing_expiration_time: Request tracing expiration time. - :type request_tracing_expiration_time: datetime - :param remote_debugging_enabled: true if remote debugging is - enabled; otherwise, false. + :type request_tracing_expiration_time: ~datetime.datetime + :param remote_debugging_enabled: :code:`true` if remote debugging is enabled; + otherwise, :code:`false`. :type remote_debugging_enabled: bool :param remote_debugging_version: Remote debugging version. :type remote_debugging_version: str - :param http_logging_enabled: true if HTTP logging is enabled; - otherwise, false. + :param http_logging_enabled: :code:`true` if HTTP logging is enabled; otherwise, + :code:`false`. :type http_logging_enabled: bool + :param acr_use_managed_identity_creds: Flag to use Managed Identity Creds for ACR pull. + :type acr_use_managed_identity_creds: bool + :param acr_user_managed_identity_id: If using user managed identity, the user managed identity + ClientId. + :type acr_user_managed_identity_id: str :param logs_directory_size_limit: HTTP logs directory size limit. :type logs_directory_size_limit: int - :param detailed_error_logging_enabled: true if detailed error - logging is enabled; otherwise, false. + :param detailed_error_logging_enabled: :code:`true` if detailed error logging is + enabled; otherwise, :code:`false`. :type detailed_error_logging_enabled: bool :param publishing_username: Publishing user name. :type publishing_username: str :param app_settings: Application settings. :type app_settings: list[~azure.mgmt.web.v2019_08_01.models.NameValuePair] :param connection_strings: Connection strings. - :type connection_strings: - list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] + :type connection_strings: list[~azure.mgmt.web.v2019_08_01.models.ConnStringInfo] :ivar machine_key: Site MachineKey. :vartype machine_key: ~azure.mgmt.web.v2019_08_01.models.SiteMachineKey :param handler_mappings: Handler mappings. - :type handler_mappings: - list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] + :type handler_mappings: list[~azure.mgmt.web.v2019_08_01.models.HandlerMapping] :param document_root: Document root. :type document_root: str - :param scm_type: SCM type. Possible values include: 'None', 'Dropbox', - 'Tfs', 'LocalGit', 'GitHub', 'CodePlexGit', 'CodePlexHg', 'BitbucketGit', - 'BitbucketHg', 'ExternalGit', 'ExternalHg', 'OneDrive', 'VSO', 'VSTSRM' + :param scm_type: SCM type. Possible values include: "None", "Dropbox", "Tfs", "LocalGit", + "GitHub", "CodePlexGit", "CodePlexHg", "BitbucketGit", "BitbucketHg", "ExternalGit", + "ExternalHg", "OneDrive", "VSO", "VSTSRM". :type scm_type: str or ~azure.mgmt.web.v2019_08_01.models.ScmType - :param use32_bit_worker_process: true to use 32-bit worker - process; otherwise, false. + :param use32_bit_worker_process: :code:`true` to use 32-bit worker process; + otherwise, :code:`false`. :type use32_bit_worker_process: bool - :param web_sockets_enabled: true if WebSocket is enabled; - otherwise, false. + :param web_sockets_enabled: :code:`true` if WebSocket is enabled; otherwise, + :code:`false`. :type web_sockets_enabled: bool - :param always_on: true if Always On is enabled; otherwise, - false. + :param always_on: :code:`true` if Always On is enabled; otherwise, + :code:`false`. :type always_on: bool :param java_version: Java version. :type java_version: str @@ -9848,24 +12388,20 @@ class SiteConfigResource(ProxyOnlyResource): :type java_container_version: str :param app_command_line: App command line to launch. :type app_command_line: str - :param managed_pipeline_mode: Managed pipeline mode. Possible values - include: 'Integrated', 'Classic' - :type managed_pipeline_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode + :param managed_pipeline_mode: Managed pipeline mode. Possible values include: "Integrated", + "Classic". + :type managed_pipeline_mode: str or ~azure.mgmt.web.v2019_08_01.models.ManagedPipelineMode :param virtual_applications: Virtual applications. - :type virtual_applications: - list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] - :param load_balancing: Site load balancing. Possible values include: - 'WeightedRoundRobin', 'LeastRequests', 'LeastResponseTime', - 'WeightedTotalTraffic', 'RequestHash' - :type load_balancing: str or - ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing + :type virtual_applications: list[~azure.mgmt.web.v2019_08_01.models.VirtualApplication] + :param load_balancing: Site load balancing. Possible values include: "WeightedRoundRobin", + "LeastRequests", "LeastResponseTime", "WeightedTotalTraffic", "RequestHash". + :type load_balancing: str or ~azure.mgmt.web.v2019_08_01.models.SiteLoadBalancing :param experiments: This is work around for polymorphic types. :type experiments: ~azure.mgmt.web.v2019_08_01.models.Experiments :param limits: Site limits. :type limits: ~azure.mgmt.web.v2019_08_01.models.SiteLimits - :param auto_heal_enabled: true if Auto Heal is enabled; - otherwise, false. + :param auto_heal_enabled: :code:`true` if Auto Heal is enabled; otherwise, + :code:`false`. :type auto_heal_enabled: bool :param auto_heal_rules: Auto Heal rules. :type auto_heal_rules: ~azure.mgmt.web.v2019_08_01.models.AutoHealRules @@ -9877,46 +12413,39 @@ class SiteConfigResource(ProxyOnlyResource): :type cors: ~azure.mgmt.web.v2019_08_01.models.CorsSettings :param push: Push endpoint settings. :type push: ~azure.mgmt.web.v2019_08_01.models.PushSettings - :param api_definition: Information about the formal API definition for the - app. + :param api_definition: Information about the formal API definition for the app. :type api_definition: ~azure.mgmt.web.v2019_08_01.models.ApiDefinitionInfo - :param api_management_config: Azure API management settings linked to the - app. - :type api_management_config: - ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig + :param api_management_config: Azure API management settings linked to the app. + :type api_management_config: ~azure.mgmt.web.v2019_08_01.models.ApiManagementConfig :param auto_swap_slot_name: Auto-swap slot name. :type auto_swap_slot_name: str - :param local_my_sql_enabled: true to enable local MySQL; - otherwise, false. Default value: False . + :param local_my_sql_enabled: :code:`true` to enable local MySQL; otherwise, + :code:`false`. :type local_my_sql_enabled: bool - :param managed_service_identity_id: Managed Service Identity Id + :param managed_service_identity_id: Managed Service Identity Id. :type managed_service_identity_id: int - :param x_managed_service_identity_id: Explicit Managed Service Identity Id + :param x_managed_service_identity_id: Explicit Managed Service Identity Id. :type x_managed_service_identity_id: int :param ip_security_restrictions: IP security restrictions for main. - :type ip_security_restrictions: - list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] + :type ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] :param scm_ip_security_restrictions: IP security restrictions for scm. :type scm_ip_security_restrictions: list[~azure.mgmt.web.v2019_08_01.models.IpSecurityRestriction] - :param scm_ip_security_restrictions_use_main: IP security restrictions for - scm to use main. + :param scm_ip_security_restrictions_use_main: IP security restrictions for scm to use main. :type scm_ip_security_restrictions_use_main: bool - :param http20_enabled: Http20Enabled: configures a web site to allow - clients to connect over http2.0. Default value: True . + :param http20_enabled: Http20Enabled: configures a web site to allow clients to connect over + http2.0. :type http20_enabled: bool - :param min_tls_version: MinTlsVersion: configures the minimum version of - TLS required for SSL requests. Possible values include: '1.0', '1.1', - '1.2' - :type min_tls_version: str or - ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions - :param ftps_state: State of FTP / FTPS service. Possible values include: - 'AllAllowed', 'FtpsOnly', 'Disabled' + :param min_tls_version: MinTlsVersion: configures the minimum version of TLS required for SSL + requests. Possible values include: "1.0", "1.1", "1.2". + :type min_tls_version: str or ~azure.mgmt.web.v2019_08_01.models.SupportedTlsVersions + :param ftps_state: State of FTP / FTPS service. Possible values include: "AllAllowed", + "FtpsOnly", "Disabled". :type ftps_state: str or ~azure.mgmt.web.v2019_08_01.models.FtpsState :param pre_warmed_instance_count: Number of preWarmed instances. - This setting only applies to the Consumption and Elastic Plans + This setting only applies to the Consumption and Elastic Plans. :type pre_warmed_instance_count: int - :param health_check_path: Health check path + :param health_check_path: Health check path. :type health_check_path: str """ @@ -9947,6 +12476,8 @@ class SiteConfigResource(ProxyOnlyResource): 'remote_debugging_enabled': {'key': 'properties.remoteDebuggingEnabled', 'type': 'bool'}, 'remote_debugging_version': {'key': 'properties.remoteDebuggingVersion', 'type': 'str'}, 'http_logging_enabled': {'key': 'properties.httpLoggingEnabled', 'type': 'bool'}, + 'acr_use_managed_identity_creds': {'key': 'properties.acrUseManagedIdentityCreds', 'type': 'bool'}, + 'acr_user_managed_identity_id': {'key': 'properties.acrUserManagedIdentityID', 'type': 'str'}, 'logs_directory_size_limit': {'key': 'properties.logsDirectorySizeLimit', 'type': 'int'}, 'detailed_error_logging_enabled': {'key': 'properties.detailedErrorLoggingEnabled', 'type': 'bool'}, 'publishing_username': {'key': 'properties.publishingUsername', 'type': 'str'}, @@ -9963,9 +12494,9 @@ class SiteConfigResource(ProxyOnlyResource): 'java_container': {'key': 'properties.javaContainer', 'type': 'str'}, 'java_container_version': {'key': 'properties.javaContainerVersion', 'type': 'str'}, 'app_command_line': {'key': 'properties.appCommandLine', 'type': 'str'}, - 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'ManagedPipelineMode'}, + 'managed_pipeline_mode': {'key': 'properties.managedPipelineMode', 'type': 'str'}, 'virtual_applications': {'key': 'properties.virtualApplications', 'type': '[VirtualApplication]'}, - 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'SiteLoadBalancing'}, + 'load_balancing': {'key': 'properties.loadBalancing', 'type': 'str'}, 'experiments': {'key': 'properties.experiments', 'type': 'Experiments'}, 'limits': {'key': 'properties.limits', 'type': 'SiteLimits'}, 'auto_heal_enabled': {'key': 'properties.autoHealEnabled', 'type': 'bool'}, @@ -9990,7 +12521,68 @@ class SiteConfigResource(ProxyOnlyResource): 'health_check_path': {'key': 'properties.healthCheckPath', 'type': 'str'}, } - def __init__(self, *, kind: str=None, number_of_workers: int=None, default_documents=None, net_framework_version: str="v4.6", php_version: str=None, python_version: str=None, node_version: str=None, power_shell_version: str=None, linux_fx_version: str=None, windows_fx_version: str=None, request_tracing_enabled: bool=None, request_tracing_expiration_time=None, remote_debugging_enabled: bool=None, remote_debugging_version: str=None, http_logging_enabled: bool=None, logs_directory_size_limit: int=None, detailed_error_logging_enabled: bool=None, publishing_username: str=None, app_settings=None, connection_strings=None, handler_mappings=None, document_root: str=None, scm_type=None, use32_bit_worker_process: bool=None, web_sockets_enabled: bool=None, always_on: bool=None, java_version: str=None, java_container: str=None, java_container_version: str=None, app_command_line: str=None, managed_pipeline_mode=None, virtual_applications=None, load_balancing=None, experiments=None, limits=None, auto_heal_enabled: bool=None, auto_heal_rules=None, tracing_options: str=None, vnet_name: str=None, cors=None, push=None, api_definition=None, api_management_config=None, auto_swap_slot_name: str=None, local_my_sql_enabled: bool=False, managed_service_identity_id: int=None, x_managed_service_identity_id: int=None, ip_security_restrictions=None, scm_ip_security_restrictions=None, scm_ip_security_restrictions_use_main: bool=None, http20_enabled: bool=True, min_tls_version=None, ftps_state=None, pre_warmed_instance_count: int=None, health_check_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + number_of_workers: Optional[int] = None, + default_documents: Optional[List[str]] = None, + net_framework_version: Optional[str] = "v4.6", + php_version: Optional[str] = None, + python_version: Optional[str] = None, + node_version: Optional[str] = None, + power_shell_version: Optional[str] = None, + linux_fx_version: Optional[str] = None, + windows_fx_version: Optional[str] = None, + request_tracing_enabled: Optional[bool] = None, + request_tracing_expiration_time: Optional[datetime.datetime] = None, + remote_debugging_enabled: Optional[bool] = None, + remote_debugging_version: Optional[str] = None, + http_logging_enabled: Optional[bool] = None, + acr_use_managed_identity_creds: Optional[bool] = None, + acr_user_managed_identity_id: Optional[str] = None, + logs_directory_size_limit: Optional[int] = None, + detailed_error_logging_enabled: Optional[bool] = None, + publishing_username: Optional[str] = None, + app_settings: Optional[List["NameValuePair"]] = None, + connection_strings: Optional[List["ConnStringInfo"]] = None, + handler_mappings: Optional[List["HandlerMapping"]] = None, + document_root: Optional[str] = None, + scm_type: Optional[Union[str, "ScmType"]] = None, + use32_bit_worker_process: Optional[bool] = None, + web_sockets_enabled: Optional[bool] = None, + always_on: Optional[bool] = None, + java_version: Optional[str] = None, + java_container: Optional[str] = None, + java_container_version: Optional[str] = None, + app_command_line: Optional[str] = None, + managed_pipeline_mode: Optional[Union[str, "ManagedPipelineMode"]] = None, + virtual_applications: Optional[List["VirtualApplication"]] = None, + load_balancing: Optional[Union[str, "SiteLoadBalancing"]] = None, + experiments: Optional["Experiments"] = None, + limits: Optional["SiteLimits"] = None, + auto_heal_enabled: Optional[bool] = None, + auto_heal_rules: Optional["AutoHealRules"] = None, + tracing_options: Optional[str] = None, + vnet_name: Optional[str] = None, + cors: Optional["CorsSettings"] = None, + push: Optional["PushSettings"] = None, + api_definition: Optional["ApiDefinitionInfo"] = None, + api_management_config: Optional["ApiManagementConfig"] = None, + auto_swap_slot_name: Optional[str] = None, + local_my_sql_enabled: Optional[bool] = False, + managed_service_identity_id: Optional[int] = None, + x_managed_service_identity_id: Optional[int] = None, + ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions: Optional[List["IpSecurityRestriction"]] = None, + scm_ip_security_restrictions_use_main: Optional[bool] = None, + http20_enabled: Optional[bool] = True, + min_tls_version: Optional[Union[str, "SupportedTlsVersions"]] = None, + ftps_state: Optional[Union[str, "FtpsState"]] = None, + pre_warmed_instance_count: Optional[int] = None, + health_check_path: Optional[str] = None, + **kwargs + ): super(SiteConfigResource, self).__init__(kind=kind, **kwargs) self.number_of_workers = number_of_workers self.default_documents = default_documents @@ -10006,6 +12598,8 @@ def __init__(self, *, kind: str=None, number_of_workers: int=None, default_docum self.remote_debugging_enabled = remote_debugging_enabled self.remote_debugging_version = remote_debugging_version self.http_logging_enabled = http_logging_enabled + self.acr_use_managed_identity_creds = acr_use_managed_identity_creds + self.acr_user_managed_identity_id = acr_user_managed_identity_id self.logs_directory_size_limit = logs_directory_size_limit self.detailed_error_logging_enabled = detailed_error_logging_enabled self.publishing_username = publishing_username @@ -10049,11 +12643,44 @@ def __init__(self, *, kind: str=None, number_of_workers: int=None, default_docum self.health_check_path = health_check_path +class SiteConfigResourceCollection(msrest.serialization.Model): + """Collection of site configurations. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteConfigResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteConfigResource"], + **kwargs + ): + super(SiteConfigResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteConfigurationSnapshotInfo(ProxyOnlyResource): """A snapshot of a web app configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10064,8 +12691,8 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :ivar time: The time the snapshot was taken. - :vartype time: datetime - :ivar snapshot_id: The id of the snapshot + :vartype time: ~datetime.datetime + :ivar snapshot_id: The id of the snapshot. :vartype snapshot_id: int """ @@ -10086,17 +12713,55 @@ class SiteConfigurationSnapshotInfo(ProxyOnlyResource): 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'int'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SiteConfigurationSnapshotInfo, self).__init__(kind=kind, **kwargs) self.time = None self.snapshot_id = None +class SiteConfigurationSnapshotInfoCollection(msrest.serialization.Model): + """Collection of metadata for the app configuration snapshots that can be restored. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteConfigurationSnapshotInfo"], + **kwargs + ): + super(SiteConfigurationSnapshotInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteExtensionInfo(ProxyOnlyResource): """Site Extension Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10110,10 +12775,8 @@ class SiteExtensionInfo(ProxyOnlyResource): :type extension_id: str :param title: :type title: str - :param extension_type: Site extension type. Possible values include: - 'Gallery', 'WebRoot' - :type extension_type: str or - ~azure.mgmt.web.v2019_08_01.models.SiteExtensionType + :param extension_type: Site extension type. Possible values include: "Gallery", "WebRoot". + :type extension_type: str or ~azure.mgmt.web.v2019_08_01.models.SiteExtensionType :param summary: Summary description. :type summary: str :param description: Detailed description. @@ -10135,16 +12798,16 @@ class SiteExtensionInfo(ProxyOnlyResource): :param installer_command_line_params: Installer command line parameters. :type installer_command_line_params: str :param published_date_time: Published timestamp. - :type published_date_time: datetime + :type published_date_time: ~datetime.datetime :param download_count: Count of downloads. :type download_count: int - :param local_is_latest_version: true if the local version is - the latest version; false otherwise. + :param local_is_latest_version: :code:`true` if the local version is the latest + version; :code:`false` otherwise. :type local_is_latest_version: bool :param local_path: Local path. :type local_path: str :param installed_date_time: Installed timestamp. - :type installed_date_time: datetime + :type installed_date_time: ~datetime.datetime :param provisioning_state: Provisioning state. :type provisioning_state: str :param comment: Site Extension comment. @@ -10164,7 +12827,7 @@ class SiteExtensionInfo(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'extension_id': {'key': 'properties.extension_id', 'type': 'str'}, 'title': {'key': 'properties.title', 'type': 'str'}, - 'extension_type': {'key': 'properties.extension_type', 'type': 'SiteExtensionType'}, + 'extension_type': {'key': 'properties.extension_type', 'type': 'str'}, 'summary': {'key': 'properties.summary', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'str'}, @@ -10184,7 +12847,32 @@ class SiteExtensionInfo(ProxyOnlyResource): 'comment': {'key': 'properties.comment', 'type': 'str'}, } - def __init__(self, *, kind: str=None, extension_id: str=None, title: str=None, extension_type=None, summary: str=None, description: str=None, version: str=None, extension_url: str=None, project_url: str=None, icon_url: str=None, license_url: str=None, feed_url: str=None, authors=None, installer_command_line_params: str=None, published_date_time=None, download_count: int=None, local_is_latest_version: bool=None, local_path: str=None, installed_date_time=None, provisioning_state: str=None, comment: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + extension_id: Optional[str] = None, + title: Optional[str] = None, + extension_type: Optional[Union[str, "SiteExtensionType"]] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + version: Optional[str] = None, + extension_url: Optional[str] = None, + project_url: Optional[str] = None, + icon_url: Optional[str] = None, + license_url: Optional[str] = None, + feed_url: Optional[str] = None, + authors: Optional[List[str]] = None, + installer_command_line_params: Optional[str] = None, + published_date_time: Optional[datetime.datetime] = None, + download_count: Optional[int] = None, + local_is_latest_version: Optional[bool] = None, + local_path: Optional[str] = None, + installed_date_time: Optional[datetime.datetime] = None, + provisioning_state: Optional[str] = None, + comment: Optional[str] = None, + **kwargs + ): super(SiteExtensionInfo, self).__init__(kind=kind, **kwargs) self.extension_id = extension_id self.title = title @@ -10208,11 +12896,44 @@ def __init__(self, *, kind: str=None, extension_id: str=None, title: str=None, e self.comment = comment +class SiteExtensionInfoCollection(msrest.serialization.Model): + """Collection of Kudu site extension information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteExtensionInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteExtensionInfo"], + **kwargs + ): + super(SiteExtensionInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class SiteInstance(ProxyOnlyResource): """Instance of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10241,12 +12962,17 @@ class SiteInstance(ProxyOnlyResource): 'site_instance_name': {'key': 'properties.siteInstanceName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SiteInstance, self).__init__(kind=kind, **kwargs) self.site_instance_name = None -class SiteLimits(Model): +class SiteLimits(msrest.serialization.Model): """Metric limits set on an app. :param max_percentage_cpu: Maximum allowed CPU usage percentage. @@ -10263,7 +12989,14 @@ class SiteLimits(Model): 'max_disk_size_in_mb': {'key': 'maxDiskSizeInMb', 'type': 'long'}, } - def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None, max_disk_size_in_mb: int=None, **kwargs) -> None: + def __init__( + self, + *, + max_percentage_cpu: Optional[float] = None, + max_memory_in_mb: Optional[int] = None, + max_disk_size_in_mb: Optional[int] = None, + **kwargs + ): super(SiteLimits, self).__init__(**kwargs) self.max_percentage_cpu = max_percentage_cpu self.max_memory_in_mb = max_memory_in_mb @@ -10273,8 +13006,7 @@ def __init__(self, *, max_percentage_cpu: float=None, max_memory_in_mb: int=None class SiteLogsConfig(ProxyOnlyResource): """Configuration of App Service site logs. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10285,16 +13017,13 @@ class SiteLogsConfig(ProxyOnlyResource): :ivar type: Resource type. :vartype type: str :param application_logs: Application logs configuration. - :type application_logs: - ~azure.mgmt.web.v2019_08_01.models.ApplicationLogsConfig + :type application_logs: ~azure.mgmt.web.v2019_08_01.models.ApplicationLogsConfig :param http_logs: HTTP logs configuration. :type http_logs: ~azure.mgmt.web.v2019_08_01.models.HttpLogsConfig :param failed_requests_tracing: Failed requests tracing configuration. - :type failed_requests_tracing: - ~azure.mgmt.web.v2019_08_01.models.EnabledConfig + :type failed_requests_tracing: ~azure.mgmt.web.v2019_08_01.models.EnabledConfig :param detailed_error_messages: Detailed error messages configuration. - :type detailed_error_messages: - ~azure.mgmt.web.v2019_08_01.models.EnabledConfig + :type detailed_error_messages: ~azure.mgmt.web.v2019_08_01.models.EnabledConfig """ _validation = { @@ -10314,7 +13043,16 @@ class SiteLogsConfig(ProxyOnlyResource): 'detailed_error_messages': {'key': 'properties.detailedErrorMessages', 'type': 'EnabledConfig'}, } - def __init__(self, *, kind: str=None, application_logs=None, http_logs=None, failed_requests_tracing=None, detailed_error_messages=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + application_logs: Optional["ApplicationLogsConfig"] = None, + http_logs: Optional["HttpLogsConfig"] = None, + failed_requests_tracing: Optional["EnabledConfig"] = None, + detailed_error_messages: Optional["EnabledConfig"] = None, + **kwargs + ): super(SiteLogsConfig, self).__init__(kind=kind, **kwargs) self.application_logs = application_logs self.http_logs = http_logs @@ -10322,7 +13060,7 @@ def __init__(self, *, kind: str=None, application_logs=None, http_logs=None, fai self.detailed_error_messages = detailed_error_messages -class SiteMachineKey(Model): +class SiteMachineKey(msrest.serialization.Model): """MachineKey of an app. :param validation: MachineKey validation. @@ -10342,7 +13080,15 @@ class SiteMachineKey(Model): 'decryption_key': {'key': 'decryptionKey', 'type': 'str'}, } - def __init__(self, *, validation: str=None, validation_key: str=None, decryption: str=None, decryption_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + validation: Optional[str] = None, + validation_key: Optional[str] = None, + decryption: Optional[str] = None, + decryption_key: Optional[str] = None, + **kwargs + ): super(SiteMachineKey, self).__init__(**kwargs) self.validation = validation self.validation_key = validation_key @@ -10353,8 +13099,7 @@ def __init__(self, *, validation: str=None, validation_key: str=None, decryption class SitePatchResource(ProxyOnlyResource): """ARM resource for a site. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10364,125 +13109,107 @@ class SitePatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param identity: Managed service identity. + :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity :ivar state: Current state of the app. :vartype state: str :ivar host_names: Hostnames associated with the app. :vartype host_names: list[str] :ivar repository_site_name: Name of the repository site. :vartype repository_site_name: str - :ivar usage_state: State indicating whether the app has exceeded its quota - usage. Read-only. Possible values include: 'Normal', 'Exceeded' + :ivar usage_state: State indicating whether the app has exceeded its quota usage. Read-only. + Possible values include: "Normal", "Exceeded". :vartype usage_state: str or ~azure.mgmt.web.v2019_08_01.models.UsageState - :param enabled: true if the app is enabled; otherwise, - false. Setting this value to false disables the app (takes - the app offline). + :param enabled: :code:`true` if the app is enabled; otherwise, + :code:`false`. Setting this value to false disables the app (takes the app + offline). :type enabled: bool - :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to - be assigned (see HostNames) AND enabled. Otherwise, + :ivar enabled_host_names: Enabled hostnames for the app.Hostnames need to be assigned (see + HostNames) AND enabled. Otherwise, the app is not served on those hostnames. :vartype enabled_host_names: list[str] - :ivar availability_state: Management information availability state for - the app. Possible values include: 'Normal', 'Limited', - 'DisasterRecoveryMode' - :vartype availability_state: str or - ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState - :param host_name_ssl_states: Hostname SSL states are used to manage the - SSL bindings for app's hostnames. - :type host_name_ssl_states: - list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] - :param server_farm_id: Resource ID of the associated App Service plan, - formatted as: + :ivar availability_state: Management information availability state for the app. Possible + values include: "Normal", "Limited", "DisasterRecoveryMode". + :vartype availability_state: str or ~azure.mgmt.web.v2019_08_01.models.SiteAvailabilityState + :param host_name_ssl_states: Hostname SSL states are used to manage the SSL bindings for app's + hostnames. + :type host_name_ssl_states: list[~azure.mgmt.web.v2019_08_01.models.HostNameSslState] + :param server_farm_id: Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". :type server_farm_id: str - :param reserved: true if reserved; otherwise, - false. Default value: False . + :param reserved: :code:`true` if reserved; otherwise, :code:`false`. :type reserved: bool - :param is_xenon: Obsolete: Hyper-V sandbox. Default value: False . + :param is_xenon: Obsolete: Hyper-V sandbox. :type is_xenon: bool - :param hyper_v: Hyper-V sandbox. Default value: False . + :param hyper_v: Hyper-V sandbox. :type hyper_v: bool - :ivar last_modified_time_utc: Last time the app was modified, in UTC. - Read-only. - :vartype last_modified_time_utc: datetime + :ivar last_modified_time_utc: Last time the app was modified, in UTC. Read-only. + :vartype last_modified_time_utc: ~datetime.datetime :param site_config: Configuration of the app. :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig - :ivar traffic_manager_host_names: Azure Traffic Manager hostnames - associated with the app. Read-only. + :ivar traffic_manager_host_names: Azure Traffic Manager hostnames associated with the app. + Read-only. :vartype traffic_manager_host_names: list[str] - :param scm_site_also_stopped: true to stop SCM (KUDU) site - when the app is stopped; otherwise, false. The default is - false. Default value: False . + :param scm_site_also_stopped: :code:`true` to stop SCM (KUDU) site when the app is + stopped; otherwise, :code:`false`. The default is :code:`false`. :type scm_site_also_stopped: bool - :ivar target_swap_slot: Specifies which deployment slot this app will swap - into. Read-only. + :ivar target_swap_slot: Specifies which deployment slot this app will swap into. Read-only. :vartype target_swap_slot: str - :param hosting_environment_profile: App Service Environment to use for the - app. - :type hosting_environment_profile: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile - :param client_affinity_enabled: true to enable client - affinity; false to stop sending session affinity cookies, - which route client requests in the same session to the same instance. - Default is true. + :param hosting_environment_profile: App Service Environment to use for the app. + :type hosting_environment_profile: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentProfile + :param client_affinity_enabled: :code:`true` to enable client affinity; + :code:`false` to stop sending session affinity cookies, which route client + requests in the same session to the same instance. Default is :code:`true`. :type client_affinity_enabled: bool - :param client_cert_enabled: true to enable client certificate - authentication (TLS mutual authentication); otherwise, false. - Default is false. + :param client_cert_enabled: :code:`true` to enable client certificate + authentication (TLS mutual authentication); otherwise, :code:`false`. Default is + :code:`false`. :type client_cert_enabled: bool - :param client_cert_exclusion_paths: client certificate authentication - comma-separated exclusion paths + :param client_cert_exclusion_paths: client certificate authentication comma-separated exclusion + paths. :type client_cert_exclusion_paths: str - :param host_names_disabled: true to disable the public - hostnames of the app; otherwise, false. - If true, the app is only accessible via API management - process. + :param host_names_disabled: :code:`true` to disable the public hostnames of the + app; otherwise, :code:`false`. + If :code:`true`, the app is only accessible via API management process. :type host_names_disabled: bool - :ivar outbound_ip_addresses: List of IP addresses that the app uses for - outbound connections (e.g. database access). Includes VIPs from tenants - that site can be hosted with current settings. Read-only. + :ivar outbound_ip_addresses: List of IP addresses that the app uses for outbound connections + (e.g. database access). Includes VIPs from tenants that site can be hosted with current + settings. Read-only. :vartype outbound_ip_addresses: str - :ivar possible_outbound_ip_addresses: List of IP addresses that the app - uses for outbound connections (e.g. database access). Includes VIPs from - all tenants except dataComponent. Read-only. + :ivar possible_outbound_ip_addresses: List of IP addresses that the app uses for outbound + connections (e.g. database access). Includes VIPs from all tenants except dataComponent. Read- + only. :vartype possible_outbound_ip_addresses: str :param container_size: Size of the function container. :type container_size: int - :param daily_memory_time_quota: Maximum allowed daily memory-time quota - (applicable on dynamic apps only). + :param daily_memory_time_quota: Maximum allowed daily memory-time quota (applicable on dynamic + apps only). :type daily_memory_time_quota: int - :ivar suspended_till: App suspended till in case memory-time quota is - exceeded. - :vartype suspended_till: datetime + :ivar suspended_till: App suspended till in case memory-time quota is exceeded. + :vartype suspended_till: ~datetime.datetime :ivar max_number_of_workers: Maximum number of workers. This only applies to Functions container. :vartype max_number_of_workers: int - :param cloning_info: If specified during app creation, the app is cloned - from a source app. + :param cloning_info: If specified during app creation, the app is cloned from a source app. :type cloning_info: ~azure.mgmt.web.v2019_08_01.models.CloningInfo - :ivar resource_group: Name of the resource group the app belongs to. - Read-only. + :ivar resource_group: Name of the resource group the app belongs to. Read-only. :vartype resource_group: str - :ivar is_default_container: true if the app is a default - container; otherwise, false. + :ivar is_default_container: :code:`true` if the app is a default container; + otherwise, :code:`false`. :vartype is_default_container: bool :ivar default_host_name: Default hostname of the app. Read-only. :vartype default_host_name: str :ivar slot_swap_status: Status of the last deployment slot swap operation. - :vartype slot_swap_status: - ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus - :param https_only: HttpsOnly: configures a web site to accept only https - requests. Issues redirect for - http requests + :vartype slot_swap_status: ~azure.mgmt.web.v2019_08_01.models.SlotSwapStatus + :param https_only: HttpsOnly: configures a web site to accept only https requests. Issues + redirect for + http requests. :type https_only: bool - :param redundancy_mode: Site redundancy mode. Possible values include: - 'None', 'Manual', 'Failover', 'ActiveActive', 'GeoRedundant' - :type redundancy_mode: str or - ~azure.mgmt.web.v2019_08_01.models.RedundancyMode - :ivar in_progress_operation_id: Specifies an operation id if this site has - a pending operation. + :param redundancy_mode: Site redundancy mode. Possible values include: "None", "Manual", + "Failover", "ActiveActive", "GeoRedundant". + :type redundancy_mode: str or ~azure.mgmt.web.v2019_08_01.models.RedundancyMode + :ivar in_progress_operation_id: Specifies an operation id if this site has a pending operation. :vartype in_progress_operation_id: str - :param identity: - :type identity: ~azure.mgmt.web.v2019_08_01.models.ManagedServiceIdentity """ _validation = { @@ -10514,13 +13241,14 @@ class SitePatchResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'host_names': {'key': 'properties.hostNames', 'type': '[str]'}, 'repository_site_name': {'key': 'properties.repositorySiteName', 'type': 'str'}, - 'usage_state': {'key': 'properties.usageState', 'type': 'UsageState'}, + 'usage_state': {'key': 'properties.usageState', 'type': 'str'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'enabled_host_names': {'key': 'properties.enabledHostNames', 'type': '[str]'}, - 'availability_state': {'key': 'properties.availabilityState', 'type': 'SiteAvailabilityState'}, + 'availability_state': {'key': 'properties.availabilityState', 'type': 'str'}, 'host_name_ssl_states': {'key': 'properties.hostNameSslStates', 'type': '[HostNameSslState]'}, 'server_farm_id': {'key': 'properties.serverFarmId', 'type': 'str'}, 'reserved': {'key': 'properties.reserved', 'type': 'bool'}, @@ -10548,13 +13276,37 @@ class SitePatchResource(ProxyOnlyResource): 'default_host_name': {'key': 'properties.defaultHostName', 'type': 'str'}, 'slot_swap_status': {'key': 'properties.slotSwapStatus', 'type': 'SlotSwapStatus'}, 'https_only': {'key': 'properties.httpsOnly', 'type': 'bool'}, - 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'RedundancyMode'}, + 'redundancy_mode': {'key': 'properties.redundancyMode', 'type': 'str'}, 'in_progress_operation_id': {'key': 'properties.inProgressOperationId', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } - def __init__(self, *, kind: str=None, enabled: bool=None, host_name_ssl_states=None, server_farm_id: str=None, reserved: bool=False, is_xenon: bool=False, hyper_v: bool=False, site_config=None, scm_site_also_stopped: bool=False, hosting_environment_profile=None, client_affinity_enabled: bool=None, client_cert_enabled: bool=None, client_cert_exclusion_paths: str=None, host_names_disabled: bool=None, container_size: int=None, daily_memory_time_quota: int=None, cloning_info=None, https_only: bool=None, redundancy_mode=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + identity: Optional["ManagedServiceIdentity"] = None, + enabled: Optional[bool] = None, + host_name_ssl_states: Optional[List["HostNameSslState"]] = None, + server_farm_id: Optional[str] = None, + reserved: Optional[bool] = False, + is_xenon: Optional[bool] = False, + hyper_v: Optional[bool] = False, + site_config: Optional["SiteConfig"] = None, + scm_site_also_stopped: Optional[bool] = False, + hosting_environment_profile: Optional["HostingEnvironmentProfile"] = None, + client_affinity_enabled: Optional[bool] = None, + client_cert_enabled: Optional[bool] = None, + client_cert_exclusion_paths: Optional[str] = None, + host_names_disabled: Optional[bool] = None, + container_size: Optional[int] = None, + daily_memory_time_quota: Optional[int] = None, + cloning_info: Optional["CloningInfo"] = None, + https_only: Optional[bool] = None, + redundancy_mode: Optional[Union[str, "RedundancyMode"]] = None, + **kwargs + ): super(SitePatchResource, self).__init__(kind=kind, **kwargs) + self.identity = identity self.state = None self.host_names = None self.repository_site_name = None @@ -10591,14 +13343,12 @@ def __init__(self, *, kind: str=None, enabled: bool=None, host_name_ssl_states=N self.https_only = https_only self.redundancy_mode = redundancy_mode self.in_progress_operation_id = None - self.identity = identity class SitePhpErrorLogFlag(ProxyOnlyResource): """Used for getting PHP error logging flag. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10635,7 +13385,16 @@ class SitePhpErrorLogFlag(ProxyOnlyResource): 'master_log_errors_max_length': {'key': 'properties.masterLogErrorsMaxLength', 'type': 'str'}, } - def __init__(self, *, kind: str=None, local_log_errors: str=None, master_log_errors: str=None, local_log_errors_max_length: str=None, master_log_errors_max_length: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + local_log_errors: Optional[str] = None, + master_log_errors: Optional[str] = None, + local_log_errors_max_length: Optional[str] = None, + master_log_errors_max_length: Optional[str] = None, + **kwargs + ): super(SitePhpErrorLogFlag, self).__init__(kind=kind, **kwargs) self.local_log_errors = local_log_errors self.master_log_errors = master_log_errors @@ -10643,12 +13402,12 @@ def __init__(self, *, kind: str=None, local_log_errors: str=None, master_log_err self.master_log_errors_max_length = master_log_errors_max_length -class SiteSeal(Model): +class SiteSeal(msrest.serialization.Model): """Site seal. All required parameters must be populated in order to send to Azure. - :param html: Required. HTML snippet + :param html: Required. HTML snippet. :type html: str """ @@ -10660,16 +13419,21 @@ class SiteSeal(Model): 'html': {'key': 'html', 'type': 'str'}, } - def __init__(self, *, html: str, **kwargs) -> None: + def __init__( + self, + *, + html: str, + **kwargs + ): super(SiteSeal, self).__init__(**kwargs) self.html = html -class SiteSealRequest(Model): +class SiteSealRequest(msrest.serialization.Model): """Site seal request. - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. + :param light_theme: If :code:`true` use the light color theme for site seal; + otherwise, use the default color theme. :type light_theme: bool :param locale: Locale of site seal. :type locale: str @@ -10680,7 +13444,13 @@ class SiteSealRequest(Model): 'locale': {'key': 'locale', 'type': 'str'}, } - def __init__(self, *, light_theme: bool=None, locale: str=None, **kwargs) -> None: + def __init__( + self, + *, + light_theme: Optional[bool] = None, + locale: Optional[str] = None, + **kwargs + ): super(SiteSealRequest, self).__init__(**kwargs) self.light_theme = light_theme self.locale = locale @@ -10689,8 +13459,7 @@ def __init__(self, *, light_theme: bool=None, locale: str=None, **kwargs) -> Non class SiteSourceControl(ProxyOnlyResource): """Source control configuration for an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10704,15 +13473,15 @@ class SiteSourceControl(ProxyOnlyResource): :type repo_url: str :param branch: Name of branch to use for deployment. :type branch: str - :param is_manual_integration: true to limit to manual - integration; false to enable continuous integration (which - configures webhooks into online repos like GitHub). + :param is_manual_integration: :code:`true` to limit to manual integration; + :code:`false` to enable continuous integration (which configures webhooks into + online repos like GitHub). :type is_manual_integration: bool - :param deployment_rollback_enabled: true to enable deployment - rollback; otherwise, false. + :param deployment_rollback_enabled: :code:`true` to enable deployment rollback; + otherwise, :code:`false`. :type deployment_rollback_enabled: bool - :param is_mercurial: true for a Mercurial repository; - false for a Git repository. + :param is_mercurial: :code:`true` for a Mercurial repository; + :code:`false` for a Git repository. :type is_mercurial: bool """ @@ -10734,7 +13503,17 @@ class SiteSourceControl(ProxyOnlyResource): 'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_manual_integration: bool=None, deployment_rollback_enabled: bool=None, is_mercurial: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + is_manual_integration: Optional[bool] = None, + deployment_rollback_enabled: Optional[bool] = None, + is_mercurial: Optional[bool] = None, + **kwargs + ): super(SiteSourceControl, self).__init__(kind=kind, **kwargs) self.repo_url = repo_url self.branch = branch @@ -10743,7 +13522,7 @@ def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_m self.is_mercurial = is_mercurial -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """Description of the App Service plan scale options. :param minimum: Minimum number of workers for this App Service plan SKU. @@ -10763,7 +13542,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, scale_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[str] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -10771,7 +13558,7 @@ def __init__(self, *, minimum: int=None, maximum: int=None, default: int=None, s self.scale_type = scale_type -class SkuDescription(Model): +class SkuDescription(msrest.serialization.Model): """Description of a SKU for a scalable resource. :param name: Name of the resource SKU. @@ -10788,8 +13575,7 @@ class SkuDescription(Model): :type sku_capacity: ~azure.mgmt.web.v2019_08_01.models.SkuCapacity :param locations: Locations of the SKU. :type locations: list[str] - :param capabilities: Capabilities of the SKU, e.g., is traffic manager - enabled? + :param capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?. :type capabilities: list[~azure.mgmt.web.v2019_08_01.models.Capability] """ @@ -10804,7 +13590,19 @@ class SkuDescription(Model): 'capabilities': {'key': 'capabilities', 'type': '[Capability]'}, } - def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, capacity: int=None, sku_capacity=None, locations=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + sku_capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + capabilities: Optional[List["Capability"]] = None, + **kwargs + ): super(SkuDescription, self).__init__(**kwargs) self.name = name self.tier = tier @@ -10816,7 +13614,7 @@ def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: st self.capabilities = capabilities -class SkuInfo(Model): +class SkuInfo(msrest.serialization.Model): """SKU discovery information. :param resource_type: Resource type that this SKU applies to. @@ -10833,21 +13631,61 @@ class SkuInfo(Model): 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, } - def __init__(self, *, resource_type: str=None, sku=None, capacity=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional["SkuDescription"] = None, + capacity: Optional["SkuCapacity"] = None, + **kwargs + ): super(SkuInfo, self).__init__(**kwargs) self.resource_type = resource_type self.sku = sku self.capacity = capacity -class SkuInfos(Model): +class SkuInfoCollection(msrest.serialization.Model): + """Collection of SKU information. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SkuInfo] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SkuInfo"], + **kwargs + ): + super(SkuInfoCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SkuInfos(msrest.serialization.Model): """Collection of SKU information. :param resource_type: Resource type that this SKU applies to. :type resource_type: str :param skus: List of SKUs the subscription is able to use. - :type skus: - list[~azure.mgmt.web.v2019_08_01.models.GlobalCsmSkuDescription] + :type skus: list[~azure.mgmt.web.v2019_08_01.models.GlobalCsmSkuDescription] """ _attribute_map = { @@ -10855,7 +13693,13 @@ class SkuInfos(Model): 'skus': {'key': 'skus', 'type': '[GlobalCsmSkuDescription]'}, } - def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + skus: Optional[List["GlobalCsmSkuDescription"]] = None, + **kwargs + ): super(SkuInfos, self).__init__(**kwargs) self.resource_type = resource_type self.skus = skus @@ -10864,8 +13708,7 @@ def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: class SlotConfigNamesResource(ProxyOnlyResource): """Slot Config names azure resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10879,8 +13722,7 @@ class SlotConfigNamesResource(ProxyOnlyResource): :type connection_string_names: list[str] :param app_setting_names: List of application settings names. :type app_setting_names: list[str] - :param azure_storage_config_names: List of external Azure storage account - identifiers. + :param azure_storage_config_names: List of external Azure storage account identifiers. :type azure_storage_config_names: list[str] """ @@ -10900,7 +13742,15 @@ class SlotConfigNamesResource(ProxyOnlyResource): 'azure_storage_config_names': {'key': 'properties.azureStorageConfigNames', 'type': '[str]'}, } - def __init__(self, *, kind: str=None, connection_string_names=None, app_setting_names=None, azure_storage_config_names=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + connection_string_names: Optional[List[str]] = None, + app_setting_names: Optional[List[str]] = None, + azure_storage_config_names: Optional[List[str]] = None, + **kwargs + ): super(SlotConfigNamesResource, self).__init__(kind=kind, **kwargs) self.connection_string_names = connection_string_names self.app_setting_names = app_setting_names @@ -10910,8 +13760,7 @@ def __init__(self, *, kind: str=None, connection_string_names=None, app_setting_ class SlotDifference(ProxyOnlyResource): """A setting difference between two deployment slots of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -10923,11 +13772,9 @@ class SlotDifference(ProxyOnlyResource): :vartype type: str :ivar level: Level of the difference: Information, Warning or Error. :vartype level: str - :ivar setting_type: The type of the setting: General, AppSetting or - ConnectionString. + :ivar setting_type: The type of the setting: General, AppSetting or ConnectionString. :vartype setting_type: str - :ivar diff_rule: Rule that describes how to process the setting difference - during a slot swap. + :ivar diff_rule: Rule that describes how to process the setting difference during a slot swap. :vartype diff_rule: str :ivar setting_name: Name of the setting. :vartype setting_name: str @@ -10966,7 +13813,12 @@ class SlotDifference(ProxyOnlyResource): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(SlotDifference, self).__init__(kind=kind, **kwargs) self.level = None self.setting_type = None @@ -10977,18 +13829,50 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.description = None -class SlotSwapStatus(Model): +class SlotDifferenceCollection(msrest.serialization.Model): + """Collection of slot differences. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SlotDifference] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SlotDifference]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SlotDifference"], + **kwargs + ): + super(SlotDifferenceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SlotSwapStatus(msrest.serialization.Model): """The status of the last successful slot swap operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar timestamp_utc: The time the last successful slot swap completed. - :vartype timestamp_utc: datetime + :vartype timestamp_utc: ~datetime.datetime :ivar source_slot_name: The source slot of the last swap operation. :vartype source_slot_name: str - :ivar destination_slot_name: The destination slot of the last swap - operation. + :ivar destination_slot_name: The destination slot of the last swap operation. :vartype destination_slot_name: str """ @@ -11004,14 +13888,17 @@ class SlotSwapStatus(Model): 'destination_slot_name': {'key': 'destinationSlotName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SlotSwapStatus, self).__init__(**kwargs) self.timestamp_utc = None self.source_slot_name = None self.destination_slot_name = None -class SlowRequestsBasedTrigger(Model): +class SlowRequestsBasedTrigger(msrest.serialization.Model): """Trigger based on request execution time. :param time_taken: Time taken. @@ -11028,7 +13915,14 @@ class SlowRequestsBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + time_taken: Optional[str] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(SlowRequestsBasedTrigger, self).__init__(**kwargs) self.time_taken = time_taken self.count = count @@ -11038,8 +13932,7 @@ def __init__(self, *, time_taken: str=None, count: int=None, time_interval: str= class Snapshot(ProxyOnlyResource): """A snapshot of an app. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11068,21 +13961,60 @@ class Snapshot(ProxyOnlyResource): 'time': {'key': 'properties.time', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(Snapshot, self).__init__(kind=kind, **kwargs) self.time = None -class SnapshotRecoverySource(Model): +class SnapshotCollection(msrest.serialization.Model): + """Collection of snapshots which can be used to revert an app to a previous time. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Snapshot] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Snapshot"], + **kwargs + ): + super(SnapshotCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SnapshotRecoverySource(msrest.serialization.Model): """Specifies the web app that snapshot contents will be retrieved from. - :param location: Geographical location of the source web app, e.g. - SouthEastAsia, SouthCentralUS + :param location: Geographical location of the source web app, e.g. SouthEastAsia, + SouthCentralUS. :type location: str :param id: ARM resource ID of the source app. - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. :type id: str """ @@ -11092,7 +14024,13 @@ class SnapshotRecoverySource(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): super(SnapshotRecoverySource, self).__init__(**kwargs) self.location = location self.id = id @@ -11101,10 +14039,7 @@ def __init__(self, *, location: str=None, id: str=None, **kwargs) -> None: class SnapshotRestoreRequest(ProxyOnlyResource): """Details about app recovery operation. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11114,26 +14049,24 @@ class SnapshotRestoreRequest(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param snapshot_time: Point in time in which the app restore should be - done, formatted as a DateTime string. + :param snapshot_time: Point in time in which the app restore should be done, formatted as a + DateTime string. :type snapshot_time: str - :param recovery_source: Optional. Specifies the web app that snapshot - contents will be retrieved from. + :param recovery_source: Optional. Specifies the web app that snapshot contents will be + retrieved from. If empty, the targeted web app will be used as the source. - :type recovery_source: - ~azure.mgmt.web.v2019_08_01.models.SnapshotRecoverySource - :param overwrite: Required. If true the restore operation can - overwrite source app; otherwise, false. + :type recovery_source: ~azure.mgmt.web.v2019_08_01.models.SnapshotRecoverySource + :param overwrite: If :code:`true` the restore operation can overwrite source app; + otherwise, :code:`false`. :type overwrite: bool - :param recover_configuration: If true, site configuration, in addition to - content, will be reverted. + :param recover_configuration: If true, site configuration, in addition to content, will be + reverted. :type recover_configuration: bool - :param ignore_conflicting_host_names: If true, custom hostname conflicts - will be ignored when recovering to a target web app. + :param ignore_conflicting_host_names: If true, custom hostname conflicts will be ignored when + recovering to a target web app. This setting is only necessary when RecoverConfiguration is enabled. :type ignore_conflicting_host_names: bool - :param use_dr_secondary: If true, the snapshot is retrieved from - DRSecondary endpoint. + :param use_dr_secondary: If true, the snapshot is retrieved from DRSecondary endpoint. :type use_dr_secondary: bool """ @@ -11141,7 +14074,6 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'overwrite': {'required': True}, } _attribute_map = { @@ -11157,7 +14089,18 @@ class SnapshotRestoreRequest(ProxyOnlyResource): 'use_dr_secondary': {'key': 'properties.useDRSecondary', 'type': 'bool'}, } - def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, recovery_source=None, recover_configuration: bool=None, ignore_conflicting_host_names: bool=None, use_dr_secondary: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + snapshot_time: Optional[str] = None, + recovery_source: Optional["SnapshotRecoverySource"] = None, + overwrite: Optional[bool] = None, + recover_configuration: Optional[bool] = None, + ignore_conflicting_host_names: Optional[bool] = None, + use_dr_secondary: Optional[bool] = None, + **kwargs + ): super(SnapshotRestoreRequest, self).__init__(kind=kind, **kwargs) self.snapshot_time = snapshot_time self.recovery_source = recovery_source @@ -11167,25 +14110,24 @@ def __init__(self, *, overwrite: bool, kind: str=None, snapshot_time: str=None, self.use_dr_secondary = use_dr_secondary -class Solution(Model): +class Solution(msrest.serialization.Model): """Class Representing Solution for problems detected. :param id: Solution Id. :type id: float - :param display_name: Display Name of the solution + :param display_name: Display Name of the solution. :type display_name: str :param order: Order of the solution. :type order: float - :param description: Description of the solution + :param description: Description of the solution. :type description: str - :param type: Type of Solution. Possible values include: 'QuickSolution', - 'DeepInvestigation', 'BestPractices' + :param type: Type of Solution. Possible values include: "QuickSolution", "DeepInvestigation", + "BestPractices". :type type: str or ~azure.mgmt.web.v2019_08_01.models.SolutionType :param data: Solution Data. :type data: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] :param metadata: Solution Metadata. - :type metadata: - list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] + :type metadata: list[list[~azure.mgmt.web.v2019_08_01.models.NameValuePair]] """ _attribute_map = { @@ -11193,12 +14135,23 @@ class Solution(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'float'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'SolutionType'}, + 'type': {'key': 'type', 'type': 'str'}, 'data': {'key': 'data', 'type': '[[NameValuePair]]'}, 'metadata': {'key': 'metadata', 'type': '[[NameValuePair]]'}, } - def __init__(self, *, id: float=None, display_name: str=None, order: float=None, description: str=None, type=None, data=None, metadata=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[float] = None, + display_name: Optional[str] = None, + order: Optional[float] = None, + description: Optional[str] = None, + type: Optional[Union[str, "SolutionType"]] = None, + data: Optional[List[List["NameValuePair"]]] = None, + metadata: Optional[List[List["NameValuePair"]]] = None, + **kwargs + ): super(Solution, self).__init__(**kwargs) self.id = id self.display_name = display_name @@ -11212,8 +14165,7 @@ def __init__(self, *, id: float=None, display_name: str=None, order: float=None, class SourceControl(ProxyOnlyResource): """The source control OAuth token. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11230,7 +14182,7 @@ class SourceControl(ProxyOnlyResource): :param refresh_token: OAuth refresh token. :type refresh_token: str :param expiration_time: OAuth token expiration. - :type expiration_time: datetime + :type expiration_time: ~datetime.datetime """ _validation = { @@ -11250,7 +14202,16 @@ class SourceControl(ProxyOnlyResource): 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, } - def __init__(self, *, kind: str=None, token: str=None, token_secret: str=None, refresh_token: str=None, expiration_time=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + token: Optional[str] = None, + token_secret: Optional[str] = None, + refresh_token: Optional[str] = None, + expiration_time: Optional[datetime.datetime] = None, + **kwargs + ): super(SourceControl, self).__init__(kind=kind, **kwargs) self.token = token self.token_secret = token_secret @@ -11258,30 +14219,63 @@ def __init__(self, *, kind: str=None, token: str=None, token_secret: str=None, r self.expiration_time = expiration_time -class StackMajorVersion(Model): +class SourceControlCollection(msrest.serialization.Model): + """Collection of source controls. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SourceControl"], + **kwargs + ): + super(SourceControlCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StackMajorVersion(msrest.serialization.Model): """Application stack major version. :param display_version: Application stack major version (display only). :type display_version: str :param runtime_version: Application stack major version (runtime only). :type runtime_version: str - :param is_default: true if this is the default major version; - otherwise, false. + :param is_default: :code:`true` if this is the default major version; otherwise, + :code:`false`. :type is_default: bool :param minor_versions: Minor versions associated with the major version. - :type minor_versions: - list[~azure.mgmt.web.v2019_08_01.models.StackMinorVersion] - :param application_insights: true if this supports - Application Insights; otherwise, false. + :type minor_versions: list[~azure.mgmt.web.v2019_08_01.models.StackMinorVersion] + :param application_insights: :code:`true` if this supports Application Insights; + otherwise, :code:`false`. :type application_insights: bool - :param is_preview: true if this stack is in Preview, - otherwise false. + :param is_preview: :code:`true` if this stack is in Preview, otherwise + :code:`false`. :type is_preview: bool - :param is_deprecated: true if this stack has been deprecated, - otherwise false. + :param is_deprecated: :code:`true` if this stack has been deprecated, otherwise + :code:`false`. :type is_deprecated: bool - :param is_hidden: true if this stack should be hidden for new - customers on portal, otherwise false. + :param is_hidden: :code:`true` if this stack should be hidden for new customers on + portal, otherwise :code:`false`. :type is_hidden: bool """ @@ -11296,7 +14290,19 @@ class StackMajorVersion(Model): 'is_hidden': {'key': 'isHidden', 'type': 'bool'}, } - def __init__(self, *, display_version: str=None, runtime_version: str=None, is_default: bool=None, minor_versions=None, application_insights: bool=None, is_preview: bool=None, is_deprecated: bool=None, is_hidden: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_version: Optional[str] = None, + runtime_version: Optional[str] = None, + is_default: Optional[bool] = None, + minor_versions: Optional[List["StackMinorVersion"]] = None, + application_insights: Optional[bool] = None, + is_preview: Optional[bool] = None, + is_deprecated: Optional[bool] = None, + is_hidden: Optional[bool] = None, + **kwargs + ): super(StackMajorVersion, self).__init__(**kwargs) self.display_version = display_version self.runtime_version = runtime_version @@ -11308,18 +14314,18 @@ def __init__(self, *, display_version: str=None, runtime_version: str=None, is_d self.is_hidden = is_hidden -class StackMinorVersion(Model): +class StackMinorVersion(msrest.serialization.Model): """Application stack minor version. :param display_version: Application stack minor version (display only). :type display_version: str :param runtime_version: Application stack minor version (runtime only). :type runtime_version: str - :param is_default: true if this is the default minor version; - otherwise, false. + :param is_default: :code:`true` if this is the default minor version; otherwise, + :code:`false`. :type is_default: bool - :param is_remote_debugging_enabled: true if this supports - Remote Debugging, otherwise false. + :param is_remote_debugging_enabled: :code:`true` if this supports Remote + Debugging, otherwise :code:`false`. :type is_remote_debugging_enabled: bool """ @@ -11330,7 +14336,15 @@ class StackMinorVersion(Model): 'is_remote_debugging_enabled': {'key': 'isRemoteDebuggingEnabled', 'type': 'bool'}, } - def __init__(self, *, display_version: str=None, runtime_version: str=None, is_default: bool=None, is_remote_debugging_enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_version: Optional[str] = None, + runtime_version: Optional[str] = None, + is_default: Optional[bool] = None, + is_remote_debugging_enabled: Optional[bool] = None, + **kwargs + ): super(StackMinorVersion, self).__init__(**kwargs) self.display_version = display_version self.runtime_version = runtime_version @@ -11338,42 +14352,37 @@ def __init__(self, *, display_version: str=None, runtime_version: str=None, is_d self.is_remote_debugging_enabled = is_remote_debugging_enabled -class StampCapacity(Model): +class StampCapacity(msrest.serialization.Model): """Stamp capacity information. :param name: Name of the stamp. :type name: str - :param available_capacity: Available capacity (# of machines, bytes of - storage etc...). + :param available_capacity: Available capacity (# of machines, bytes of storage etc...). :type available_capacity: long - :param total_capacity: Total capacity (# of machines, bytes of storage - etc...). + :param total_capacity: Total capacity (# of machines, bytes of storage etc...). :type total_capacity: long :param unit: Name of the unit. :type unit: str - :param compute_mode: Shared/dedicated workers. Possible values include: - 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions - :param worker_size: Size of the machines. Possible values include: - 'Small', 'Medium', 'Large', 'D1', 'D2', 'D3', 'NestedSmall', 'Default' - :type worker_size: str or - ~azure.mgmt.web.v2019_08_01.models.WorkerSizeOptions + :param compute_mode: Shared/dedicated workers. Possible values include: "Shared", "Dedicated", + "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :param worker_size: Size of the machines. Possible values include: "Small", "Medium", "Large", + "D1", "D2", "D3", "NestedSmall", "Default". + :type worker_size: str or ~azure.mgmt.web.v2019_08_01.models.WorkerSizeOptions :param worker_size_id: Size ID of machines: 0 - Small 1 - Medium - 2 - Large + 2 - Large. :type worker_size_id: int - :param exclude_from_capacity_allocation: If true, it includes - basic apps. + :param exclude_from_capacity_allocation: If :code:`true`, it includes basic apps. Basic apps are not used for capacity allocation. :type exclude_from_capacity_allocation: bool - :param is_applicable_for_all_compute_modes: true if capacity - is applicable for all apps; otherwise, false. + :param is_applicable_for_all_compute_modes: :code:`true` if capacity is applicable + for all apps; otherwise, :code:`false`. :type is_applicable_for_all_compute_modes: bool :param site_mode: Shared or Dedicated. :type site_mode: str - :param is_linux: Is this a linux stamp capacity + :param is_linux: Is this a linux stamp capacity. :type is_linux: bool """ @@ -11382,8 +14391,8 @@ class StampCapacity(Model): 'available_capacity': {'key': 'availableCapacity', 'type': 'long'}, 'total_capacity': {'key': 'totalCapacity', 'type': 'long'}, 'unit': {'key': 'unit', 'type': 'str'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, - 'worker_size': {'key': 'workerSize', 'type': 'WorkerSizeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, + 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, 'exclude_from_capacity_allocation': {'key': 'excludeFromCapacityAllocation', 'type': 'bool'}, 'is_applicable_for_all_compute_modes': {'key': 'isApplicableForAllComputeModes', 'type': 'bool'}, @@ -11391,7 +14400,22 @@ class StampCapacity(Model): 'is_linux': {'key': 'isLinux', 'type': 'bool'}, } - def __init__(self, *, name: str=None, available_capacity: int=None, total_capacity: int=None, unit: str=None, compute_mode=None, worker_size=None, worker_size_id: int=None, exclude_from_capacity_allocation: bool=None, is_applicable_for_all_compute_modes: bool=None, site_mode: str=None, is_linux: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + available_capacity: Optional[int] = None, + total_capacity: Optional[int] = None, + unit: Optional[str] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[Union[str, "WorkerSizeOptions"]] = None, + worker_size_id: Optional[int] = None, + exclude_from_capacity_allocation: Optional[bool] = None, + is_applicable_for_all_compute_modes: Optional[bool] = None, + site_mode: Optional[str] = None, + is_linux: Optional[bool] = None, + **kwargs + ): super(StampCapacity, self).__init__(**kwargs) self.name = name self.available_capacity = available_capacity @@ -11406,11 +14430,44 @@ def __init__(self, *, name: str=None, available_capacity: int=None, total_capaci self.is_linux = is_linux +class StampCapacityCollection(msrest.serialization.Model): + """Collection of stamp capacities. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StampCapacity] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StampCapacity]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StampCapacity"], + **kwargs + ): + super(StampCapacityCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class StaticSiteARMResource(Resource): """Static Site ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -11424,10 +14481,11 @@ class StaticSiteARMResource(Resource): :type location: str :ivar type: Resource type. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :ivar default_hostname: The default autogenerated hostname for the static - site. + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :ivar default_hostname: The default autogenerated hostname for the static site. :vartype default_hostname: str :param repository_url: URL for the repository of the static site. :type repository_url: str @@ -11435,14 +14493,11 @@ class StaticSiteARMResource(Resource): :type branch: str :ivar custom_domains: The custom domains associated with this static site. :vartype custom_domains: list[str] - :param repository_token: A user's github repository token. This is used to - setup the Github Actions workflow file and API secrets. + :param repository_token: A user's github repository token. This is used to setup the Github + Actions workflow file and API secrets. :type repository_token: str :param build_properties: Build properties to configure on the repository. - :type build_properties: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties - :param sku: - :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription + :type build_properties: ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties """ _validation = { @@ -11461,31 +14516,42 @@ class StaticSiteARMResource(Resource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'default_hostname': {'key': 'properties.defaultHostname', 'type': 'str'}, 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, 'branch': {'key': 'properties.branch', 'type': 'str'}, 'custom_domains': {'key': 'properties.customDomains', 'type': '[str]'}, 'repository_token': {'key': 'properties.repositoryToken', 'type': 'str'}, 'build_properties': {'key': 'properties.buildProperties', 'type': 'StaticSiteBuildProperties'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, *, location: str, kind: str=None, tags=None, repository_url: str=None, branch: str=None, repository_token: str=None, build_properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SkuDescription"] = None, + repository_url: Optional[str] = None, + branch: Optional[str] = None, + repository_token: Optional[str] = None, + build_properties: Optional["StaticSiteBuildProperties"] = None, + **kwargs + ): super(StaticSiteARMResource, self).__init__(kind=kind, location=location, tags=tags, **kwargs) + self.sku = sku self.default_hostname = None self.repository_url = repository_url self.branch = branch self.custom_domains = None self.repository_token = repository_token self.build_properties = build_properties - self.sku = sku class StaticSiteBuildARMResource(ProxyOnlyResource): """Static Site Build ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11499,18 +14565,16 @@ class StaticSiteBuildARMResource(ProxyOnlyResource): :vartype build_id: str :ivar source_branch: The source branch. :vartype source_branch: str - :ivar pull_request_title: The title of a pull request that a static site - build is related to. + :ivar pull_request_title: The title of a pull request that a static site build is related to. :vartype pull_request_title: str :ivar hostname: The hostname for a static site build. :vartype hostname: str :ivar created_time_utc: When this build was created. - :vartype created_time_utc: datetime + :vartype created_time_utc: ~datetime.datetime :ivar last_updated_on: When this build was updated. - :vartype last_updated_on: datetime - :ivar status: The status of the static site build. Possible values - include: 'WaitingForDeployment', 'Uploading', 'Deploying', 'Ready', - 'Failed', 'Deleting', 'Detached' + :vartype last_updated_on: ~datetime.datetime + :ivar status: The status of the static site build. Possible values include: + "WaitingForDeployment", "Uploading", "Deploying", "Ready", "Failed", "Deleting", "Detached". :vartype status: str or ~azure.mgmt.web.v2019_08_01.models.BuildStatus """ @@ -11541,7 +14605,12 @@ class StaticSiteBuildARMResource(ProxyOnlyResource): 'status': {'key': 'properties.status', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(StaticSiteBuildARMResource, self).__init__(kind=kind, **kwargs) self.build_id = None self.source_branch = None @@ -11552,15 +14621,48 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.status = None -class StaticSiteBuildProperties(Model): +class StaticSiteBuildCollection(msrest.serialization.Model): + """Collection of static site builds. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteBuildARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StaticSiteBuildARMResource"], + **kwargs + ): + super(StaticSiteBuildCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StaticSiteBuildProperties(msrest.serialization.Model): """Build properties for the static site. :param app_location: The path to the app code within the repository. :type app_location: str :param api_location: The path to the api code within the repository. :type api_location: str - :param app_artifact_location: The path of the app artifacts after - building. + :param app_artifact_location: The path of the app artifacts after building. :type app_artifact_location: str """ @@ -11570,18 +14672,58 @@ class StaticSiteBuildProperties(Model): 'app_artifact_location': {'key': 'appArtifactLocation', 'type': 'str'}, } - def __init__(self, *, app_location: str=None, api_location: str=None, app_artifact_location: str=None, **kwargs) -> None: + def __init__( + self, + *, + app_location: Optional[str] = None, + api_location: Optional[str] = None, + app_artifact_location: Optional[str] = None, + **kwargs + ): super(StaticSiteBuildProperties, self).__init__(**kwargs) self.app_location = app_location self.api_location = api_location self.app_artifact_location = app_artifact_location +class StaticSiteCollection(msrest.serialization.Model): + """Collection of static sites. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StaticSiteARMResource"], + **kwargs + ): + super(StaticSiteCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class StaticSiteCustomDomainOverviewARMResource(ProxyOnlyResource): """Static Site Custom Domain Overview ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11593,39 +14735,76 @@ class StaticSiteCustomDomainOverviewARMResource(ProxyOnlyResource): :vartype type: str :ivar domain_name: The domain name for the static site custom domain. :vartype domain_name: str - :ivar created_on: The date and time on which the custom domain was created - for the static site. - :vartype created_on: datetime + :ivar created_on: The date and time on which the custom domain was created for the static site. + :vartype created_on: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'domain_name': {'readonly': True}, + 'created_on': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'properties.domainName', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): + super(StaticSiteCustomDomainOverviewARMResource, self).__init__(kind=kind, **kwargs) + self.domain_name = None + self.created_on = None + + +class StaticSiteCustomDomainOverviewCollection(msrest.serialization.Model): + """Collection of static site custom domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'domain_name': {'readonly': True}, - 'created_on': {'readonly': True}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'domain_name': {'key': 'properties.domainName', 'type': 'str'}, - 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': '[StaticSiteCustomDomainOverviewARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: - super(StaticSiteCustomDomainOverviewARMResource, self).__init__(kind=kind, **kwargs) - self.domain_name = None - self.created_on = None + def __init__( + self, + *, + value: List["StaticSiteCustomDomainOverviewARMResource"], + **kwargs + ): + super(StaticSiteCustomDomainOverviewCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None class StaticSiteFunctionOverviewARMResource(ProxyOnlyResource): """Static Site Function Overview ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11635,12 +14814,11 @@ class StaticSiteFunctionOverviewARMResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar function_name: The name for the function + :ivar function_name: The name for the function. :vartype function_name: str - :ivar trigger_type: The trigger type of the function. Possible values - include: 'HttpTrigger', 'Unknown' - :vartype trigger_type: str or - ~azure.mgmt.web.v2019_08_01.models.TriggerTypes + :ivar trigger_type: The trigger type of the function. Possible values include: "HttpTrigger", + "Unknown". + :vartype trigger_type: str or ~azure.mgmt.web.v2019_08_01.models.TriggerTypes """ _validation = { @@ -11660,17 +14838,55 @@ class StaticSiteFunctionOverviewARMResource(ProxyOnlyResource): 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(StaticSiteFunctionOverviewARMResource, self).__init__(kind=kind, **kwargs) self.function_name = None self.trigger_type = None +class StaticSiteFunctionOverviewCollection(msrest.serialization.Model): + """Collection of static site functions. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteFunctionOverviewARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StaticSiteFunctionOverviewARMResource"], + **kwargs + ): + super(StaticSiteFunctionOverviewCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class StaticSitePatchResource(ProxyOnlyResource): """ARM resource for a static site when patching. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11680,8 +14896,7 @@ class StaticSitePatchResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar default_hostname: The default autogenerated hostname for the static - site. + :ivar default_hostname: The default autogenerated hostname for the static site. :vartype default_hostname: str :param repository_url: URL for the repository of the static site. :type repository_url: str @@ -11689,12 +14904,11 @@ class StaticSitePatchResource(ProxyOnlyResource): :type branch: str :ivar custom_domains: The custom domains associated with this static site. :vartype custom_domains: list[str] - :param repository_token: A user's github repository token. This is used to - setup the Github Actions workflow file and API secrets. + :param repository_token: A user's github repository token. This is used to setup the Github + Actions workflow file and API secrets. :type repository_token: str :param build_properties: Build properties to configure on the repository. - :type build_properties: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties + :type build_properties: ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildProperties """ _validation = { @@ -11718,7 +14932,16 @@ class StaticSitePatchResource(ProxyOnlyResource): 'build_properties': {'key': 'properties.buildProperties', 'type': 'StaticSiteBuildProperties'}, } - def __init__(self, *, kind: str=None, repository_url: str=None, branch: str=None, repository_token: str=None, build_properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + repository_url: Optional[str] = None, + branch: Optional[str] = None, + repository_token: Optional[str] = None, + build_properties: Optional["StaticSiteBuildProperties"] = None, + **kwargs + ): super(StaticSitePatchResource, self).__init__(kind=kind, **kwargs) self.default_hostname = None self.repository_url = repository_url @@ -11731,8 +14954,7 @@ def __init__(self, *, kind: str=None, repository_url: str=None, branch: str=None class StaticSiteResetPropertiesARMResource(ProxyOnlyResource): """Static Site Reset Properties ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11742,11 +14964,10 @@ class StaticSiteResetPropertiesARMResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param repository_token: The token which proves admin privileges to the - repository. + :param repository_token: The token which proves admin privileges to the repository. :type repository_token: str - :param should_update_repository: Determines whether the repository should - be updated with the new properties. + :param should_update_repository: Determines whether the repository should be updated with the + new properties. :type should_update_repository: bool """ @@ -11765,7 +14986,14 @@ class StaticSiteResetPropertiesARMResource(ProxyOnlyResource): 'should_update_repository': {'key': 'properties.shouldUpdateRepository', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, repository_token: str=None, should_update_repository: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + repository_token: Optional[str] = None, + should_update_repository: Optional[bool] = None, + **kwargs + ): super(StaticSiteResetPropertiesARMResource, self).__init__(kind=kind, **kwargs) self.repository_token = repository_token self.should_update_repository = should_update_repository @@ -11774,8 +15002,7 @@ def __init__(self, *, kind: str=None, repository_token: str=None, should_update_ class StaticSiteUserARMResource(ProxyOnlyResource): """Static Site User ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11791,8 +15018,7 @@ class StaticSiteUserARMResource(ProxyOnlyResource): :vartype user_id: str :ivar display_name: The display name for the static site user. :vartype display_name: str - :param roles: The roles for the static site user, in free-form string - format + :param roles: The roles for the static site user, in free-form string format. :type roles: str """ @@ -11816,7 +15042,13 @@ class StaticSiteUserARMResource(ProxyOnlyResource): 'roles': {'key': 'properties.roles', 'type': 'str'}, } - def __init__(self, *, kind: str=None, roles: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + roles: Optional[str] = None, + **kwargs + ): super(StaticSiteUserARMResource, self).__init__(kind=kind, **kwargs) self.provider = None self.user_id = None @@ -11824,11 +15056,44 @@ def __init__(self, *, kind: str=None, roles: str=None, **kwargs) -> None: self.roles = roles +class StaticSiteUserCollection(msrest.serialization.Model): + """Collection of static site custom users. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StaticSiteUserARMResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StaticSiteUserARMResource"], + **kwargs + ): + super(StaticSiteUserCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class StaticSiteUserInvitationRequestResource(ProxyOnlyResource): """Static sites user roles invitation resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11844,11 +15109,9 @@ class StaticSiteUserInvitationRequestResource(ProxyOnlyResource): :type provider: str :param user_details: The user id for the static site user. :type user_details: str - :param roles: The roles for the static site user, in free-form string - format + :param roles: The roles for the static site user, in free-form string format. :type roles: str - :param num_hours_to_expiration: The number of hours the sas token stays - valid + :param num_hours_to_expiration: The number of hours the sas token stays valid. :type num_hours_to_expiration: int """ @@ -11870,7 +15133,17 @@ class StaticSiteUserInvitationRequestResource(ProxyOnlyResource): 'num_hours_to_expiration': {'key': 'properties.numHoursToExpiration', 'type': 'int'}, } - def __init__(self, *, kind: str=None, domain: str=None, provider: str=None, user_details: str=None, roles: str=None, num_hours_to_expiration: int=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + domain: Optional[str] = None, + provider: Optional[str] = None, + user_details: Optional[str] = None, + roles: Optional[str] = None, + num_hours_to_expiration: Optional[int] = None, + **kwargs + ): super(StaticSiteUserInvitationRequestResource, self).__init__(kind=kind, **kwargs) self.domain = domain self.provider = provider @@ -11882,8 +15155,7 @@ def __init__(self, *, kind: str=None, domain: str=None, provider: str=None, user class StaticSiteUserInvitationResponseResource(ProxyOnlyResource): """Static sites user roles invitation link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11893,9 +15165,9 @@ class StaticSiteUserInvitationResponseResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar expires_on: The expiration time of the invitation - :vartype expires_on: datetime - :ivar invitation_url: The url for the invitation link + :ivar expires_on: The expiration time of the invitation. + :vartype expires_on: ~datetime.datetime + :ivar invitation_url: The url for the invitation link. :vartype invitation_url: str """ @@ -11916,13 +15188,18 @@ class StaticSiteUserInvitationResponseResource(ProxyOnlyResource): 'invitation_url': {'key': 'properties.invitationUrl', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(StaticSiteUserInvitationResponseResource, self).__init__(kind=kind, **kwargs) self.expires_on = None self.invitation_url = None -class StatusCodesBasedTrigger(Model): +class StatusCodesBasedTrigger(msrest.serialization.Model): """Trigger based on status code. :param status: HTTP status code. @@ -11945,7 +15222,16 @@ class StatusCodesBasedTrigger(Model): 'time_interval': {'key': 'timeInterval', 'type': 'str'}, } - def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int=None, count: int=None, time_interval: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[int] = None, + sub_status: Optional[int] = None, + win32_status: Optional[int] = None, + count: Optional[int] = None, + time_interval: Optional[str] = None, + **kwargs + ): super(StatusCodesBasedTrigger, self).__init__(**kwargs) self.status = status self.sub_status = sub_status @@ -11957,10 +15243,7 @@ def __init__(self, *, status: int=None, sub_status: int=None, win32_status: int= class StorageMigrationOptions(ProxyOnlyResource): """Options for app content migration. - 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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -11970,17 +15253,15 @@ class StorageMigrationOptions(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param azurefiles_connection_string: Required. AzureFiles connection - string. + :param azurefiles_connection_string: AzureFiles connection string. :type azurefiles_connection_string: str - :param azurefiles_share: Required. AzureFiles share. + :param azurefiles_share: AzureFiles share. :type azurefiles_share: str - :param switch_site_after_migration: trueif the app should be - switched over; otherwise, false. Default value: False . + :param switch_site_after_migration: :code:`true`if the app should be switched + over; otherwise, :code:`false`. :type switch_site_after_migration: bool - :param block_write_access_to_site: true if the app should be - read only during copy operation; otherwise, false. Default - value: False . + :param block_write_access_to_site: :code:`true` if the app should be read only + during copy operation; otherwise, :code:`false`. :type block_write_access_to_site: bool """ @@ -11988,8 +15269,6 @@ class StorageMigrationOptions(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'azurefiles_connection_string': {'required': True}, - 'azurefiles_share': {'required': True}, } _attribute_map = { @@ -12003,7 +15282,16 @@ class StorageMigrationOptions(ProxyOnlyResource): 'block_write_access_to_site': {'key': 'properties.blockWriteAccessToSite', 'type': 'bool'}, } - def __init__(self, *, azurefiles_connection_string: str, azurefiles_share: str, kind: str=None, switch_site_after_migration: bool=False, block_write_access_to_site: bool=False, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + azurefiles_connection_string: Optional[str] = None, + azurefiles_share: Optional[str] = None, + switch_site_after_migration: Optional[bool] = False, + block_write_access_to_site: Optional[bool] = False, + **kwargs + ): super(StorageMigrationOptions, self).__init__(kind=kind, **kwargs) self.azurefiles_connection_string = azurefiles_connection_string self.azurefiles_share = azurefiles_share @@ -12014,8 +15302,7 @@ def __init__(self, *, azurefiles_connection_string: str, azurefiles_share: str, class StorageMigrationResponse(ProxyOnlyResource): """Response for a migration of app content request. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12025,8 +15312,8 @@ class StorageMigrationResponse(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :ivar operation_id: When server starts the migration process, it will - return an operation ID identifying that particular migration operation. + :ivar operation_id: When server starts the migration process, it will return an operation ID + identifying that particular migration operation. :vartype operation_id: str """ @@ -12045,7 +15332,12 @@ class StorageMigrationResponse(ProxyOnlyResource): 'operation_id': {'key': 'properties.operationId', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(StorageMigrationResponse, self).__init__(kind=kind, **kwargs) self.operation_id = None @@ -12053,8 +15345,7 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: class StringDictionary(ProxyOnlyResource): """String dictionary resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12082,17 +15373,21 @@ class StringDictionary(ProxyOnlyResource): 'properties': {'key': 'properties', 'type': '{str}'}, } - def __init__(self, *, kind: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): super(StringDictionary, self).__init__(kind=kind, **kwargs) self.properties = properties class SwiftVirtualNetwork(ProxyOnlyResource): - """Swift Virtual Network Contract. This is used to enable the new Swift way of - doing virtual network integration. + """Swift Virtual Network Contract. This is used to enable the new Swift way of doing virtual network integration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12102,12 +15397,12 @@ class SwiftVirtualNetwork(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param subnet_resource_id: The Virtual Network subnet's resource ID. This - is the subnet that this Web App will join. This subnet must have a - delegation to Microsoft.Web/serverFarms defined first. + :param subnet_resource_id: The Virtual Network subnet's resource ID. This is the subnet that + this Web App will join. This subnet must have a delegation to Microsoft.Web/serverFarms defined + first. :type subnet_resource_id: str - :param swift_supported: A flag that specifies if the scale unit this Web - App is on supports Swift integration. + :param swift_supported: A flag that specifies if the scale unit this Web App is on supports + Swift integration. :type swift_supported: bool """ @@ -12126,13 +15421,20 @@ class SwiftVirtualNetwork(ProxyOnlyResource): 'swift_supported': {'key': 'properties.swiftSupported', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, subnet_resource_id: str=None, swift_supported: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + subnet_resource_id: Optional[str] = None, + swift_supported: Optional[bool] = None, + **kwargs + ): super(SwiftVirtualNetwork, self).__init__(kind=kind, **kwargs) self.subnet_resource_id = subnet_resource_id self.swift_supported = swift_supported -class TldLegalAgreement(Model): +class TldLegalAgreement(msrest.serialization.Model): """Legal agreement for a top level domain. All required parameters must be populated in order to send to Azure. @@ -12160,7 +15462,15 @@ class TldLegalAgreement(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, agreement_key: str, title: str, content: str, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + agreement_key: str, + title: str, + content: str, + url: Optional[str] = None, + **kwargs + ): super(TldLegalAgreement, self).__init__(**kwargs) self.agreement_key = agreement_key self.title = title @@ -12168,11 +15478,44 @@ def __init__(self, *, agreement_key: str, title: str, content: str, url: str=Non self.url = url +class TldLegalAgreementCollection(msrest.serialization.Model): + """Collection of top-level domain legal agreements. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TldLegalAgreement] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TldLegalAgreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TldLegalAgreement"], + **kwargs + ): + super(TldLegalAgreementCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TopLevelDomain(ProxyOnlyResource): """A top level domain object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12182,8 +15525,8 @@ class TopLevelDomain(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param privacy: If true, then the top level domain supports - domain privacy; otherwise, false. + :param privacy: If :code:`true`, then the top level domain supports domain + privacy; otherwise, :code:`false`. :type privacy: bool """ @@ -12201,21 +15544,25 @@ class TopLevelDomain(ProxyOnlyResource): 'privacy': {'key': 'properties.privacy', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, privacy: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + privacy: Optional[bool] = None, + **kwargs + ): super(TopLevelDomain, self).__init__(kind=kind, **kwargs) self.privacy = privacy -class TopLevelDomainAgreementOption(Model): +class TopLevelDomainAgreementOption(msrest.serialization.Model): """Options for retrieving the list of top level domain legal agreements. - :param include_privacy: If true, then the list of agreements - will include agreements for domain privacy as well; otherwise, - false. + :param include_privacy: If :code:`true`, then the list of agreements will include + agreements for domain privacy as well; otherwise, :code:`false`. :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. + :param for_transfer: If :code:`true`, then the list of agreements will include + agreements for domain transfer as well; otherwise, :code:`false`. :type for_transfer: bool """ @@ -12224,18 +15571,56 @@ class TopLevelDomainAgreementOption(Model): 'for_transfer': {'key': 'forTransfer', 'type': 'bool'}, } - def __init__(self, *, include_privacy: bool=None, for_transfer: bool=None, **kwargs) -> None: + def __init__( + self, + *, + include_privacy: Optional[bool] = None, + for_transfer: Optional[bool] = None, + **kwargs + ): super(TopLevelDomainAgreementOption, self).__init__(**kwargs) self.include_privacy = include_privacy self.for_transfer = for_transfer +class TopLevelDomainCollection(msrest.serialization.Model): + """Collection of Top-level domains. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TopLevelDomain] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopLevelDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TopLevelDomain"], + **kwargs + ): + super(TopLevelDomainCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TriggeredJobHistory(ProxyOnlyResource): - """Triggered Web Job History. List of Triggered Web Job Run Information - elements. + """Triggered Web Job History. List of Triggered Web Job Run Information elements. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12263,16 +15648,55 @@ class TriggeredJobHistory(ProxyOnlyResource): 'runs': {'key': 'properties.runs', 'type': '[TriggeredJobRun]'}, } - def __init__(self, *, kind: str=None, runs=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + runs: Optional[List["TriggeredJobRun"]] = None, + **kwargs + ): super(TriggeredJobHistory, self).__init__(kind=kind, **kwargs) self.runs = runs +class TriggeredJobHistoryCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredJobHistory]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TriggeredJobHistory"], + **kwargs + ): + super(TriggeredJobHistoryCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class TriggeredJobRun(ProxyOnlyResource): """Triggered Web Job Run Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12286,14 +15710,12 @@ class TriggeredJobRun(ProxyOnlyResource): :type web_job_id: str :param web_job_name: Job name. :type web_job_name: str - :param status: Job status. Possible values include: 'Success', 'Failed', - 'Error' - :type status: str or - ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobStatus + :param status: Job status. Possible values include: "Success", "Failed", "Error". + :type status: str or ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobStatus :param start_time: Start time. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: End time. - :type end_time: datetime + :type end_time: ~datetime.datetime :param duration: Job duration. :type duration: str :param output_url: Output URL. @@ -12321,7 +15743,7 @@ class TriggeredJobRun(ProxyOnlyResource): 'type': {'key': 'type', 'type': 'str'}, 'web_job_id': {'key': 'properties.web_job_id', 'type': 'str'}, 'web_job_name': {'key': 'properties.web_job_name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TriggeredWebJobStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'start_time': {'key': 'properties.start_time', 'type': 'iso-8601'}, 'end_time': {'key': 'properties.end_time', 'type': 'iso-8601'}, 'duration': {'key': 'properties.duration', 'type': 'str'}, @@ -12332,7 +15754,23 @@ class TriggeredJobRun(ProxyOnlyResource): 'trigger': {'key': 'properties.trigger', 'type': 'str'}, } - def __init__(self, *, kind: str=None, web_job_id: str=None, web_job_name: str=None, status=None, start_time=None, end_time=None, duration: str=None, output_url: str=None, error_url: str=None, url: str=None, job_name: str=None, trigger: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + web_job_id: Optional[str] = None, + web_job_name: Optional[str] = None, + status: Optional[Union[str, "TriggeredWebJobStatus"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + duration: Optional[str] = None, + output_url: Optional[str] = None, + error_url: Optional[str] = None, + url: Optional[str] = None, + job_name: Optional[str] = None, + trigger: Optional[str] = None, + **kwargs + ): super(TriggeredJobRun, self).__init__(kind=kind, **kwargs) self.web_job_id = web_job_id self.web_job_name = web_job_name @@ -12350,8 +15788,7 @@ def __init__(self, *, kind: str=None, web_job_id: str=None, web_job_name: str=No class TriggeredWebJob(ProxyOnlyResource): """Triggered Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12373,12 +15810,11 @@ class TriggeredWebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2019_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -12401,13 +15837,28 @@ class TriggeredWebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, latest_run=None, history_url: str=None, scheduler_logs_url: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, web_job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + latest_run: Optional["TriggeredJobRun"] = None, + history_url: Optional[str] = None, + scheduler_logs_url: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + web_job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(TriggeredWebJob, self).__init__(kind=kind, **kwargs) self.latest_run = latest_run self.history_url = history_url @@ -12421,11 +15872,44 @@ def __init__(self, *, kind: str=None, latest_run=None, history_url: str=None, sc self.settings = settings +class TriggeredWebJobCollection(msrest.serialization.Model): + """Collection of Kudu continuous web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TriggeredWebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TriggeredWebJob"], + **kwargs + ): + super(TriggeredWebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class Usage(ProxyOnlyResource): """Usage of the quota resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12446,11 +15930,10 @@ class Usage(ProxyOnlyResource): :ivar limit: The resource limit. :vartype limit: long :ivar next_reset_time: Next reset time for the resource counter. - :vartype next_reset_time: datetime - :ivar compute_mode: Compute mode used for this usage. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :vartype compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :vartype next_reset_time: ~datetime.datetime + :ivar compute_mode: Compute mode used for this usage. Possible values include: "Shared", + "Dedicated", "Dynamic". + :vartype compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions :ivar site_mode: Site mode used for this usage. :vartype site_mode: str """ @@ -12480,11 +15963,16 @@ class Usage(ProxyOnlyResource): 'current_value': {'key': 'properties.currentValue', 'type': 'long'}, 'limit': {'key': 'properties.limit', 'type': 'long'}, 'next_reset_time': {'key': 'properties.nextResetTime', 'type': 'iso-8601'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'site_mode': {'key': 'properties.siteMode', 'type': 'str'}, } - def __init__(self, *, kind: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + **kwargs + ): super(Usage, self).__init__(kind=kind, **kwargs) self.display_name = None self.resource_name = None @@ -12496,14 +15984,45 @@ def __init__(self, *, kind: str=None, **kwargs) -> None: self.site_mode = None -class User(ProxyOnlyResource): - """User credentials used for publishing activity. +class UsageCollection(msrest.serialization.Model): + """Collection of usages. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.Usage] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Usage"], + **kwargs + ): + super(UsageCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class User(ProxyOnlyResource): + """User credentials used for publishing activity. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. :vartype id: str :ivar name: Resource Name. @@ -12512,14 +16031,13 @@ class User(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param publishing_user_name: Required. Username used for publishing. + :param publishing_user_name: Username used for publishing. :type publishing_user_name: str :param publishing_password: Password used for publishing. :type publishing_password: str :param publishing_password_hash: Password hash used for publishing. :type publishing_password_hash: str - :param publishing_password_hash_salt: Password hash salt used for - publishing. + :param publishing_password_hash_salt: Password hash salt used for publishing. :type publishing_password_hash_salt: str :param scm_uri: Url of SCM site. :type scm_uri: str @@ -12529,7 +16047,6 @@ class User(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_user_name': {'required': True}, } _attribute_map = { @@ -12544,7 +16061,17 @@ class User(ProxyOnlyResource): 'scm_uri': {'key': 'properties.scmUri', 'type': 'str'}, } - def __init__(self, *, publishing_user_name: str, kind: str=None, publishing_password: str=None, publishing_password_hash: str=None, publishing_password_hash_salt: str=None, scm_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + publishing_user_name: Optional[str] = None, + publishing_password: Optional[str] = None, + publishing_password_hash: Optional[str] = None, + publishing_password_hash_salt: Optional[str] = None, + scm_uri: Optional[str] = None, + **kwargs + ): super(User, self).__init__(kind=kind, **kwargs) self.publishing_user_name = publishing_user_name self.publishing_password = publishing_password @@ -12553,51 +16080,47 @@ def __init__(self, *, publishing_user_name: str, kind: str=None, publishing_pass self.scm_uri = scm_uri -class ValidateRequest(Model): +class ValidateRequest(msrest.serialization.Model): """Resource validation request content. All required parameters must be populated in order to send to Azure. :param name: Required. Resource name to verify. :type name: str - :param type: Required. Resource type used for verification. Possible - values include: 'ServerFarm', 'Site' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.ValidateResourceTypes + :param type: Required. Resource type used for verification. Possible values include: + "ServerFarm", "Site". + :type type: str or ~azure.mgmt.web.v2019_08_01.models.ValidateResourceTypes :param location: Required. Expected location of the resource. :type location: str - :param server_farm_id: ARM resource ID of an App Service plan that would - host the app. + :param server_farm_id: ARM resource ID of an App Service plan that would host the app. :type server_farm_id: str :param sku_name: Name of the target SKU for the App Service plan. :type sku_name: str - :param need_linux_workers: true if App Service plan is for - Linux workers; otherwise, false. + :param need_linux_workers: :code:`true` if App Service plan is for Linux workers; + otherwise, :code:`false`. :type need_linux_workers: bool - :param is_spot: true if App Service plan is for Spot - instances; otherwise, false. + :param is_spot: :code:`true` if App Service plan is for Spot instances; otherwise, + :code:`false`. :type is_spot: bool :param capacity: Target capacity of the App Service plan (number of VMs). :type capacity: int - :param hosting_environment: Name of App Service Environment where app or - App Service plan should be created. + :param hosting_environment: Name of App Service Environment where app or App Service plan + should be created. :type hosting_environment: str - :param is_xenon: true if App Service plan is running as a - windows container + :param is_xenon: :code:`true` if App Service plan is running as a windows + container. :type is_xenon: bool - :param container_registry_base_url: Base URL of the container registry + :param container_registry_base_url: Base URL of the container registry. :type container_registry_base_url: str - :param container_registry_username: Username for to access the container - registry + :param container_registry_username: Username for to access the container registry. :type container_registry_username: str - :param container_registry_password: Password for to access the container - registry + :param container_registry_password: Password for to access the container registry. :type container_registry_password: str - :param container_image_repository: Repository name (image name) + :param container_image_repository: Repository name (image name). :type container_image_repository: str - :param container_image_tag: Image tag + :param container_image_tag: Image tag. :type container_image_tag: str - :param container_image_platform: Platform (windows or linux) + :param container_image_platform: Platform (windows or linux). :type container_image_platform: str """ @@ -12627,7 +16150,27 @@ class ValidateRequest(Model): 'container_image_platform': {'key': 'properties.containerImagePlatform', 'type': 'str'}, } - def __init__(self, *, name: str, type, location: str, server_farm_id: str=None, sku_name: str=None, need_linux_workers: bool=None, is_spot: bool=None, capacity: int=None, hosting_environment: str=None, is_xenon: bool=None, container_registry_base_url: str=None, container_registry_username: str=None, container_registry_password: str=None, container_image_repository: str=None, container_image_tag: str=None, container_image_platform: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + type: Union[str, "ValidateResourceTypes"], + location: str, + server_farm_id: Optional[str] = None, + sku_name: Optional[str] = None, + need_linux_workers: Optional[bool] = None, + is_spot: Optional[bool] = None, + capacity: Optional[int] = None, + hosting_environment: Optional[str] = None, + is_xenon: Optional[bool] = None, + container_registry_base_url: Optional[str] = None, + container_registry_username: Optional[str] = None, + container_registry_password: Optional[str] = None, + container_image_repository: Optional[str] = None, + container_image_tag: Optional[str] = None, + container_image_platform: Optional[str] = None, + **kwargs + ): super(ValidateRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -12647,7 +16190,7 @@ def __init__(self, *, name: str, type, location: str, server_farm_id: str=None, self.container_image_platform = container_image_platform -class ValidateResponse(Model): +class ValidateResponse(msrest.serialization.Model): """Describes the result of resource validation. :param status: Result of validation. @@ -12661,13 +16204,19 @@ class ValidateResponse(Model): 'error': {'key': 'error', 'type': 'ValidateResponseError'}, } - def __init__(self, *, status: str=None, error=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ValidateResponseError"] = None, + **kwargs + ): super(ValidateResponse, self).__init__(**kwargs) self.status = status self.error = error -class ValidateResponseError(Model): +class ValidateResponseError(msrest.serialization.Model): """Error details for when validation fails. :param code: Validation error code. @@ -12681,25 +16230,30 @@ class ValidateResponseError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(ValidateResponseError, self).__init__(**kwargs) self.code = code self.message = message -class VirtualApplication(Model): +class VirtualApplication(msrest.serialization.Model): """Virtual application in an app. :param virtual_path: Virtual path. :type virtual_path: str :param physical_path: Physical path. :type physical_path: str - :param preload_enabled: true if preloading is enabled; - otherwise, false. + :param preload_enabled: :code:`true` if preloading is enabled; otherwise, + :code:`false`. :type preload_enabled: bool :param virtual_directories: Virtual directories for virtual application. - :type virtual_directories: - list[~azure.mgmt.web.v2019_08_01.models.VirtualDirectory] + :type virtual_directories: list[~azure.mgmt.web.v2019_08_01.models.VirtualDirectory] """ _attribute_map = { @@ -12709,7 +16263,15 @@ class VirtualApplication(Model): 'virtual_directories': {'key': 'virtualDirectories', 'type': '[VirtualDirectory]'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_enabled: bool=None, virtual_directories=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + preload_enabled: Optional[bool] = None, + virtual_directories: Optional[List["VirtualDirectory"]] = None, + **kwargs + ): super(VirtualApplication, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path @@ -12717,7 +16279,7 @@ def __init__(self, *, virtual_path: str=None, physical_path: str=None, preload_e self.virtual_directories = virtual_directories -class VirtualDirectory(Model): +class VirtualDirectory(msrest.serialization.Model): """Directory for virtual application. :param virtual_path: Path to virtual application. @@ -12731,13 +16293,19 @@ class VirtualDirectory(Model): 'physical_path': {'key': 'physicalPath', 'type': 'str'}, } - def __init__(self, *, virtual_path: str=None, physical_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_path: Optional[str] = None, + physical_path: Optional[str] = None, + **kwargs + ): super(VirtualDirectory, self).__init__(**kwargs) self.virtual_path = virtual_path self.physical_path = physical_path -class VirtualIPMapping(Model): +class VirtualIPMapping(msrest.serialization.Model): """Virtual IP mapping. :param virtual_ip: Virtual IP address. @@ -12748,7 +16316,7 @@ class VirtualIPMapping(Model): :type internal_https_port: int :param in_use: Is virtual IP mapping in use. :type in_use: bool - :param service_name: name of the service that virtual IP is assigned to + :param service_name: name of the service that virtual IP is assigned to. :type service_name: str """ @@ -12760,7 +16328,16 @@ class VirtualIPMapping(Model): 'service_name': {'key': 'serviceName', 'type': 'str'}, } - def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, internal_https_port: int=None, in_use: bool=None, service_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + virtual_ip: Optional[str] = None, + internal_http_port: Optional[int] = None, + internal_https_port: Optional[int] = None, + in_use: Optional[bool] = None, + service_name: Optional[str] = None, + **kwargs + ): super(VirtualIPMapping, self).__init__(**kwargs) self.virtual_ip = virtual_ip self.internal_http_port = internal_http_port @@ -12769,11 +16346,10 @@ def __init__(self, *, virtual_ip: str=None, internal_http_port: int=None, intern self.service_name = service_name -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Specification for using a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str @@ -12797,7 +16373,13 @@ class VirtualNetworkProfile(Model): 'subnet': {'key': 'subnet', 'type': 'str'}, } - def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + subnet: Optional[str] = None, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = id self.name = None @@ -12806,13 +16388,9 @@ def __init__(self, *, id: str=None, subnet: str=None, **kwargs) -> None: class VnetGateway(ProxyOnlyResource): - """The Virtual Network gateway contract. This is used to give the Virtual - Network gateway access to the VPN package. - - Variables are only populated by the server, and will be ignored when - sending a request. + """The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12824,8 +16402,7 @@ class VnetGateway(ProxyOnlyResource): :vartype type: str :param vnet_name: The Virtual Network name. :type vnet_name: str - :param vpn_package_uri: Required. The URI where the VPN package can be - downloaded. + :param vpn_package_uri: The URI where the VPN package can be downloaded. :type vpn_package_uri: str """ @@ -12833,7 +16410,6 @@ class VnetGateway(ProxyOnlyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'vpn_package_uri': {'required': True}, } _attribute_map = { @@ -12845,7 +16421,14 @@ class VnetGateway(ProxyOnlyResource): 'vpn_package_uri': {'key': 'properties.vpnPackageUri', 'type': 'str'}, } - def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_name: Optional[str] = None, + vpn_package_uri: Optional[str] = None, + **kwargs + ): super(VnetGateway, self).__init__(kind=kind, **kwargs) self.vnet_name = vnet_name self.vpn_package_uri = vpn_package_uri @@ -12854,8 +16437,7 @@ def __init__(self, *, vpn_package_uri: str, kind: str=None, vnet_name: str=None, class VnetInfo(ProxyOnlyResource): """Virtual Network information contract. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12869,19 +16451,19 @@ class VnetInfo(ProxyOnlyResource): :type vnet_resource_id: str :ivar cert_thumbprint: The client certificate thumbprint. :vartype cert_thumbprint: str - :param cert_blob: A certificate file (.cer) blob containing the public key - of the private key used to authenticate a + :param cert_blob: A certificate file (.cer) blob containing the public key of the private key + used to authenticate a Point-To-Site VPN connection. :type cert_blob: str :ivar routes: The routes that this Virtual Network connection uses. :vartype routes: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] - :ivar resync_required: true if a resync is required; - otherwise, false. + :ivar resync_required: :code:`true` if a resync is required; otherwise, + :code:`false`. :vartype resync_required: bool - :param dns_servers: DNS servers to be used by this Virtual Network. This - should be a comma-separated list of IP addresses. + :param dns_servers: DNS servers to be used by this Virtual Network. This should be a comma- + separated list of IP addresses. :type dns_servers: str - :param is_swift: Flag that is used to denote if this is VNET injection + :param is_swift: Flag that is used to denote if this is VNET injection. :type is_swift: bool """ @@ -12908,7 +16490,16 @@ class VnetInfo(ProxyOnlyResource): 'is_swift': {'key': 'properties.isSwift', 'type': 'bool'}, } - def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: str=None, dns_servers: str=None, is_swift: bool=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_id: Optional[str] = None, + cert_blob: Optional[str] = None, + dns_servers: Optional[str] = None, + is_swift: Optional[bool] = None, + **kwargs + ): super(VnetInfo, self).__init__(kind=kind, **kwargs) self.vnet_resource_id = vnet_resource_id self.cert_thumbprint = None @@ -12922,8 +16513,7 @@ def __init__(self, *, kind: str=None, vnet_resource_id: str=None, cert_blob: str class VnetParameters(ProxyOnlyResource): """The required set of inputs to validate a VNET. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12933,11 +16523,11 @@ class VnetParameters(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param vnet_resource_group: The Resource Group of the VNET to be validated + :param vnet_resource_group: The Resource Group of the VNET to be validated. :type vnet_resource_group: str - :param vnet_name: The name of the VNET to be validated + :param vnet_name: The name of the VNET to be validated. :type vnet_name: str - :param vnet_subnet_name: The subnet name to be validated + :param vnet_subnet_name: The subnet name to be validated. :type vnet_subnet_name: str """ @@ -12957,7 +16547,15 @@ class VnetParameters(ProxyOnlyResource): 'vnet_subnet_name': {'key': 'properties.vnetSubnetName', 'type': 'str'}, } - def __init__(self, *, kind: str=None, vnet_resource_group: str=None, vnet_name: str=None, vnet_subnet_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + vnet_resource_group: Optional[str] = None, + vnet_name: Optional[str] = None, + vnet_subnet_name: Optional[str] = None, + **kwargs + ): super(VnetParameters, self).__init__(kind=kind, **kwargs) self.vnet_resource_group = vnet_resource_group self.vnet_name = vnet_name @@ -12965,11 +16563,9 @@ def __init__(self, *, kind: str=None, vnet_resource_group: str=None, vnet_name: class VnetRoute(ProxyOnlyResource): - """Virtual Network route contract used to pass routing information for a - Virtual Network. + """Virtual Network route contract used to pass routing information for a Virtual Network. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -12979,20 +16575,19 @@ class VnetRoute(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param start_address: The starting address for this route. This may also - include a CIDR notation, in which case the end address must not be - specified. + :param start_address: The starting address for this route. This may also include a CIDR + notation, in which case the end address must not be specified. :type start_address: str - :param end_address: The ending address for this route. If the start - address is specified in CIDR notation, this must be omitted. + :param end_address: The ending address for this route. If the start address is specified in + CIDR notation, this must be omitted. :type end_address: str :param route_type: The type of route this is: - DEFAULT - By default, every app has routes to the local address ranges - specified by RFC1918 + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only - These values will be used for syncing an app's routes with those from a - Virtual Network. Possible values include: 'DEFAULT', 'INHERITED', 'STATIC' + + These values will be used for syncing an app's routes with those from a Virtual Network. + Possible values include: "DEFAULT", "INHERITED", "STATIC". :type route_type: str or ~azure.mgmt.web.v2019_08_01.models.RouteType """ @@ -13012,7 +16607,15 @@ class VnetRoute(ProxyOnlyResource): 'route_type': {'key': 'properties.routeType', 'type': 'str'}, } - def __init__(self, *, kind: str=None, start_address: str=None, end_address: str=None, route_type=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + start_address: Optional[str] = None, + end_address: Optional[str] = None, + route_type: Optional[Union[str, "RouteType"]] = None, + **kwargs + ): super(VnetRoute, self).__init__(kind=kind, **kwargs) self.start_address = start_address self.end_address = end_address @@ -13022,8 +16625,7 @@ def __init__(self, *, kind: str=None, start_address: str=None, end_address: str= class VnetValidationFailureDetails(ProxyOnlyResource): """A class that describes the reason for a validation failure. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13036,8 +16638,7 @@ class VnetValidationFailureDetails(ProxyOnlyResource): :param failed: A flag describing whether or not validation failed. :type failed: bool :param failed_tests: A list of tests that failed in the validation. - :type failed_tests: - list[~azure.mgmt.web.v2019_08_01.models.VnetValidationTestFailure] + :type failed_tests: list[~azure.mgmt.web.v2019_08_01.models.VnetValidationTestFailure] """ _validation = { @@ -13055,7 +16656,14 @@ class VnetValidationFailureDetails(ProxyOnlyResource): 'failed_tests': {'key': 'properties.failedTests', 'type': '[VnetValidationTestFailure]'}, } - def __init__(self, *, kind: str=None, failed: bool=None, failed_tests=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + failed: Optional[bool] = None, + failed_tests: Optional[List["VnetValidationTestFailure"]] = None, + **kwargs + ): super(VnetValidationFailureDetails, self).__init__(kind=kind, **kwargs) self.failed = failed self.failed_tests = failed_tests @@ -13064,8 +16672,7 @@ def __init__(self, *, kind: str=None, failed: bool=None, failed_tests=None, **kw class VnetValidationTestFailure(ProxyOnlyResource): """A class that describes a test that failed during NSG and UDR validation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13077,8 +16684,7 @@ class VnetValidationTestFailure(ProxyOnlyResource): :vartype type: str :param test_name: The name of the test that failed. :type test_name: str - :param details: The details of what caused the failure, e.g. the blocking - rule name, etc. + :param details: The details of what caused the failure, e.g. the blocking rule name, etc. :type details: str """ @@ -13097,17 +16703,23 @@ class VnetValidationTestFailure(ProxyOnlyResource): 'details': {'key': 'properties.details', 'type': 'str'}, } - def __init__(self, *, kind: str=None, test_name: str=None, details: str=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + test_name: Optional[str] = None, + details: Optional[str] = None, + **kwargs + ): super(VnetValidationTestFailure, self).__init__(kind=kind, **kwargs) self.test_name = test_name self.details = details -class WebAppCollection(Model): +class WebAppCollection(msrest.serialization.Model): """Collection of App Service apps. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. @@ -13127,17 +16739,55 @@ class WebAppCollection(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["Site"], + **kwargs + ): super(WebAppCollection, self).__init__(**kwargs) self.value = value self.next_link = None +class WebAppInstanceCollection(msrest.serialization.Model): + """Collection of app instances. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.SiteInstance] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SiteInstance"], + **kwargs + ): + super(WebAppInstanceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WebJob(ProxyOnlyResource): """Web Job Information. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13153,12 +16803,11 @@ class WebJob(ProxyOnlyResource): :type url: str :param extra_info_url: Extra Info URL. :type extra_info_url: str - :param web_job_type: Job type. Possible values include: 'Continuous', - 'Triggered' + :param web_job_type: Job type. Possible values include: "Continuous", "Triggered". :type web_job_type: str or ~azure.mgmt.web.v2019_08_01.models.WebJobType :param error: Error information. :type error: str - :param using_sdk: Using SDK? + :param using_sdk: Using SDK?. :type using_sdk: bool :param settings: Job settings. :type settings: dict[str, object] @@ -13178,13 +16827,25 @@ class WebJob(ProxyOnlyResource): 'run_command': {'key': 'properties.run_command', 'type': 'str'}, 'url': {'key': 'properties.url', 'type': 'str'}, 'extra_info_url': {'key': 'properties.extra_info_url', 'type': 'str'}, - 'web_job_type': {'key': 'properties.web_job_type', 'type': 'WebJobType'}, + 'web_job_type': {'key': 'properties.web_job_type', 'type': 'str'}, 'error': {'key': 'properties.error', 'type': 'str'}, 'using_sdk': {'key': 'properties.using_sdk', 'type': 'bool'}, 'settings': {'key': 'properties.settings', 'type': '{object}'}, } - def __init__(self, *, kind: str=None, run_command: str=None, url: str=None, extra_info_url: str=None, web_job_type=None, error: str=None, using_sdk: bool=None, settings=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + run_command: Optional[str] = None, + url: Optional[str] = None, + extra_info_url: Optional[str] = None, + web_job_type: Optional[Union[str, "WebJobType"]] = None, + error: Optional[str] = None, + using_sdk: Optional[bool] = None, + settings: Optional[Dict[str, object]] = None, + **kwargs + ): super(WebJob, self).__init__(kind=kind, **kwargs) self.run_command = run_command self.url = url @@ -13195,11 +16856,44 @@ def __init__(self, *, kind: str=None, run_command: str=None, url: str=None, extr self.settings = settings +class WebJobCollection(msrest.serialization.Model): + """Collection of Kudu web job information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.WebJob] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebJob]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["WebJob"], + **kwargs + ): + super(WebJobCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WebSiteInstanceStatus(ProxyOnlyResource): """WebSiteInstanceStatus. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13209,17 +16903,16 @@ class WebSiteInstanceStatus(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str - :param state: Possible values include: 'READY', 'STOPPED', 'UNKNOWN' + :param state: Possible values include: "READY", "STOPPED", "UNKNOWN". :type state: str or ~azure.mgmt.web.v2019_08_01.models.SiteRuntimeState - :param status_url: Link to the GetStatusApi in Kudu + :param status_url: Link to the GetStatusApi in Kudu. :type status_url: str - :param detector_url: Link to the Diagnose and Solve Portal + :param detector_url: Link to the Diagnose and Solve Portal. :type detector_url: str - :param console_url: Link to the Diagnose and Solve Portal + :param console_url: Link to the Diagnose and Solve Portal. :type console_url: str - :param containers: - :type containers: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ContainerInfo] + :param containers: Dictionary of :code:``. + :type containers: dict[str, ~azure.mgmt.web.v2019_08_01.models.ContainerInfo] """ _validation = { @@ -13233,14 +16926,24 @@ class WebSiteInstanceStatus(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'SiteRuntimeState'}, + 'state': {'key': 'properties.state', 'type': 'str'}, 'status_url': {'key': 'properties.statusUrl', 'type': 'str'}, 'detector_url': {'key': 'properties.detectorUrl', 'type': 'str'}, 'console_url': {'key': 'properties.consoleUrl', 'type': 'str'}, 'containers': {'key': 'properties.containers', 'type': '{ContainerInfo}'}, } - def __init__(self, *, kind: str=None, state=None, status_url: str=None, detector_url: str=None, console_url: str=None, containers=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + state: Optional[Union[str, "SiteRuntimeState"]] = None, + status_url: Optional[str] = None, + detector_url: Optional[str] = None, + console_url: Optional[str] = None, + containers: Optional[Dict[str, "ContainerInfo"]] = None, + **kwargs + ): super(WebSiteInstanceStatus, self).__init__(kind=kind, **kwargs) self.state = state self.status_url = status_url @@ -13249,24 +16952,21 @@ def __init__(self, *, kind: str=None, state=None, status_url: str=None, detector self.containers = containers -class WorkerPool(Model): +class WorkerPool(msrest.serialization.Model): """Worker pool of an App Service Environment. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] """ @@ -13276,13 +16976,21 @@ class WorkerPool(Model): _attribute_map = { 'worker_size_id': {'key': 'workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'computeMode', 'type': 'str'}, 'worker_size': {'key': 'workerSize', 'type': 'str'}, 'worker_count': {'key': 'workerCount', 'type': 'int'}, 'instance_names': {'key': 'instanceNames', 'type': '[str]'}, } - def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPool, self).__init__(**kwargs) self.worker_size_id = worker_size_id self.compute_mode = compute_mode @@ -13291,11 +16999,44 @@ def __init__(self, *, worker_size_id: int=None, compute_mode=None, worker_size: self.instance_names = None +class WorkerPoolCollection(msrest.serialization.Model): + """Collection of worker pools. + + 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. + + :param value: Required. Collection of resources. + :type value: list[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkerPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["WorkerPoolResource"], + **kwargs + ): + super(WorkerPoolCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class WorkerPoolResource(ProxyOnlyResource): """Worker pool of an App Service Environment ARM resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str @@ -13305,21 +17046,19 @@ class WorkerPoolResource(ProxyOnlyResource): :type kind: str :ivar type: Resource type. :vartype type: str + :param sku: Description of a SKU for a scalable resource. + :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription :param worker_size_id: Worker size ID for referencing this worker pool. :type worker_size_id: int - :param compute_mode: Shared or dedicated app hosting. Possible values - include: 'Shared', 'Dedicated', 'Dynamic' - :type compute_mode: str or - ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions + :param compute_mode: Shared or dedicated app hosting. Possible values include: "Shared", + "Dedicated", "Dynamic". + :type compute_mode: str or ~azure.mgmt.web.v2019_08_01.models.ComputeModeOptions :param worker_size: VM size of the worker pool instances. :type worker_size: str :param worker_count: Number of instances in the worker pool. :type worker_count: int - :ivar instance_names: Names of all instances in the worker pool (read - only). + :ivar instance_names: Names of all instances in the worker pool (read only). :vartype instance_names: list[str] - :param sku: - :type sku: ~azure.mgmt.web.v2019_08_01.models.SkuDescription """ _validation = { @@ -13334,19 +17073,29 @@ class WorkerPoolResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuDescription'}, 'worker_size_id': {'key': 'properties.workerSizeId', 'type': 'int'}, - 'compute_mode': {'key': 'properties.computeMode', 'type': 'ComputeModeOptions'}, + 'compute_mode': {'key': 'properties.computeMode', 'type': 'str'}, 'worker_size': {'key': 'properties.workerSize', 'type': 'str'}, 'worker_count': {'key': 'properties.workerCount', 'type': 'int'}, 'instance_names': {'key': 'properties.instanceNames', 'type': '[str]'}, - 'sku': {'key': 'sku', 'type': 'SkuDescription'}, } - def __init__(self, *, kind: str=None, worker_size_id: int=None, compute_mode=None, worker_size: str=None, worker_count: int=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + kind: Optional[str] = None, + sku: Optional["SkuDescription"] = None, + worker_size_id: Optional[int] = None, + compute_mode: Optional[Union[str, "ComputeModeOptions"]] = None, + worker_size: Optional[str] = None, + worker_count: Optional[int] = None, + **kwargs + ): super(WorkerPoolResource, self).__init__(kind=kind, **kwargs) + self.sku = sku self.worker_size_id = worker_size_id self.compute_mode = compute_mode self.worker_size = worker_size self.worker_count = worker_count self.instance_names = None - self.sku = sku diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_web_site_management_client_enums.py index 2a5be291a7d8..9807475efeca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_web_site_management_client_enums.py @@ -1,607 +1,729 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class KeyVaultSecretStatus(str, Enum): - - initialized = "Initialized" - waiting_on_certificate_order = "WaitingOnCertificateOrder" - succeeded = "Succeeded" - certificate_order_failed = "CertificateOrderFailed" - operation_not_permitted_on_key_vault = "OperationNotPermittedOnKeyVault" - azure_service_unauthorized_to_access_key_vault = "AzureServiceUnauthorizedToAccessKeyVault" - key_vault_does_not_exist = "KeyVaultDoesNotExist" - key_vault_secret_does_not_exist = "KeyVaultSecretDoesNotExist" - unknown_error = "UnknownError" - external_private_key = "ExternalPrivateKey" - unknown = "Unknown" - - -class CertificateProductType(str, Enum): - - standard_domain_validated_ssl = "StandardDomainValidatedSsl" - standard_domain_validated_wild_card_ssl = "StandardDomainValidatedWildCardSsl" - - -class ProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - in_progress = "InProgress" - deleting = "Deleting" - - -class CertificateOrderStatus(str, Enum): - - pendingissuance = "Pendingissuance" - issued = "Issued" - revoked = "Revoked" - canceled = "Canceled" - denied = "Denied" - pendingrevocation = "Pendingrevocation" - pending_rekey = "PendingRekey" - unused = "Unused" - expired = "Expired" - not_submitted = "NotSubmitted" - - -class CertificateOrderActionType(str, Enum): - - certificate_issued = "CertificateIssued" - certificate_order_canceled = "CertificateOrderCanceled" - certificate_order_created = "CertificateOrderCreated" - certificate_revoked = "CertificateRevoked" - domain_validation_complete = "DomainValidationComplete" - fraud_detected = "FraudDetected" - org_name_change = "OrgNameChange" - org_validation_complete = "OrgValidationComplete" - san_drop = "SanDrop" - fraud_cleared = "FraudCleared" - certificate_expired = "CertificateExpired" - certificate_expiration_warning = "CertificateExpirationWarning" - fraud_documentation_required = "FraudDocumentationRequired" - unknown = "Unknown" - - -class RouteType(str, Enum): - - default = "DEFAULT" - inherited = "INHERITED" - static = "STATIC" - - -class ManagedServiceIdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - - -class IpFilterTag(str, Enum): - - default = "Default" - xff_proxy = "XffProxy" - - -class AutoHealActionType(str, Enum): - - recycle = "Recycle" - log_event = "LogEvent" - custom_action = "CustomAction" - - -class ConnectionStringType(str, Enum): - - my_sql = "MySql" - sql_server = "SQLServer" - sql_azure = "SQLAzure" - custom = "Custom" - notification_hub = "NotificationHub" - service_bus = "ServiceBus" - event_hub = "EventHub" - api_hub = "ApiHub" - doc_db = "DocDb" - redis_cache = "RedisCache" - postgre_sql = "PostgreSQL" - - -class ScmType(str, Enum): - - none = "None" - dropbox = "Dropbox" - tfs = "Tfs" - local_git = "LocalGit" - git_hub = "GitHub" - code_plex_git = "CodePlexGit" - code_plex_hg = "CodePlexHg" - bitbucket_git = "BitbucketGit" - bitbucket_hg = "BitbucketHg" - external_git = "ExternalGit" - external_hg = "ExternalHg" - one_drive = "OneDrive" - vso = "VSO" - vstsrm = "VSTSRM" - - -class ManagedPipelineMode(str, Enum): - - integrated = "Integrated" - classic = "Classic" - - -class SiteLoadBalancing(str, Enum): - - weighted_round_robin = "WeightedRoundRobin" - least_requests = "LeastRequests" - least_response_time = "LeastResponseTime" - weighted_total_traffic = "WeightedTotalTraffic" - request_hash = "RequestHash" - - -class SupportedTlsVersions(str, Enum): - - one_full_stop_zero = "1.0" - one_full_stop_one = "1.1" - one_full_stop_two = "1.2" - - -class FtpsState(str, Enum): - - all_allowed = "AllAllowed" - ftps_only = "FtpsOnly" - disabled = "Disabled" - - -class SslState(str, Enum): - - disabled = "Disabled" - sni_enabled = "SniEnabled" - ip_based_enabled = "IpBasedEnabled" - - -class HostType(str, Enum): - - standard = "Standard" - repository = "Repository" - - -class UsageState(str, Enum): - - normal = "Normal" - exceeded = "Exceeded" - - -class SiteAvailabilityState(str, Enum): - - normal = "Normal" - limited = "Limited" - disaster_recovery_mode = "DisasterRecoveryMode" - - -class RedundancyMode(str, Enum): - - none = "None" - manual = "Manual" - failover = "Failover" - active_active = "ActiveActive" - geo_redundant = "GeoRedundant" - - -class StatusOptions(str, Enum): - - ready = "Ready" - pending = "Pending" - creating = "Creating" - - -class DomainStatus(str, Enum): - - active = "Active" - awaiting = "Awaiting" - cancelled = "Cancelled" - confiscated = "Confiscated" - disabled = "Disabled" - excluded = "Excluded" - expired = "Expired" - failed = "Failed" - held = "Held" - locked = "Locked" - parked = "Parked" - pending = "Pending" - reserved = "Reserved" - reverted = "Reverted" - suspended = "Suspended" - transferred = "Transferred" - unknown = "Unknown" - unlocked = "Unlocked" - unparked = "Unparked" - updated = "Updated" - json_converter_failed = "JsonConverterFailed" - - -class AzureResourceType(str, Enum): - - website = "Website" - traffic_manager = "TrafficManager" - - -class CustomHostNameDnsRecordType(str, Enum): - - cname = "CName" - a = "A" - - -class HostNameType(str, Enum): - - verified = "Verified" - managed = "Managed" - - -class DnsType(str, Enum): - - azure_dns = "AzureDns" - default_domain_registrar_dns = "DefaultDomainRegistrarDns" - - -class DomainType(str, Enum): - - regular = "Regular" - soft_deleted = "SoftDeleted" - - -class HostingEnvironmentStatus(str, Enum): - - preparing = "Preparing" - ready = "Ready" - scaling = "Scaling" - deleting = "Deleting" - - -class InternalLoadBalancingMode(str, Enum): - - none = "None" - web = "Web" - publishing = "Publishing" - - -class ComputeModeOptions(str, Enum): - - shared = "Shared" - dedicated = "Dedicated" - dynamic = "Dynamic" - - -class WorkerSizeOptions(str, Enum): - - small = "Small" - medium = "Medium" - large = "Large" - d1 = "D1" - d2 = "D2" - d3 = "D3" - nested_small = "NestedSmall" - default = "Default" - - -class AccessControlEntryAction(str, Enum): - - permit = "Permit" - deny = "Deny" - - -class OperationStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - - -class IssueType(str, Enum): - - service_incident = "ServiceIncident" - app_deployment = "AppDeployment" - app_crash = "AppCrash" - runtime_issue_detected = "RuntimeIssueDetected" - ase_deployment = "AseDeployment" - user_issue = "UserIssue" - platform_issue = "PlatformIssue" - other = "Other" - - -class SolutionType(str, Enum): - - quick_solution = "QuickSolution" - deep_investigation = "DeepInvestigation" - best_practices = "BestPractices" - - -class RenderingType(str, Enum): - - no_graph = "NoGraph" - table = "Table" - time_series = "TimeSeries" - time_series_per_instance = "TimeSeriesPerInstance" - - -class ResourceScopeType(str, Enum): - - server_farm = "ServerFarm" - subscription = "Subscription" - web_site = "WebSite" - - -class NotificationLevel(str, Enum): - - critical = "Critical" - warning = "Warning" - information = "Information" - non_urgent_suggestion = "NonUrgentSuggestion" - - -class Channels(str, Enum): - - notification = "Notification" - api = "Api" - email = "Email" - webhook = "Webhook" - all = "All" - - -class AppServicePlanRestrictions(str, Enum): - - none = "None" - free = "Free" - shared = "Shared" - basic = "Basic" - standard = "Standard" - premium = "Premium" - - -class InAvailabilityReasonType(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" - - -class CheckNameResourceTypes(str, Enum): - - site = "Site" - slot = "Slot" - hosting_environment = "HostingEnvironment" - publishing_user = "PublishingUser" - microsoft_websites = "Microsoft.Web/sites" - microsoft_websitesslots = "Microsoft.Web/sites/slots" - microsoft_webhosting_environments = "Microsoft.Web/hostingEnvironments" - microsoft_webpublishing_users = "Microsoft.Web/publishingUsers" - - -class ValidateResourceTypes(str, Enum): - - server_farm = "ServerFarm" - site = "Site" - - -class ResolveStatus(str, Enum): - - initialized = "Initialized" - resolved = "Resolved" - invalid_syntax = "InvalidSyntax" - msi_not_enabled = "MSINotEnabled" - vault_not_found = "VaultNotFound" - secret_not_found = "SecretNotFound" - secret_version_not_found = "SecretVersionNotFound" - access_to_key_vault_denied = "AccessToKeyVaultDenied" - other_reasons = "OtherReasons" - - -class ConfigReferenceSource(str, Enum): - - key_vault = "KeyVault" - - -class ConfigReferenceLocation(str, Enum): - - application_setting = "ApplicationSetting" - - -class LogLevel(str, Enum): - - off = "Off" - verbose = "Verbose" - information = "Information" - warning = "Warning" - error = "Error" - - -class AzureStorageType(str, Enum): - - azure_files = "AzureFiles" - azure_blob = "AzureBlob" - - -class AzureStorageState(str, Enum): - - ok = "Ok" - invalid_credentials = "InvalidCredentials" - invalid_share = "InvalidShare" - - -class BackupItemStatus(str, Enum): - - in_progress = "InProgress" - failed = "Failed" - succeeded = "Succeeded" - timed_out = "TimedOut" - created = "Created" - skipped = "Skipped" - partially_succeeded = "PartiallySucceeded" - delete_in_progress = "DeleteInProgress" - delete_failed = "DeleteFailed" - deleted = "Deleted" - - -class DatabaseType(str, Enum): - - sql_azure = "SqlAzure" - my_sql = "MySql" - local_my_sql = "LocalMySql" - postgre_sql = "PostgreSql" - - -class FrequencyUnit(str, Enum): - - day = "Day" - hour = "Hour" - - -class ContinuousWebJobStatus(str, Enum): - - initializing = "Initializing" - starting = "Starting" - running = "Running" - pending_restart = "PendingRestart" - stopped = "Stopped" - - -class WebJobType(str, Enum): - - continuous = "Continuous" - triggered = "Triggered" - - -class PublishingProfileFormat(str, Enum): - - file_zilla3 = "FileZilla3" - web_deploy = "WebDeploy" - ftp = "Ftp" - - -class DnsVerificationTestResult(str, Enum): - - passed = "Passed" - failed = "Failed" - skipped = "Skipped" - - -class MSDeployLogEntryType(str, Enum): - - message = "Message" - warning = "Warning" - error = "Error" - - -class MSDeployProvisioningState(str, Enum): - - accepted = "accepted" - running = "running" - succeeded = "succeeded" - failed = "failed" - canceled = "canceled" - - -class MySqlMigrationType(str, Enum): - - local_to_remote = "LocalToRemote" - remote_to_local = "RemoteToLocal" - - -class PublicCertificateLocation(str, Enum): - - current_user_my = "CurrentUserMy" - local_machine_my = "LocalMachineMy" - unknown = "Unknown" - - -class BackupRestoreOperationType(str, Enum): - - default = "Default" - clone = "Clone" - relocation = "Relocation" - snapshot = "Snapshot" - cloud_fs = "CloudFS" - - -class UnauthenticatedClientAction(str, Enum): - - redirect_to_login_page = "RedirectToLoginPage" - allow_anonymous = "AllowAnonymous" - - -class BuiltInAuthenticationProvider(str, Enum): - - azure_active_directory = "AzureActiveDirectory" - facebook = "Facebook" - google = "Google" - microsoft_account = "MicrosoftAccount" - twitter = "Twitter" - - -class CloneAbilityResult(str, Enum): - - cloneable = "Cloneable" - partially_cloneable = "PartiallyCloneable" - not_cloneable = "NotCloneable" - - -class SiteExtensionType(str, Enum): - - gallery = "Gallery" - web_root = "WebRoot" - - -class TriggeredWebJobStatus(str, Enum): - - success = "Success" - failed = "Failed" - error = "Error" - - -class SiteRuntimeState(str, Enum): - - ready = "READY" - stopped = "STOPPED" - unknown = "UNKNOWN" - - -class BuildStatus(str, Enum): - - waiting_for_deployment = "WaitingForDeployment" - uploading = "Uploading" - deploying = "Deploying" - ready = "Ready" - failed = "Failed" - deleting = "Deleting" - detached = "Detached" - - -class TriggerTypes(str, Enum): - - http_trigger = "HttpTrigger" - unknown = "Unknown" - - -class SkuName(str, Enum): - - free = "Free" - shared = "Shared" - basic = "Basic" - standard = "Standard" - premium = "Premium" - dynamic = "Dynamic" - isolated = "Isolated" - premium_v2 = "PremiumV2" - elastic_premium = "ElasticPremium" - elastic_isolated = "ElasticIsolated" +from enum import Enum, EnumMeta +from six import with_metaclass + +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 AccessControlEntryAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action object. + """ + + PERMIT = "Permit" + DENY = "Deny" + +class AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class AppServiceCertificateOrderPropertiesAppServiceCertificateNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class AppServicePlanRestrictions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plans this offer is restricted to. + """ + + NONE = "None" + FREE = "Free" + SHARED = "Shared" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class AutoHealActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Predefined action to be taken. + """ + + RECYCLE = "Recycle" + LOG_EVENT = "LogEvent" + CUSTOM_ACTION = "CustomAction" + +class AzureResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Azure resource the hostname is assigned to. + """ + + WEBSITE = "Website" + TRAFFIC_MANAGER = "TrafficManager" + +class AzureStorageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the storage account. + """ + + OK = "Ok" + INVALID_CREDENTIALS = "InvalidCredentials" + INVALID_SHARE = "InvalidShare" + +class AzureStorageType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of storage. + """ + + AZURE_FILES = "AzureFiles" + AZURE_BLOB = "AzureBlob" + +class BackupItemStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Backup status. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + SKIPPED = "Skipped" + PARTIALLY_SUCCEEDED = "PartiallySucceeded" + DELETE_IN_PROGRESS = "DeleteInProgress" + DELETE_FAILED = "DeleteFailed" + DELETED = "Deleted" + +class BackupRestoreOperationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operation type. + """ + + DEFAULT = "Default" + CLONE = "Clone" + RELOCATION = "Relocation" + SNAPSHOT = "Snapshot" + CLOUD_FS = "CloudFS" + +class BuildStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the static site build. + """ + + WAITING_FOR_DEPLOYMENT = "WaitingForDeployment" + UPLOADING = "Uploading" + DEPLOYING = "Deploying" + READY = "Ready" + FAILED = "Failed" + DELETING = "Deleting" + DETACHED = "Detached" + +class BuiltInAuthenticationProvider(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The default authentication provider to use when multiple providers are configured. + This setting is only needed if multiple providers are configured and the unauthenticated client + action is set to "RedirectToLoginPage". + """ + + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + FACEBOOK = "Facebook" + GOOGLE = "Google" + MICROSOFT_ACCOUNT = "MicrosoftAccount" + TWITTER = "Twitter" + +class CertificateOrderActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action type. + """ + + CERTIFICATE_ISSUED = "CertificateIssued" + CERTIFICATE_ORDER_CANCELED = "CertificateOrderCanceled" + CERTIFICATE_ORDER_CREATED = "CertificateOrderCreated" + CERTIFICATE_REVOKED = "CertificateRevoked" + DOMAIN_VALIDATION_COMPLETE = "DomainValidationComplete" + FRAUD_DETECTED = "FraudDetected" + ORG_NAME_CHANGE = "OrgNameChange" + ORG_VALIDATION_COMPLETE = "OrgValidationComplete" + SAN_DROP = "SanDrop" + FRAUD_CLEARED = "FraudCleared" + CERTIFICATE_EXPIRED = "CertificateExpired" + CERTIFICATE_EXPIRATION_WARNING = "CertificateExpirationWarning" + FRAUD_DOCUMENTATION_REQUIRED = "FraudDocumentationRequired" + UNKNOWN = "Unknown" + +class CertificateOrderStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current order status. + """ + + PENDINGISSUANCE = "Pendingissuance" + ISSUED = "Issued" + REVOKED = "Revoked" + CANCELED = "Canceled" + DENIED = "Denied" + PENDINGREVOCATION = "Pendingrevocation" + PENDING_REKEY = "PendingRekey" + UNUSED = "Unused" + EXPIRED = "Expired" + NOT_SUBMITTED = "NotSubmitted" + +class CertificateProductType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Certificate product type. + """ + + STANDARD_DOMAIN_VALIDATED_SSL = "StandardDomainValidatedSsl" + STANDARD_DOMAIN_VALIDATED_WILD_CARD_SSL = "StandardDomainValidatedWildCardSsl" + +class Channels(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """List of channels that this recommendation can apply. + """ + + NOTIFICATION = "Notification" + API = "Api" + EMAIL = "Email" + WEBHOOK = "Webhook" + ALL = "All" + +class CheckNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource type used for verification. + """ + + SITE = "Site" + SLOT = "Slot" + HOSTING_ENVIRONMENT = "HostingEnvironment" + PUBLISHING_USER = "PublishingUser" + MICROSOFT_WEB_SITES = "Microsoft.Web/sites" + MICROSOFT_WEB_SITES_SLOTS = "Microsoft.Web/sites/slots" + MICROSOFT_WEB_HOSTING_ENVIRONMENTS = "Microsoft.Web/hostingEnvironments" + MICROSOFT_WEB_PUBLISHING_USERS = "Microsoft.Web/publishingUsers" + +class CloneAbilityResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of app. + """ + + CLONEABLE = "Cloneable" + PARTIALLY_CLONEABLE = "PartiallyCloneable" + NOT_CLONEABLE = "NotCloneable" + +class ComputeModeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Shared/dedicated workers. + """ + + SHARED = "Shared" + DEDICATED = "Dedicated" + DYNAMIC = "Dynamic" + +class ConnectionStringType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of database. + """ + + MY_SQL = "MySql" + SQL_SERVER = "SQLServer" + SQL_AZURE = "SQLAzure" + CUSTOM = "Custom" + NOTIFICATION_HUB = "NotificationHub" + SERVICE_BUS = "ServiceBus" + EVENT_HUB = "EventHub" + API_HUB = "ApiHub" + DOC_DB = "DocDb" + REDIS_CACHE = "RedisCache" + POSTGRE_SQL = "PostgreSQL" + +class ContinuousWebJobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job status. + """ + + INITIALIZING = "Initializing" + STARTING = "Starting" + RUNNING = "Running" + PENDING_RESTART = "PendingRestart" + STOPPED = "Stopped" + +class CustomHostNameDnsRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the DNS record. + """ + + C_NAME = "CName" + A = "A" + +class DatabaseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Database type (e.g. SqlAzure / MySql). + """ + + SQL_AZURE = "SqlAzure" + MY_SQL = "MySql" + LOCAL_MY_SQL = "LocalMySql" + POSTGRE_SQL = "PostgreSql" + +class DnsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current DNS type + """ + + AZURE_DNS = "AzureDns" + DEFAULT_DOMAIN_REGISTRAR_DNS = "DefaultDomainRegistrarDns" + +class DnsVerificationTestResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """DNS verification test result. + """ + + PASSED = "Passed" + FAILED = "Failed" + SKIPPED = "Skipped" + +class DomainPatchResourcePropertiesDomainNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class DomainPropertiesDomainNotRenewableReasonsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + REGISTRATION_STATUS_NOT_SUPPORTED_FOR_RENEWAL = "RegistrationStatusNotSupportedForRenewal" + EXPIRATION_NOT_IN_RENEWAL_TIME_RANGE = "ExpirationNotInRenewalTimeRange" + SUBSCRIPTION_NOT_ACTIVE = "SubscriptionNotActive" + +class DomainStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Domain registration status. + """ + + ACTIVE = "Active" + AWAITING = "Awaiting" + CANCELLED = "Cancelled" + CONFISCATED = "Confiscated" + DISABLED = "Disabled" + EXCLUDED = "Excluded" + EXPIRED = "Expired" + FAILED = "Failed" + HELD = "Held" + LOCKED = "Locked" + PARKED = "Parked" + PENDING = "Pending" + RESERVED = "Reserved" + REVERTED = "Reverted" + SUSPENDED = "Suspended" + TRANSFERRED = "Transferred" + UNKNOWN = "Unknown" + UNLOCKED = "Unlocked" + UNPARKED = "Unparked" + UPDATED = "Updated" + JSON_CONVERTER_FAILED = "JsonConverterFailed" + +class DomainType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Valid values are Regular domain: Azure will charge the full price of domain registration, + SoftDeleted: Purchasing this domain will simply restore it and this operation will not cost + anything. + """ + + REGULAR = "Regular" + SOFT_DELETED = "SoftDeleted" + +class Enum4(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + WINDOWS_FUNCTIONS = "WindowsFunctions" + LINUX_FUNCTIONS = "LinuxFunctions" + +class Enum5(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + WINDOWS_FUNCTIONS = "WindowsFunctions" + LINUX_FUNCTIONS = "LinuxFunctions" + +class FrequencyUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of time for how often the backup should be executed (e.g. for weekly backup, this + should be set to Day and FrequencyInterval should be set to 7) + """ + + DAY = "Day" + HOUR = "Hour" + +class FtpsState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of FTP / FTPS service + """ + + ALL_ALLOWED = "AllAllowed" + FTPS_ONLY = "FtpsOnly" + DISABLED = "Disabled" + +class HostingEnvironmentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the App Service Environment. + """ + + PREPARING = "Preparing" + READY = "Ready" + SCALING = "Scaling" + DELETING = "Deleting" + +class HostNameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the hostname. + """ + + VERIFIED = "Verified" + MANAGED = "Managed" + +class HostType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether the hostname is a standard or repository hostname. + """ + + STANDARD = "Standard" + REPOSITORY = "Repository" + +class InAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """:code:`Invalid` indicates the name provided does not match Azure App Service + naming requirements. :code:`AlreadyExists` indicates that the name is already in + use and is therefore unavailable. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class InternalLoadBalancingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies which endpoints to serve internally in the Virtual Network for the App Service + Environment. + """ + + NONE = "None" + WEB = "Web" + PUBLISHING = "Publishing" + +class IpFilterTag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Defines what this IP filter will be used for. This is to support IP filtering on proxies. + """ + + DEFAULT = "Default" + XFF_PROXY = "XffProxy" + +class IssueType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Represents the type of the Detector + """ + + SERVICE_INCIDENT = "ServiceIncident" + APP_DEPLOYMENT = "AppDeployment" + APP_CRASH = "AppCrash" + RUNTIME_ISSUE_DETECTED = "RuntimeIssueDetected" + ASE_DEPLOYMENT = "AseDeployment" + USER_ISSUE = "UserIssue" + PLATFORM_ISSUE = "PlatformIssue" + OTHER = "Other" + +class KeyVaultSecretStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Key Vault secret. + """ + + INITIALIZED = "Initialized" + WAITING_ON_CERTIFICATE_ORDER = "WaitingOnCertificateOrder" + SUCCEEDED = "Succeeded" + CERTIFICATE_ORDER_FAILED = "CertificateOrderFailed" + OPERATION_NOT_PERMITTED_ON_KEY_VAULT = "OperationNotPermittedOnKeyVault" + AZURE_SERVICE_UNAUTHORIZED_TO_ACCESS_KEY_VAULT = "AzureServiceUnauthorizedToAccessKeyVault" + KEY_VAULT_DOES_NOT_EXIST = "KeyVaultDoesNotExist" + KEY_VAULT_SECRET_DOES_NOT_EXIST = "KeyVaultSecretDoesNotExist" + UNKNOWN_ERROR = "UnknownError" + EXTERNAL_PRIVATE_KEY = "ExternalPrivateKey" + UNKNOWN = "Unknown" + +class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Log level. + """ + + OFF = "Off" + VERBOSE = "Verbose" + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + +class ManagedPipelineMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Managed pipeline mode. + """ + + INTEGRATED = "Integrated" + CLASSIC = "Classic" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class MSDeployLogEntryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Log entry type + """ + + MESSAGE = "Message" + WARNING = "Warning" + ERROR = "Error" + +class MSDeployProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state + """ + + ACCEPTED = "accepted" + RUNNING = "running" + SUCCEEDED = "succeeded" + FAILED = "failed" + CANCELED = "canceled" + +class MySqlMigrationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of migration operation to be done + """ + + LOCAL_TO_REMOTE = "LocalToRemote" + REMOTE_TO_LOCAL = "RemoteToLocal" + +class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Level indicating how critical this recommendation can impact. + """ + + CRITICAL = "Critical" + WARNING = "Warning" + INFORMATION = "Information" + NON_URGENT_SUGGESTION = "NonUrgentSuggestion" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the operation. + """ + + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CREATED = "Created" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of certificate order. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" + +class PublicCertificateLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Public Certificate Location + """ + + CURRENT_USER_MY = "CurrentUserMy" + LOCAL_MACHINE_MY = "LocalMachineMy" + UNKNOWN = "Unknown" + +class PublishingProfileFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of the format. Valid values are: + FileZilla3 + WebDeploy -- default + Ftp + """ + + FILE_ZILLA3 = "FileZilla3" + WEB_DEPLOY = "WebDeploy" + FTP = "Ftp" + +class RedundancyMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site redundancy mode + """ + + NONE = "None" + MANUAL = "Manual" + FAILOVER = "Failover" + ACTIVE_ACTIVE = "ActiveActive" + GEO_REDUNDANT = "GeoRedundant" + +class RenderingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rendering Type + """ + + NO_GRAPH = "NoGraph" + TABLE = "Table" + TIME_SERIES = "TimeSeries" + TIME_SERIES_PER_INSTANCE = "TimeSeriesPerInstance" + +class ResolveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + INITIALIZED = "Initialized" + RESOLVED = "Resolved" + INVALID_SYNTAX = "InvalidSyntax" + MSI_NOT_ENABLED = "MSINotEnabled" + VAULT_NOT_FOUND = "VaultNotFound" + SECRET_NOT_FOUND = "SecretNotFound" + SECRET_VERSION_NOT_FOUND = "SecretVersionNotFound" + ACCESS_TO_KEY_VAULT_DENIED = "AccessToKeyVaultDenied" + OTHER_REASONS = "OtherReasons" + +class ResourceScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of a resource type this recommendation applies, e.g. Subscription, ServerFarm, Site. + """ + + SERVER_FARM = "ServerFarm" + SUBSCRIPTION = "Subscription" + WEB_SITE = "WebSite" + +class RouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of route this is: + DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 + INHERITED - Routes inherited from the real Virtual Network routes + STATIC - Static route set on the app only + + These values will be used for syncing an app's routes with those from a Virtual Network. + """ + + DEFAULT = "DEFAULT" + INHERITED = "INHERITED" + STATIC = "STATIC" + +class ScmType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SCM type. + """ + + NONE = "None" + DROPBOX = "Dropbox" + TFS = "Tfs" + LOCAL_GIT = "LocalGit" + GIT_HUB = "GitHub" + CODE_PLEX_GIT = "CodePlexGit" + CODE_PLEX_HG = "CodePlexHg" + BITBUCKET_GIT = "BitbucketGit" + BITBUCKET_HG = "BitbucketHg" + EXTERNAL_GIT = "ExternalGit" + EXTERNAL_HG = "ExternalHg" + ONE_DRIVE = "OneDrive" + VSO = "VSO" + VSTSRM = "VSTSRM" + +class SiteAvailabilityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Management information availability state for the app. + """ + + NORMAL = "Normal" + LIMITED = "Limited" + DISASTER_RECOVERY_MODE = "DisasterRecoveryMode" + +class SiteExtensionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site extension type. + """ + + GALLERY = "Gallery" + WEB_ROOT = "WebRoot" + +class SiteLoadBalancing(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Site load balancing. + """ + + WEIGHTED_ROUND_ROBIN = "WeightedRoundRobin" + LEAST_REQUESTS = "LeastRequests" + LEAST_RESPONSE_TIME = "LeastResponseTime" + WEIGHTED_TOTAL_TRAFFIC = "WeightedTotalTraffic" + REQUEST_HASH = "RequestHash" + +class SiteRuntimeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + READY = "READY" + STOPPED = "STOPPED" + UNKNOWN = "UNKNOWN" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + FREE = "Free" + SHARED = "Shared" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + DYNAMIC = "Dynamic" + ISOLATED = "Isolated" + PREMIUM_V2 = "PremiumV2" + ELASTIC_PREMIUM = "ElasticPremium" + ELASTIC_ISOLATED = "ElasticIsolated" + +class SolutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of Solution + """ + + QUICK_SOLUTION = "QuickSolution" + DEEP_INVESTIGATION = "DeepInvestigation" + BEST_PRACTICES = "BestPractices" + +class SslState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SSL type. + """ + + DISABLED = "Disabled" + SNI_ENABLED = "SniEnabled" + IP_BASED_ENABLED = "IpBasedEnabled" + +class StatusOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """App Service plan status. + """ + + READY = "Ready" + PENDING = "Pending" + CREATING = "Creating" + +class SupportedTlsVersions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """MinTlsVersion: configures the minimum version of TLS required for SSL requests + """ + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" + +class TriggeredWebJobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job status. + """ + + SUCCESS = "Success" + FAILED = "Failed" + ERROR = "Error" + +class TriggerTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The trigger type of the function + """ + + HTTP_TRIGGER = "HttpTrigger" + UNKNOWN = "Unknown" + +class UnauthenticatedClientAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The action to take when an unauthenticated client attempts to access the app. + """ + + REDIRECT_TO_LOGIN_PAGE = "RedirectToLoginPage" + ALLOW_ANONYMOUS = "AllowAnonymous" + +class UsageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State indicating whether the app has exceeded its quota usage. Read-only. + """ + + NORMAL = "Normal" + EXCEEDED = "Exceeded" + +class ValidateResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource type used for verification. + """ + + SERVER_FARM = "ServerFarm" + SITE = "Site" + +class WebJobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Job type. + """ + + CONTINUOUS = "Continuous" + TRIGGERED = "Triggered" + +class WorkerSizeOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Size of the machines. + """ + + SMALL = "Small" + MEDIUM = "Medium" + LARGE = "Large" + D1 = "D1" + D2 = "D2" + D3 = "D3" + NESTED_SMALL = "NestedSmall" + DEFAULT = "Default" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/__init__.py index b6a3c15dcb7d..8f414125deed 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/__init__.py @@ -1,12 +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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._app_service_certificate_orders_operations import AppServiceCertificateOrdersOperations @@ -19,12 +16,12 @@ from ._diagnostics_operations import DiagnosticsOperations from ._provider_operations import ProviderOperations from ._recommendations_operations import RecommendationsOperations +from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin from ._web_apps_operations import WebAppsOperations from ._static_sites_operations import StaticSitesOperations from ._app_service_environments_operations import AppServiceEnvironmentsOperations from ._app_service_plans_operations import AppServicePlansOperations from ._resource_health_metadata_operations import ResourceHealthMetadataOperations -from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin __all__ = [ 'AppServiceCertificateOrdersOperations', @@ -37,10 +34,10 @@ 'DiagnosticsOperations', 'ProviderOperations', 'RecommendationsOperations', + 'WebSiteManagementClientOperationsMixin', 'WebAppsOperations', 'StaticSitesOperations', 'AppServiceEnvironmentsOperations', 'AppServicePlansOperations', 'ResourceHealthMetadataOperations', - 'WebSiteManagementClientOperationsMixin', ] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py index a4be5eff7a0e..01d9f13179d7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py @@ -1,1423 +1,1445 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServiceCertificateOrdersOperations(object): """AppServiceCertificateOrdersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateOrderCollection"] """List all certificate orders in a subscription. Description for List all certificate orders in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateOrder - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrderCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateOrderPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore def validate_purchase_information( - self, app_service_certificate_order, custom_headers=None, raw=False, **operation_config): + self, + app_service_certificate_order, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> None """Validate information for a certificate order. Description for Validate information for a certificate order. - :param app_service_certificate_order: Information for a certificate - order. - :type app_service_certificate_order: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_service_certificate_order: Information for a certificate order. + :type app_service_certificate_order: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate_purchase_information.metadata['url'] + url = self.validate_purchase_information.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} + if cls: + return cls(pipeline_response, None, {}) + + validate_purchase_information.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateOrderCollection"] """Get certificate orders in a resource group. Description for Get certificate orders in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateOrder - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateOrderCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrderCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateOrderPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders'} # type: ignore def get( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" """Get a certificate order. Description for Get a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order.. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateOrder or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrder" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceCertificateOrder"] """Create or update a certificate purchase order. Description for Create or update a certificate purchase order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param certificate_distinguished_name: Distinguished name to use for - the certificate order. - :type certificate_distinguished_name: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceCertificateOrder or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceCertificateOrder or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - certificate_order_name=certificate_order_name, - certificate_distinguished_name=certificate_distinguished_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceCertificateOrder', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + certificate_order_name=certificate_order_name, + certificate_distinguished_name=certificate_distinguished_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + 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 + ) + 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.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def delete( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an existing certificate order. Description for Delete an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def update( - self, resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + certificate_distinguished_name, # type: "models.AppServiceCertificateOrderPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateOrder" """Create or update a certificate purchase order. Description for Create or update a certificate purchase order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param certificate_distinguished_name: Distinguished name to use for - the certificate order. - :type certificate_distinguished_name: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateOrder or ClientRawResponse if raw=true + :param certificate_distinguished_name: Distinguished name to use for the certificate order. + :type certificate_distinguished_name: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrderPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateOrder, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateOrder - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateOrder', response) + deserialized = self._deserialize('AppServiceCertificateOrder', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}'} # type: ignore def list_certificates( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceCertificateCollection"] """List all certificates associated with a certificate order. - Description for List all certificates associated with a certificate - order. + Description for List all certificates associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceCertificateResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResourcePaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_certificates.metadata['url'] + url = self.list_certificates.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceCertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates'} # type: ignore def get_certificate( - self, resource_group_name, certificate_order_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" """Get the certificate associated with a certificate order. - Description for Get the certificate associated with a certificate - order. + Description for Get the certificate associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} - + get_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def _create_or_update_certificate_initial( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_certificate.metadata['url'] + url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_certificate( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore + + def begin_create_or_update_certificate( + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceCertificateResource"] """Creates or updates a certificate and associates with key vault secret. - Description for Creates or updates a certificate and associates with - key vault secret. + Description for Creates or updates a certificate and associates with key vault secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str :param key_vault_certificate: Key vault certificate resource Id. - :type key_vault_certificate: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type key_vault_certificate: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceCertificateResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceCertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_certificate_initial( - resource_group_name=resource_group_name, - certificate_order_name=certificate_order_name, - name=name, - key_vault_certificate=key_vault_certificate, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceCertificateResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_certificate_initial( + resource_group_name=resource_group_name, + certificate_order_name=certificate_order_name, + name=name, + key_vault_certificate=key_vault_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def delete_certificate( - self, resource_group_name, certificate_order_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete the certificate associated with a certificate order. - Description for Delete the certificate associated with a certificate - order. + Description for Delete the certificate associated with a certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + delete_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def update_certificate( - self, resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name, # type: str + key_vault_certificate, # type: "models.AppServiceCertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceCertificateResource" """Creates or updates a certificate and associates with key vault secret. - Description for Creates or updates a certificate and associates with - key vault secret. + Description for Creates or updates a certificate and associates with key vault secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param name: Name of the certificate. :type name: str :param key_vault_certificate: Key vault certificate resource Id. - :type key_vault_certificate: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceCertificateResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type key_vault_certificate: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceCertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceCertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceCertificateResource', response) + deserialized = self._deserialize('AppServiceCertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} + update_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}'} # type: ignore def reissue( - self, resource_group_name, certificate_order_name, reissue_certificate_order_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + reissue_certificate_order_request, # type: "models.ReissueCertificateOrderRequest" + **kwargs # type: Any + ): + # type: (...) -> None """Reissue an existing certificate order. Description for Reissue an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str :param reissue_certificate_order_request: Parameters for the reissue. - :type reissue_certificate_order_request: - ~azure.mgmt.web.v2019_08_01.models.ReissueCertificateOrderRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type reissue_certificate_order_request: ~azure.mgmt.web.v2019_08_01.models.ReissueCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.reissue.metadata['url'] + url = self.reissue.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} + if cls: + return cls(pipeline_response, None, {}) + + reissue.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue'} # type: ignore def renew( - self, resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + renew_certificate_order_request, # type: "models.RenewCertificateOrderRequest" + **kwargs # type: Any + ): + # type: (...) -> None """Renew an existing certificate order. Description for Renew an existing certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param renew_certificate_order_request: Renew parameters - :type renew_certificate_order_request: - ~azure.mgmt.web.v2019_08_01.models.RenewCertificateOrderRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param renew_certificate_order_request: Renew parameters. + :type renew_certificate_order_request: ~azure.mgmt.web.v2019_08_01.models.RenewCertificateOrderRequest + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.renew.metadata['url'] + url = self.renew.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} + if cls: + return cls(pipeline_response, None, {}) + + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew'} # type: ignore def resend_email( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Resend certificate email. Description for Resend certificate email. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.resend_email.metadata['url'] + url = self.resend_email.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} + if cls: + return cls(pipeline_response, None, {}) + + resend_email.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail'} # type: ignore def resend_request_emails( - self, resource_group_name, certificate_order_name, name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> None """Verify domain ownership for this certificate order. Description for Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param name_identifier: Email address. + :type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :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 """ - name_identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.resend_request_emails.metadata['url'] + url = self.resend_request_emails.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} + if cls: + return cls(pipeline_response, None, {}) + + resend_request_emails.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails'} # type: ignore def retrieve_site_seal( - self, resource_group_name, certificate_order_name, light_theme=None, locale=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + site_seal_request, # type: "models.SiteSealRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSeal" """Verify domain ownership for this certificate order. Description for Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param light_theme: If true use the light color theme for - site seal; otherwise, use the default color theme. - :type light_theme: bool - :param locale: Locale of site seal. - :type locale: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSeal or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSeal or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_seal_request: Site seal request. + :type site_seal_request: ~azure.mgmt.web.v2019_08_01.models.SiteSealRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSeal, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSeal + :raises: ~azure.core.exceptions.HttpResponseError """ - site_seal_request = models.SiteSealRequest(light_theme=light_theme, locale=locale) + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.retrieve_site_seal.metadata['url'] + url = self.retrieve_site_seal.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteSeal', response) + deserialized = self._deserialize('SiteSeal', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} + retrieve_site_seal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal'} # type: ignore def verify_domain_ownership( - self, resource_group_name, certificate_order_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + certificate_order_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Verify domain ownership for this certificate order. Description for Verify domain ownership for this certificate order. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param certificate_order_name: Name of the certificate order. :type certificate_order_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.verify_domain_ownership.metadata['url'] + url = self.verify_domain_ownership.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'certificateOrderName': self._serialize.url("certificate_order_name", certificate_order_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} + verify_domain_ownership.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership'} # type: ignore def retrieve_certificate_actions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.CertificateOrderAction"] """Retrieve the list of certificate actions. Description for Retrieve the list of certificate actions. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate order. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.mgmt.web.v2019_08_01.models.CertificateOrderAction] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateOrderAction, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.CertificateOrderAction] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.retrieve_certificate_actions.metadata['url'] + url = self.retrieve_certificate_actions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[CertificateOrderAction]', response) + deserialized = self._deserialize('[CertificateOrderAction]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} + retrieve_certificate_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions'} # type: ignore def retrieve_certificate_email_history( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.CertificateEmail"] """Retrieve email history. Description for Retrieve email history. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate order. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.CertificateEmail] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CertificateEmail, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.CertificateEmail] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.retrieve_certificate_email_history.metadata['url'] + url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[CertificateEmail]', response) + deserialized = self._deserialize('[CertificateEmail]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} + retrieve_certificate_email_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py index cc00719e9ded..d4f22f651f54 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py @@ -1,2557 +1,2838 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServiceEnvironmentsOperations(object): """AppServiceEnvironmentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceEnvironmentCollection"] """Get all App Service Environments for a subscription. Description for Get all App Service Environments for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceEnvironmentResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResourcePaged[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceEnvironmentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServiceEnvironmentCollection"] """Get all App Service Environments in a resource group. Description for Get all App Service Environments in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServiceEnvironmentResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResourcePaged[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServiceEnvironmentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceEnvironmentResource" """Get the properties of an App Service Environment. Description for Get the properties of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceEnvironmentResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceEnvironmentResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServiceEnvironmentResource"] """Create or update an App Service Environment. Description for Create or update an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param hosting_environment_envelope: Configuration details of the App - Service Environment. - :type hosting_environment_envelope: - ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - AppServiceEnvironmentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServiceEnvironmentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - hosting_environment_envelope=hosting_environment_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServiceEnvironmentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + hosting_environment_envelope=hosting_environment_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} - + 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 + ) + 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.Web/hostingEnvironments/{name}'} # type: ignore def _delete_initial( - self, resource_group_name, name, force_delete=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + force_delete=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if force_delete is not None: query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, name, force_delete=None, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + name, # type: str + force_delete=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete an App Service Environment. Description for Delete an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param force_delete: Specify true to force the deletion - even if the App Service Environment contains resources. The default is - false. + :param force_delete: Specify :code:`true` to force the deletion even if the App + Service Environment contains resources. The default is :code:`false`. :type force_delete: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - name=name, - force_delete=force_delete, - custom_headers=custom_headers, - raw=True, - **operation_config + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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, + name=name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def update( - self, resource_group_name, name, hosting_environment_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + hosting_environment_envelope, # type: "models.AppServiceEnvironmentPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServiceEnvironmentResource" """Create or update an App Service Environment. Description for Create or update an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param hosting_environment_envelope: Configuration details of the App - Service Environment. - :type hosting_environment_envelope: - ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServiceEnvironmentResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param hosting_environment_envelope: Configuration details of the App Service Environment. + :type hosting_environment_envelope: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServiceEnvironmentResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServiceEnvironmentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServiceEnvironmentResource', response) + deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'} # type: ignore def list_capacities( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the used, available, and total worker capacity an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StampCapacityCollection"] + """Get the used, available, and total worker capacity an App Service Environment. - Description for Get the used, available, and total worker capacity an - App Service Environment. + Description for Get the used, available, and total worker capacity an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StampCapacity - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StampCapacityPaged[~azure.mgmt.web.v2019_08_01.models.StampCapacity] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StampCapacityCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StampCapacityCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_capacities.metadata['url'] + url = self.list_capacities.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StampCapacityCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StampCapacityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} + return ItemPaged( + get_next, extract_data + ) + list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'} # type: ignore def get_vip_info( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AddressResponse" """Get IP addresses assigned to an App Service Environment. - Description for Get IP addresses assigned to an App Service - Environment. + Description for Get IP addresses assigned to an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AddressResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.AddressResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AddressResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vip_info.metadata['url'] + url = self.get_vip_info.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AddressResponse', response) + deserialized = self._deserialize('AddressResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vip_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} - + get_vip_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'} # type: ignore def _change_vnet_initial( - self, resource_group_name, name, id=None, subnet=None, custom_headers=None, raw=False, **operation_config): - vnet_info = models.VirtualNetworkProfile(id=id, subnet=subnet) + self, + resource_group_name, # type: str + name, # type: str + vnet_info, # type: "models.VirtualNetworkProfile" + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.change_vnet.metadata['url'] + url = self._change_vnet_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def change_vnet( - self, resource_group_name, name, id=None, subnet=None, custom_headers=None, raw=False, polling=True, **operation_config): + _change_vnet_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore + + def begin_change_vnet( + self, + resource_group_name, # type: str + name, # type: str + vnet_info, # type: "models.VirtualNetworkProfile" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Move an App Service Environment to a different VNET. Description for Move an App Service Environment to a different VNET. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param id: Resource id of the Virtual Network. - :type id: str - :param subnet: Subnet within the Virtual Network. - :type subnet: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param vnet_info: Details for the new virtual network. + :type vnet_info: ~azure.mgmt.web.v2019_08_01.models.VirtualNetworkProfile + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._change_vnet_initial( - resource_group_name=resource_group_name, - name=name, - id=id, - subnet=subnet, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.change_vnet.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - return deserialized + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._change_vnet_initial( + resource_group_name=resource_group_name, + name=name, + vnet_info=vnet_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - change_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_change_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork'} # type: ignore def list_diagnostics( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.HostingEnvironmentDiagnostics"] """Get diagnostic information for an App Service Environment. - Description for Get diagnostic information for an App Service - Environment. + Description for Get diagnostic information for an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDiagnostics] - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDiagnostics] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_diagnostics.metadata['url'] + url = self.list_diagnostics.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', response) + deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} + list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'} # type: ignore def get_diagnostics_item( - self, resource_group_name, name, diagnostics_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + diagnostics_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostingEnvironmentDiagnostics" """Get a diagnostics item for an App Service Environment. Description for Get a diagnostics item for an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param diagnostics_name: Name of the diagnostics item. :type diagnostics_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostingEnvironmentDiagnostics or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDiagnostics or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostingEnvironmentDiagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostingEnvironmentDiagnostics + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_diagnostics_item.metadata['url'] + url = self.get_diagnostics_item.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostingEnvironmentDiagnostics', response) + deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} + get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'} # type: ignore def get_inbound_network_dependencies_endpoints( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the network endpoints of all inbound dependencies of an App Service + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.InboundEnvironmentEndpointCollection"] + """Get the network endpoints of all inbound dependencies of an App Service Environment. + + Description for Get the network endpoints of all inbound dependencies of an App Service Environment. - Description for Get the network endpoints of all inbound dependencies - of an App Service Environment. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of InboundEnvironmentEndpoint - :rtype: - ~azure.mgmt.web.v2019_08_01.models.InboundEnvironmentEndpointPaged[~azure.mgmt.web.v2019_08_01.models.InboundEnvironmentEndpoint] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.InboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_inbound_network_dependencies_endpoints.metadata['url'] + url = self.get_inbound_network_dependencies_endpoints.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('InboundEnvironmentEndpointCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.InboundEnvironmentEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_inbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints'} + return ItemPaged( + get_next, extract_data + ) + get_inbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints'} # type: ignore def list_multi_role_pools( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkerPoolCollection"] """Get all multi-role pools. Description for Get all multi-role pools. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WorkerPoolResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResourcePaged[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pools.metadata['url'] + url = self.list_multi_role_pools.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkerPoolCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkerPoolResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'} # type: ignore def get_multi_role_pool( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Get properties of a multi-role pool. Description for Get properties of a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_multi_role_pool.metadata['url'] + url = self.get_multi_role_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} - + get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def _create_or_update_multi_role_pool_initial( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_multi_role_pool.metadata['url'] + url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_multi_role_pool( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore + + def begin_create_or_update_multi_role_pool( + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WorkerPoolResource"] """Create or update a multi-role pool. Description for Create or update a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param multi_role_pool_envelope: Properties of the multi-role pool. - :type multi_role_pool_envelope: - ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type multi_role_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkerPoolResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_multi_role_pool_initial( - resource_group_name=resource_group_name, - name=name, - multi_role_pool_envelope=multi_role_pool_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkerPoolResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_multi_role_pool_initial( + resource_group_name=resource_group_name, + name=name, + multi_role_pool_envelope=multi_role_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def update_multi_role_pool( - self, resource_group_name, name, multi_role_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + multi_role_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Create or update a multi-role pool. Description for Create or update a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param multi_role_pool_envelope: Properties of the multi-role pool. - :type multi_role_pool_envelope: - ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type multi_role_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_multi_role_pool.metadata['url'] + url = self.update_multi_role_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} + update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'} # type: ignore def list_multi_role_pool_instance_metric_definitions( - self, resource_group_name, name, instance, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a specific instance of a multi-role pool of - an App Service Environment. - - Description for Get metric definitions for a specific instance of a - multi-role pool of an App Service Environment. + self, + resource_group_name, # type: str + name, # type: str + instance, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + + Description for Get metric definitions for a specific instance of a multi-role pool of an App + Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param instance: Name of the instance in the multi-role pool. :type instance: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] + url = self.list_multi_role_pool_instance_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'} # type: ignore def list_multi_role_metric_definitions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a multi-role pool of an App Service - Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a multi-role pool of an App Service Environment. - Description for Get metric definitions for a multi-role pool of an App - Service Environment. + Description for Get metric definitions for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_metric_definitions.metadata['url'] + url = self.list_multi_role_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'} # type: ignore def list_multi_role_pool_skus( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SkuInfoCollection"] """Get available SKUs for scaling a multi-role pool. Description for Get available SKUs for scaling a multi-role pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SkuInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SkuInfoPaged[~azure.mgmt.web.v2019_08_01.models.SkuInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_pool_skus.metadata['url'] + url = self.list_multi_role_pool_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SkuInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'} # type: ignore def list_multi_role_usages( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UsageCollection"] """Get usage metrics for a multi-role pool of an App Service Environment. - Description for Get usage metrics for a multi-role pool of an App - Service Environment. + Description for Get usage metrics for a multi-role pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Usage - :rtype: - ~azure.mgmt.web.v2019_08_01.models.UsagePaged[~azure.mgmt.web.v2019_08_01.models.Usage] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_multi_role_usages.metadata['url'] + url = self.list_multi_role_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} + return ItemPaged( + get_next, extract_data + ) + list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'} # type: ignore def list_operations( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.Operation"] """List all currently running operations on the App Service Environment. - Description for List all currently running operations on the App - Service Environment. + Description for List all currently running operations on the App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.Operation] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Operation, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.Operation] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_operations.metadata['url'] + url = self.list_operations.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[Operation]', response) + deserialized = self._deserialize('[Operation]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} + list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'} # type: ignore def get_outbound_network_dependencies_endpoints( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the network endpoints of all outbound dependencies of an App - Service Environment. - - Description for Get the network endpoints of all outbound dependencies - of an App Service Environment. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OutboundEnvironmentEndpointCollection"] + """Get the network endpoints of all outbound dependencies of an App Service Environment. + + Description for Get the network endpoints of all outbound dependencies of an App Service + Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OutboundEnvironmentEndpoint - :rtype: - ~azure.mgmt.web.v2019_08_01.models.OutboundEnvironmentEndpointPaged[~azure.mgmt.web.v2019_08_01.models.OutboundEnvironmentEndpoint] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.OutboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_outbound_network_dependencies_endpoints.metadata['url'] + url = self.get_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OutboundEnvironmentEndpointCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OutboundEnvironmentEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints'} + return ItemPaged( + get_next, extract_data + ) + get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints'} # type: ignore def reboot( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reboot all machines in an App Service Environment. Description for Reboot all machines in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reboot.metadata['url'] + url = self.reboot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} + if cls: + return cls(pipeline_response, None, {}) + reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'} # type: ignore def _resume_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.resume.metadata['url'] + url = self._resume_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def resume( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore + + def begin_resume( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Resume an App Service Environment. Description for Resume an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._resume_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if not next_link: + # Construct URL + url = self.resume.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - return deserialized + request = self._client.post(url, query_parameters, header_parameters) + else: + 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('WebAppCollection', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._resume_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'} # type: ignore def list_app_service_plans( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans in an App Service Environment. - Description for Get all App Service plans in an App Service - Environment. + Description for Get all App Service plans in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServicePlanPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_app_service_plans.metadata['url'] + url = self.list_app_service_plans.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'} # type: ignore def list_web_apps( - self, resource_group_name, name, properties_to_include=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + properties_to_include=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps in an App Service Environment. Description for Get all apps in an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param properties_to_include: Comma separated list of app properties - to include. + :param properties_to_include: Comma separated list of app properties to include. :type properties_to_include: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SitePaged[~azure.mgmt.web.v2019_08_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps.metadata['url'] + url = self.list_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if properties_to_include is not None: query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'} # type: ignore def _suspend_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebAppCollection" + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.suspend.metadata['url'] + url = self._suspend_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WebAppCollection', response) + deserialized = self._deserialize('WebAppCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def suspend( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore + + def begin_suspend( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[ItemPaged["models.WebAppCollection"]] """Suspend an App Service Environment. Description for Suspend an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WebAppCollection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection]] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._suspend_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' - def get_long_running_output(response): - deserialized = self._deserialize('WebAppCollection', response) + if not next_link: + # Construct URL + url = self.suspend.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request - return deserialized + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + lro_delay = kwargs.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._suspend_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + else: + return get_next(next_link) + + return ItemPaged( + internal_get_next, extract_data + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] """Get global usage metrics of an App Service Environment. Description for Get global usage metrics of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2') and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq + duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'} # type: ignore def list_worker_pools( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkerPoolCollection"] """Get all worker pools of an App Service Environment. Description for Get all worker pools of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WorkerPoolResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResourcePaged[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WorkerPoolCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pools.metadata['url'] + url = self.list_worker_pools.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkerPoolCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkerPoolResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'} # type: ignore def get_worker_pool( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Get properties of a worker pool. Description for Get properties of a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_worker_pool.metadata['url'] + url = self.get_worker_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} - + get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def _create_or_update_worker_pool_initial( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_worker_pool.metadata['url'] + url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update_worker_pool( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore + + def begin_create_or_update_worker_pool( + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WorkerPoolResource"] """Create or update a worker pool. Description for Create or update a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str :param worker_pool_envelope: Properties of the worker pool. - :type worker_pool_envelope: - ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type worker_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkerPoolResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkerPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_worker_pool_initial( - resource_group_name=resource_group_name, - name=name, - worker_pool_name=worker_pool_name, - worker_pool_envelope=worker_pool_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkerPoolResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_worker_pool_initial( + resource_group_name=resource_group_name, + name=name, + worker_pool_name=worker_pool_name, + worker_pool_envelope=worker_pool_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def update_worker_pool( - self, resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + worker_pool_envelope, # type: "models.WorkerPoolResource" + **kwargs # type: Any + ): + # type: (...) -> "models.WorkerPoolResource" """Create or update a worker pool. Description for Create or update a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str :param worker_pool_envelope: Properties of the worker pool. - :type worker_pool_envelope: - ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkerPoolResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type worker_pool_envelope: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkerPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WorkerPoolResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_worker_pool.metadata['url'] + url = self.update_worker_pool.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkerPoolResource', response) + deserialized = self._deserialize('WorkerPoolResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} + update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'} # type: ignore def list_worker_pool_instance_metric_definitions( - self, resource_group_name, name, worker_pool_name, instance, custom_headers=None, raw=False, **operation_config): - """Get metric definitions for a specific instance of a worker pool of an - App Service Environment. - - Description for Get metric definitions for a specific instance of a - worker pool of an App Service Environment. + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + instance, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] + """Get metric definitions for a specific instance of a worker pool of an App Service Environment. + + Description for Get metric definitions for a specific instance of a worker pool of an App + Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str @@ -2559,300 +2840,301 @@ def list_worker_pool_instance_metric_definitions( :type worker_pool_name: str :param instance: Name of the instance in the worker pool. :type instance: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_instance_metric_definitions.metadata['url'] + url = self.list_worker_pool_instance_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), 'instance': self._serialize.url("instance", instance, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'} # type: ignore def list_web_worker_metric_definitions( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceMetricDefinitionCollection"] """Get metric definitions for a worker pool of an App Service Environment. - Description for Get metric definitions for a worker pool of an App - Service Environment. + Description for Get metric definitions for a worker pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceMetricDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceMetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_metric_definitions.metadata['url'] + url = self.list_web_worker_metric_definitions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceMetricDefinitionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'} # type: ignore def list_worker_pool_skus( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SkuInfoCollection"] """Get available SKUs for scaling a worker pool. Description for Get available SKUs for scaling a worker pool. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SkuInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SkuInfoPaged[~azure.mgmt.web.v2019_08_01.models.SkuInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SkuInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_worker_pool_skus.metadata['url'] + url = self.list_worker_pool_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SkuInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} + return ItemPaged( + get_next, extract_data + ) + list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'} # type: ignore def list_web_worker_usages( - self, resource_group_name, name, worker_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UsageCollection"] """Get usage metrics for a worker pool of an App Service Environment. - Description for Get usage metrics for a worker pool of an App Service - Environment. + Description for Get usage metrics for a worker pool of an App Service Environment. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service Environment. :type name: str :param worker_pool_name: Name of the worker pool. :type worker_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Usage - :rtype: - ~azure.mgmt.web.v2019_08_01.models.UsagePaged[~azure.mgmt.web.v2019_08_01.models.Usage] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.UsageCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_worker_usages.metadata['url'] + url = self.list_web_worker_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py index 9e251b268896..48c54091515f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py @@ -1,557 +1,583 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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 AppServicePlansOperations(object): """AppServicePlansOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, detailed=None, custom_headers=None, raw=False, **operation_config): + self, + detailed=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans for a subscription. Description for Get all App Service plans for a subscription. - :param detailed: Specify true to return all App Service - plan properties. The default is false, which returns a - subset of the properties. - Retrieval of all properties may increase the API latency. + :param detailed: Specify :code:`true` to return all App Service plan properties. + The default is :code:`false`, which returns a subset of the properties. + Retrieval of all properties may increase the API latency. :type detailed: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServicePlanPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if detailed is not None: query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AppServicePlanCollection"] """Get all App Service plans in a resource group. Description for Get all App Service plans in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppServicePlan - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AppServicePlanPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.AppServicePlanCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppServicePlanCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AppServicePlan"] """Get an App Service plan. Description for Get an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServicePlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlan" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServicePlan" + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlan" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AppServicePlan"] """Creates or updates an App Service Plan. Description for Creates or updates an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param app_service_plan: Details of the App Service plan. - :type app_service_plan: - ~azure.mgmt.web.v2019_08_01.models.AppServicePlan - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type app_service_plan: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns AppServicePlan or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.AppServicePlan]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppServicePlan or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.AppServicePlan] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - app_service_plan=app_service_plan, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppServicePlan', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + app_service_plan=app_service_plan, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppServicePlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + 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 + ) + 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.Web/serverfarms/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an App Service plan. Description for Delete an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def update( - self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_service_plan, # type: "models.AppServicePlanPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AppServicePlan" """Creates or updates an App Service Plan. Description for Creates or updates an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param app_service_plan: Details of the App Service plan. - :type app_service_plan: - ~azure.mgmt.web.v2019_08_01.models.AppServicePlanPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppServicePlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type app_service_plan: ~azure.mgmt.web.v2019_08_01.models.AppServicePlanPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppServicePlan, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AppServicePlan + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppServicePlan', response) + deserialized = self._deserialize('AppServicePlan', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'} # type: ignore def list_capabilities( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.Capability"] """List all capabilities of an App Service plan. Description for List all capabilities of an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.Capability] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of Capability, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.Capability] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_capabilities.metadata['url'] + url = self.list_capabilities.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[Capability]', response) + deserialized = self._deserialize('[Capability]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} + list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'} # type: ignore def get_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieve a Hybrid Connection in use in an App Service plan. - Description for Retrieve a Hybrid Connection in use in an App Service - plan. + Description for Retrieve a Hybrid Connection in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -559,69 +585,66 @@ def get_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_hybrid_connection.metadata['url'] + url = self.get_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Hybrid Connection in use in an App Service plan. - Description for Delete a Hybrid Connection in use in an App Service - plan. + Description for Delete a Hybrid Connection in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -629,60 +652,62 @@ def delete_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_hybrid_connection.metadata['url'] + url = self.delete_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connection_keys( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionKey" """Get the send key name and value of a Hybrid Connection. Description for Get the send key name and value of a Hybrid Connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -690,69 +715,66 @@ def list_hybrid_connection_keys( :type namespace_name: str :param relay_name: The name of the Service Bus relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnectionKey or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionKey, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnectionKey + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_hybrid_connection_keys.metadata['url'] + url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnectionKey', response) + deserialized = self._deserialize('HybridConnectionKey', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} + list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'} # type: ignore def list_web_apps_by_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceCollection"] """Get all apps that use a Hybrid Connection in an App Service Plan. - Description for Get all apps that use a Hybrid Connection in an App - Service Plan. + Description for Get all apps that use a Hybrid Connection in an App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -760,858 +782,842 @@ def list_web_apps_by_hybrid_connection( :type namespace_name: str :param relay_name: Name of the Hybrid Connection relay. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of str - :rtype: ~azure.mgmt.web.v2019_08_01.models.StrPaged[str] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps_by_hybrid_connection.metadata['url'] + url = self.list_web_apps_by_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StrPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} + return ItemPaged( + get_next, extract_data + ) + list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'} # type: ignore def get_hybrid_connection_plan_limit( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get the maximum number of Hybrid Connections allowed in an App Service - plan. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnectionLimits" + """Get the maximum number of Hybrid Connections allowed in an App Service plan. - Description for Get the maximum number of Hybrid Connections allowed in - an App Service plan. + Description for Get the maximum number of Hybrid Connections allowed in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnectionLimits or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnectionLimits or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnectionLimits, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnectionLimits + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_hybrid_connection_plan_limit.metadata['url'] + url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnectionLimits', response) + deserialized = self._deserialize('HybridConnectionLimits', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} + get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'} # type: ignore def list_hybrid_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HybridConnectionCollection"] """Retrieve all Hybrid Connections in use in an App Service plan. - Description for Retrieve all Hybrid Connections in use in an App - Service plan. + Description for Retrieve all Hybrid Connections in use in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HybridConnection - :rtype: - ~azure.mgmt.web.v2019_08_01.models.HybridConnectionPaged[~azure.mgmt.web.v2019_08_01.models.HybridConnection] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridConnectionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.HybridConnectionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_hybrid_connections.metadata['url'] + url = self.list_hybrid_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HybridConnectionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} + return ItemPaged( + get_next, extract_data + ) + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'} # type: ignore def restart_web_apps( - self, resource_group_name, name, soft_restart=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + soft_restart=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restart all apps in an App Service plan. Description for Restart all apps in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param soft_restart: Specify true to perform a soft - restart, applies the configuration settings and restarts the apps if - necessary. The default is false, which always restarts - and reprovisions the apps + :param soft_restart: Specify :code:`true` to perform a soft restart, applies the + configuration settings and restarts the apps if necessary. The default is + :code:`false`, which always restarts and reprovisions the apps. :type soft_restart: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.restart_web_apps.metadata['url'] + url = self.restart_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} + if cls: + return cls(pipeline_response, None, {}) + + restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'} # type: ignore def list_web_apps( - self, resource_group_name, name, skip_token=None, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + top=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps associated with an App Service plan. Description for Get all apps associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param skip_token: Skip to a web app in the list of webapps associated - with app service plan. If specified, the resulting list will contain - web apps starting from (including) the skipToken. Otherwise, the - resulting list contains web apps from the start of the list + :param skip_token: Skip to a web app in the list of webapps associated with app service plan. + If specified, the resulting list will contain web apps starting from (including) the skipToken. + Otherwise, the resulting list contains web apps from the start of the list. :type skip_token: str - :param filter: Supported filter: $filter=state eq running. Returns - only web apps that are currently running + :param filter: Supported filter: $filter=state eq running. Returns only web apps that are + currently running. :type filter: str :param top: List page size. If specified, results are paged. :type top: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SitePaged[~azure.mgmt.web.v2019_08_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_apps.metadata['url'] + url = self.list_web_apps.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} + return ItemPaged( + get_next, extract_data + ) + list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'} # type: ignore def get_server_farm_skus( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> object """Gets all selectable SKUs for a given App Service Plan. Description for Gets all selectable SKUs for a given App Service Plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of App Service Plan + :param name: Name of App Service Plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_server_farm_skus.metadata['url'] + url = self.get_server_farm_skus.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} + get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] """Gets server farm usage information. Description for Gets server farm usage information. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of App Service Plan + :param name: Name of App Service Plan. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(name.value eq - 'Metric1' or name.value eq 'Metric2'). + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'} # type: ignore def list_vnets( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Get all Virtual Networks associated with an App Service plan. - Description for Get all Virtual Networks associated with an App Service - plan. + Description for Get all Virtual Networks associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_vnets.metadata['url'] + url = self.list_vnets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} + list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'} # type: ignore def get_vnet_from_server_farm( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetInfo"] """Get a Virtual Network associated with an App Service plan. - Description for Get a Virtual Network associated with an App Service - plan. + Description for Get a Virtual Network associated with an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vnet_from_server_farm.metadata['url'] + url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} + get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_gateway( - self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" """Get a Virtual Network gateway. Description for Get a Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Only the 'primary' gateway - is supported. + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. :type gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vnet_gateway.metadata['url'] + url = self.get_vnet_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" """Update a Virtual Network gateway. Description for Update a Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Only the 'primary' gateway - is supported. + :param gateway_name: Name of the gateway. Only the 'primary' gateway is supported. :type gateway_name: str :param connection_envelope: Definition of the gateway. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_gateway.metadata['url'] + url = self.update_vnet_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_routes_for_vnet( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Get all routes that are associated with a Virtual Network in an App - Service plan. - - Description for Get all routes that are associated with a Virtual - Network in an App Service plan. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetRoute"] + """Get all routes that are associated with a Virtual Network in an App Service plan. + + Description for Get all routes that are associated with a Virtual Network in an App Service + plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_routes_for_vnet.metadata['url'] + url = self.list_routes_for_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetRoute]', response) + deserialized = self._deserialize('[VnetRoute]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} + list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'} # type: ignore def get_route_for_vnet( - self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[List["models.VnetRoute"]] """Get a Virtual Network route in an App Service plan. Description for Get a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1619,69 +1625,69 @@ def get_route_for_vnet( :type vnet_name: str :param route_name: Name of the Virtual Network route. :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetRoute, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetRoute] or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_route_for_vnet.metadata['url'] + url = self.get_route_for_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[VnetRoute]', response) + deserialized = self._deserialize('[VnetRoute]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def create_or_update_vnet_route( - self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + route, # type: "models.VnetRoute" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetRoute"] """Create or update a Virtual Network route in an App Service plan. - Description for Create or update a Virtual Network route in an App - Service plan. + Description for Create or update a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1691,72 +1697,74 @@ def create_or_update_vnet_route( :type route_name: str :param route: Definition of the Virtual Network route. :type route: ~azure.mgmt.web.v2019_08_01.models.VnetRoute - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetRoute or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetRoute or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_route.metadata['url'] + url = self.create_or_update_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 400, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VnetRoute', response) + deserialized = self._deserialize('VnetRoute', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def delete_vnet_route( - self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Virtual Network route in an App Service plan. Description for Delete a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1764,61 +1772,63 @@ def delete_vnet_route( :type vnet_name: str :param route_name: Name of the Virtual Network route. :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_vnet_route.metadata['url'] + url = self.delete_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def update_vnet_route( - self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + route_name, # type: str + route, # type: "models.VnetRoute" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetRoute"] """Create or update a Virtual Network route in an App Service plan. - Description for Create or update a Virtual Network route in an App - Service plan. + Description for Create or update a Virtual Network route in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str @@ -1828,119 +1838,115 @@ def update_vnet_route( :type route_name: str :param route: Definition of the Virtual Network route. :type route: ~azure.mgmt.web.v2019_08_01.models.VnetRoute - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetRoute or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetRoute or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetRoute, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetRoute or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_route.metadata['url'] + url = self.update_vnet_route.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 400, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VnetRoute', response) + deserialized = self._deserialize('VnetRoute', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} + update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'} # type: ignore def reboot_worker( - self, resource_group_name, name, worker_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + worker_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reboot a worker machine in an App Service plan. Description for Reboot a worker machine in an App Service plan. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the App Service plan. :type name: str - :param worker_name: Name of worker machine, which typically starts - with RD. + :param worker_name: Name of worker machine, which typically starts with RD. :type worker_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reboot_worker.metadata['url'] + url = self.reboot_worker.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'workerName': self._serialize.url("worker_name", worker_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} + reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py index 7343d0e63931..9b5600e243ad 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py @@ -1,104 +1,110 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificateRegistrationProviderOperations(object): """CertificateRegistrationProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - Description for Implements Csm operations Api to exposes the list of - available Csm Apis under the resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationDescription] - :raises: - :class:`DefaultErrorResponseException` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Description for Implements Csm operations Api to exposes the list of available Csm Apis under + the resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.CertificateRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py index 3f969cef5551..73faf7c1b7f0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py @@ -1,437 +1,434 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates for a subscription. Description for Get all certificates for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CertificatePaged[~azure.mgmt.web.v2019_08_01.models.Certificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateCollection"] """Get all certificates in a resource group. Description for Get all certificates in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Certificate - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CertificatePaged[~azure.mgmt.web.v2019_08_01.models.Certificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Get a certificate. Description for Get a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def create_or_update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.Certificate" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Description for Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2019_08_01.models.Certificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2019_08_01.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def delete( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a certificate. Description for Delete a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore def update( - self, resource_group_name, name, certificate_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + certificate_envelope, # type: "models.CertificatePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Certificate" """Create or update a certificate. Description for Create or update a certificate. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the certificate. :type name: str - :param certificate_envelope: Details of certificate, if it exists - already. - :type certificate_envelope: - ~azure.mgmt.web.v2019_08_01.models.CertificatePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Certificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param certificate_envelope: Details of certificate, if it exists already. + :type certificate_envelope: ~azure.mgmt.web.v2019_08_01.models.CertificatePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Certificate', response) + deserialized = self._deserialize('Certificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py index 56e571170281..bcf458372363 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py @@ -1,238 +1,243 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DeletedWebAppsOperations(object): """DeletedWebAppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedWebAppCollection"] """Get all deleted apps for a subscription. Description for Get all deleted apps for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedSite - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DeletedSitePaged[~azure.mgmt.web.v2019_08_01.models.DeletedSite] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedWebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedSitePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites'} # type: ignore def list_by_location( - self, location, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedWebAppCollection"] """Get all deleted apps for a subscription at location. Description for Get all deleted apps for a subscription at location. :param location: :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedSite - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DeletedSitePaged[~azure.mgmt.web.v2019_08_01.models.DeletedSite] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedWebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DeletedWebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_location.metadata['url'] + url = self.list_by_location.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedWebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedSitePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites'} + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites'} # type: ignore def get_deleted_web_app_by_location( - self, location, deleted_site_id, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + deleted_site_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSite" """Get deleted app for a subscription at location. Description for Get deleted app for a subscription at location. :param location: :type location: str - :param deleted_site_id: The numeric ID of the deleted app, e.g. 12345 + :param deleted_site_id: The numeric ID of the deleted app, e.g. 12345. :type deleted_site_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeletedSite or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DeletedSite or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSite, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DeletedSite + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_deleted_web_app_by_location.metadata['url'] + url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), 'deletedSiteId': self._serialize.url("deleted_site_id", deleted_site_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSite', response) + deserialized = self._deserialize('DeletedSite', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_web_app_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}'} + get_deleted_web_app_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py index bafb68e7b58e..f282883b06d2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py @@ -1,1713 +1,1734 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DiagnosticsOperations(object): """DiagnosticsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list_hosting_environment_detector_responses( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Hosting Environment Detector Responses. Description for List Hosting Environment Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Site Name + :param name: Site Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DetectorResponsePaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_hosting_environment_detector_responses.metadata['url'] + url = self.list_hosting_environment_detector_responses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_hosting_environment_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors'} # type: ignore def get_hosting_environment_detector_response( - self, resource_group_name, name, detector_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + detector_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get Hosting Environment Detector Response. Description for Get Hosting Environment Detector Response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: App Service Environment Name + :param name: App Service Environment Name. :type name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_hosting_environment_detector_response.metadata['url'] + url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} + get_hosting_environment_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}'} # type: ignore def list_site_detector_responses( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Site Detector Responses. Description for List Site Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DetectorResponsePaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detector_responses.metadata['url'] + url = self.list_site_detector_responses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detector_responses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors'} # type: ignore def get_site_detector_response( - self, resource_group_name, site_name, detector_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get site detector response. Description for Get site detector response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_detector_response.metadata['url'] + url = self.get_site_detector_response.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} + get_site_detector_response.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}'} # type: ignore def list_site_diagnostic_categories( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticCategoryCollection"] """Get Diagnostics Categories. Description for Get Diagnostics Categories. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DiagnosticCategory - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategoryPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_diagnostic_categories.metadata['url'] + url = self.list_site_diagnostic_categories.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticCategoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiagnosticCategoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} + return ItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics'} # type: ignore def get_site_diagnostic_category( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticCategory" """Get Diagnostics Category. Description for Get Diagnostics Category. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticCategory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_diagnostic_category.metadata['url'] + url = self.get_site_diagnostic_category.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticCategory', response) + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} + get_site_diagnostic_category.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}'} # type: ignore def list_site_analyses( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticAnalysisCollection"] """Get Site Analyses. Description for Get Site Analyses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AnalysisDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_analyses.metadata['url'] + url = self.list_site_analyses.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticAnalysisCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AnalysisDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} + return ItemPaged( + get_next, extract_data + ) + list_site_analyses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore def get_site_analysis( - self, resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AnalysisDefinition" """Get Site Analysis. Description for Get Site Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param analysis_name: Analysis Name + :param analysis_name: Analysis Name. :type analysis_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AnalysisDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_analysis.metadata['url'] + url = self.get_site_analysis.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AnalysisDefinition', response) + deserialized = self._deserialize('AnalysisDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} + get_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore def execute_site_analysis( - self, resource_group_name, site_name, diagnostic_category, analysis_name, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Execute Analysis. Description for Execute Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param analysis_name: Analysis Resource Name + :param analysis_name: Analysis Resource Name. :type analysis_name: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.execute_site_analysis.metadata['url'] + url = self.execute_site_analysis.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} + execute_site_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore def list_site_detectors( - self, resource_group_name, site_name, diagnostic_category, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detectors. Description for Get Detectors. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detectors.metadata['url'] + url = self.list_site_detectors.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore def get_site_detector( - self, resource_group_name, site_name, diagnostic_category, detector_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + detector_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorDefinition" """Get Detector. Description for Get Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param detector_name: Detector Name + :param detector_name: Detector Name. :type detector_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_detector.metadata['url'] + url = self.get_site_detector.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorDefinition', response) + deserialized = self._deserialize('DetectorDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} + get_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore def execute_site_detector( - self, resource_group_name, site_name, detector_name, diagnostic_category, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + diagnostic_category, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticDetectorResponse" """Execute Detector. Description for Execute Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticDetectorResponse or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorResponse - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.execute_site_detector.metadata['url'] + url = self.execute_site_detector.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticDetectorResponse', response) + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} + execute_site_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore def list_site_detector_responses_slot( - self, resource_group_name, site_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DetectorResponseCollection"] """List Site Detector Responses. Description for List Site Detector Responses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorResponse - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DetectorResponsePaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorResponseCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DetectorResponseCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detector_responses_slot.metadata['url'] + url = self.list_site_detector_responses_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DetectorResponseCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detector_responses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors'} # type: ignore def get_site_detector_response_slot( - self, resource_group_name, site_name, detector_name, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorResponse" """Get site detector response. Description for Get site detector response. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_detector_response_slot.metadata['url'] + url = self.get_site_detector_response_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorResponse', response) + deserialized = self._deserialize('DetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} + get_site_detector_response_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}'} # type: ignore def list_site_diagnostic_categories_slot( - self, resource_group_name, site_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticCategoryCollection"] """Get Diagnostics Categories. Description for Get Diagnostics Categories. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DiagnosticCategory - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategoryPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticCategoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticCategoryCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_diagnostic_categories_slot.metadata['url'] + url = self.list_site_diagnostic_categories_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticCategoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiagnosticCategoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} + return ItemPaged( + get_next, extract_data + ) + list_site_diagnostic_categories_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics'} # type: ignore def get_site_diagnostic_category_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticCategory" """Get Diagnostics Category. Description for Get Diagnostics Category. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticCategory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticCategory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticCategory + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_diagnostic_category_slot.metadata['url'] + url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticCategory', response) + deserialized = self._deserialize('DiagnosticCategory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} + get_site_diagnostic_category_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}'} # type: ignore def list_site_analyses_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticAnalysisCollection"] """Get Site Analyses. Description for Get Site Analyses. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AnalysisDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticAnalysisCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysisCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_analyses_slot.metadata['url'] + url = self.list_site_analyses_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticAnalysisCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AnalysisDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} + return ItemPaged( + get_next, extract_data + ) + list_site_analyses_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses'} # type: ignore def get_site_analysis_slot( - self, resource_group_name, site_name, diagnostic_category, analysis_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AnalysisDefinition" """Get Site Analysis. Description for Get Site Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param analysis_name: Analysis Name + :param analysis_name: Analysis Name. :type analysis_name: str - :param slot: Slot - optional + :param slot: Slot - optional. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AnalysisDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AnalysisDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_analysis_slot.metadata['url'] + url = self.get_site_analysis_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AnalysisDefinition', response) + deserialized = self._deserialize('AnalysisDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} + get_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}'} # type: ignore def execute_site_analysis_slot( - self, resource_group_name, site_name, diagnostic_category, analysis_name, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + analysis_name, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticAnalysis" """Execute Analysis. Description for Execute Analysis. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param analysis_name: Analysis Resource Name + :param analysis_name: Analysis Resource Name. :type analysis_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticAnalysis or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysis or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticAnalysis, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticAnalysis + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.execute_site_analysis_slot.metadata['url'] + url = self.execute_site_analysis_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'analysisName': self._serialize.url("analysis_name", analysis_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticAnalysis', response) + deserialized = self._deserialize('DiagnosticAnalysis', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} + execute_site_analysis_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute'} # type: ignore def list_site_detectors_slot( - self, resource_group_name, site_name, diagnostic_category, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DiagnosticDetectorCollection"] """Get Detectors. Description for Get Detectors. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DetectorDefinition - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DetectorDefinitionPaged[~azure.mgmt.web.v2019_08_01.models.DetectorDefinition] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticDetectorCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_detectors_slot.metadata['url'] + url = self.list_site_detectors_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticDetectorCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DetectorDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} + return ItemPaged( + get_next, extract_data + ) + list_site_detectors_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors'} # type: ignore def get_site_detector_slot( - self, resource_group_name, site_name, diagnostic_category, detector_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + diagnostic_category, # type: str + detector_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DetectorDefinition" """Get Detector. Description for Get Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param diagnostic_category: Diagnostic Category + :param diagnostic_category: Diagnostic Category. :type diagnostic_category: str - :param detector_name: Detector Name + :param detector_name: Detector Name. :type detector_name: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DetectorDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DetectorDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_detector_slot.metadata['url'] + url = self.get_site_detector_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DetectorDefinition', response) + deserialized = self._deserialize('DetectorDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} + get_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}'} # type: ignore def execute_site_detector_slot( - self, resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time=None, end_time=None, time_grain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + detector_name, # type: str + diagnostic_category, # type: str + slot, # type: str + start_time=None, # type: Optional[datetime.datetime] + end_time=None, # type: Optional[datetime.datetime] + time_grain=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnosticDetectorResponse" """Execute Detector. Description for Execute Detector. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site Name + :param site_name: Site Name. :type site_name: str - :param detector_name: Detector Resource Name + :param detector_name: Detector Resource Name. :type detector_name: str - :param diagnostic_category: Category Name + :param diagnostic_category: Category Name. :type diagnostic_category: str - :param slot: Slot Name + :param slot: Slot Name. :type slot: str - :param start_time: Start Time - :type start_time: datetime - :param end_time: End Time - :type end_time: datetime - :param time_grain: Time Grain + :param start_time: Start Time. + :type start_time: ~datetime.datetime + :param end_time: End Time. + :type end_time: ~datetime.datetime + :param time_grain: Time Grain. :type time_grain: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DiagnosticDetectorResponse or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticDetectorResponse, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.DiagnosticDetectorResponse - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.execute_site_detector_slot.metadata['url'] + url = self.execute_site_detector_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'detectorName': self._serialize.url("detector_name", detector_name, 'str'), 'diagnosticCategory': self._serialize.url("diagnostic_category", diagnostic_category, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'iso-8601') if end_time is not None: query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'iso-8601') if time_grain is not None: query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str', pattern=r'PT[1-9][0-9]+[SMH]') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnosticDetectorResponse', response) + deserialized = self._deserialize('DiagnosticDetectorResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} + execute_site_detector_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py index 0bc953a446e7..9ea7d555a1f1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py @@ -1,104 +1,110 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class DomainRegistrationProviderOperations(object): """DomainRegistrationProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Implements Csm operations Api to exposes the list of available Csm Apis - under the resource provider. - - Description for Implements Csm operations Api to exposes the list of - available Csm Apis under the resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationDescription] - :raises: - :class:`DefaultErrorResponseException` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider. + + Description for Implements Csm operations Api to exposes the list of available Csm Apis under + the resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.DomainRegistration/operations'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py index d14df260f874..35f482d73544 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py @@ -1,1090 +1,1092 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import 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]] class DomainsOperations(object): """DomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def check_availability( - self, name=None, custom_headers=None, raw=False, **operation_config): + self, + identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainAvailabilityCheckResult" """Check if a domain is available for registration. Description for Check if a domain is available for registration. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainAvailabilityCheckResult or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DomainAvailabilityCheckResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param identifier: Name of the domain. + :type identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainAvailabilityCheckResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainAvailabilityCheckResult + :raises: ~azure.core.exceptions.HttpResponseError """ - identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailabilityCheckResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_availability.metadata['url'] + url = self.check_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainAvailabilityCheckResult', response) + deserialized = self._deserialize('DomainAvailabilityCheckResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability'} # type: ignore def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainCollection"] """Get all domains in a subscription. Description for Get all domains in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DomainPaged[~azure.mgmt.web.v2019_08_01.models.Domain] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains'} # type: ignore def get_control_center_sso_request( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DomainControlCenterSsoRequest" """Generate a single sign-on request for the domain management portal. - Description for Generate a single sign-on request for the domain - management portal. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainControlCenterSsoRequest or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DomainControlCenterSsoRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + Description for Generate a single sign-on request for the domain management portal. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainControlCenterSsoRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainControlCenterSsoRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_control_center_sso_request.metadata['url'] + url = self.get_control_center_sso_request.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainControlCenterSsoRequest', response) + deserialized = self._deserialize('DomainControlCenterSsoRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} + get_control_center_sso_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest'} # type: ignore def list_recommendations( - self, keywords=None, max_domain_recommendations=None, custom_headers=None, raw=False, **operation_config): + self, + parameters, # type: "models.DomainRecommendationSearchParameters" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.NameIdentifierCollection"] """Get domain name recommendations based on keywords. Description for Get domain name recommendations based on keywords. - :param keywords: Keywords to be used for generating domain - recommendations. - :type keywords: str - :param max_domain_recommendations: Maximum number of recommendations. - :type max_domain_recommendations: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of NameIdentifier - :rtype: - ~azure.mgmt.web.v2019_08_01.models.NameIdentifierPaged[~azure.mgmt.web.v2019_08_01.models.NameIdentifier] - :raises: - :class:`DefaultErrorResponseException` + :param parameters: Search parameters for domain name recommendations. + :type parameters: ~azure.mgmt.web.v2019_08_01.models.DomainRecommendationSearchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NameIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.NameIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.DomainRecommendationSearchParameters(keywords=keywords, max_domain_recommendations=max_domain_recommendations) + cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommendations.metadata['url'] + url = self.list_recommendations.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('NameIdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.NameIdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommendations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainCollection"] """Get all domains in a resource group. Description for Get all domains in a resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DomainPaged[~azure.mgmt.web.v2019_08_01.models.Domain] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains'} # type: ignore def get( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Get a domain. Description for Get a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Domain"] """Creates or updates a domain. Description for Creates or updates a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain: Domain registration information. :type domain: ~azure.mgmt.web.v2019_08_01.models.Domain - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Domain or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.Domain] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.Domain]] - :raises: - :class:`DefaultErrorResponseException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain=domain, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Domain', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + domain_name=domain_name, + domain=domain, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + 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 + ) + 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.DomainRegistration/domains/{domainName}'} # type: ignore def delete( - self, resource_group_name, domain_name, force_hard_delete_domain=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + force_hard_delete_domain=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Delete a domain. Description for Delete a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param force_hard_delete_domain: Specify true to delete - the domain immediately. The default is false which - deletes the domain after 24 hours. + :param force_hard_delete_domain: Specify :code:`true` to delete the domain + immediately. The default is :code:`false` which deletes the domain after 24 hours. :type force_hard_delete_domain: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if force_hard_delete_domain is not None: query_parameters['forceHardDeleteDomain'] = self._serialize.query("force_hard_delete_domain", force_hard_delete_domain, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def update( - self, resource_group_name, domain_name, domain, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain, # type: "models.DomainPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Creates or updates a domain. Description for Creates or updates a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain: Domain registration information. :type domain: ~azure.mgmt.web.v2019_08_01.models.DomainPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str', pattern=r'[a-zA-Z0-9][a-zA-Z0-9\.-]+'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}'} # type: ignore def list_ownership_identifiers( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainOwnershipIdentifierCollection"] """Lists domain ownership identifiers. Description for Lists domain ownership identifiers. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DomainOwnershipIdentifier - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifierPaged[~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainOwnershipIdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_ownership_identifiers.metadata['url'] + url = self.list_ownership_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainOwnershipIdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainOwnershipIdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers'} # type: ignore def get_ownership_identifier( - self, resource_group_name, domain_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" """Get ownership identifier for domain. Description for Get ownership identifier for domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_ownership_identifier.metadata['url'] + url = self.get_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + get_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def create_or_update_ownership_identifier( - self, resource_group_name, domain_name, name, kind=None, ownership_id=None, custom_headers=None, raw=False, **operation_config): - """Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - Description for Creates an ownership identifier for a domain or updates - identifier details for an existing identifer. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + domain_ownership_identifier, # type: "models.DomainOwnershipIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Description for Creates an ownership identifier for a domain or updates identifier details for + an existing identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param kind: Kind of resource. - :type kind: str - :param ownership_id: Ownership Id. - :type ownership_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.DomainOwnershipIdentifier(kind=kind, ownership_id=ownership_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_ownership_identifier.metadata['url'] + url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + create_or_update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def delete_ownership_identifier( - self, resource_group_name, domain_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete ownership identifier for domain. Description for Delete ownership identifier for domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_ownership_identifier.metadata['url'] + url = self.delete_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + if cls: + return cls(pipeline_response, None, {}) - def update_ownership_identifier( - self, resource_group_name, domain_name, name, kind=None, ownership_id=None, custom_headers=None, raw=False, **operation_config): - """Creates an ownership identifier for a domain or updates identifier - details for an existing identifer. - - Description for Creates an ownership identifier for a domain or updates - identifier details for an existing identifer. + delete_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def update_ownership_identifier( + self, + resource_group_name, # type: str + domain_name, # type: str + name, # type: str + domain_ownership_identifier, # type: "models.DomainOwnershipIdentifier" + **kwargs # type: Any + ): + # type: (...) -> "models.DomainOwnershipIdentifier" + """Creates an ownership identifier for a domain or updates identifier details for an existing identifer. + + Description for Creates an ownership identifier for a domain or updates identifier details for + an existing identifer. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of domain. :type domain_name: str :param name: Name of identifier. :type name: str - :param kind: Kind of resource. - :type kind: str - :param ownership_id: Ownership Id. - :type ownership_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainOwnershipIdentifier or ClientRawResponse if raw=true + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainOwnershipIdentifier, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.DomainOwnershipIdentifier - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.DomainOwnershipIdentifier(kind=kind, ownership_id=ownership_id) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_ownership_identifier.metadata['url'] + url = self.update_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainOwnershipIdentifier', response) + deserialized = self._deserialize('DomainOwnershipIdentifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} + update_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}'} # type: ignore def renew( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Renew a domain. Description for Renew a domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.renew.metadata['url'] + url = self.renew.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} + renew.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py index 5d65128919ab..9b5b90ffadab 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py @@ -1,246 +1,250 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class ProviderOperations(object): """ProviderOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def get_available_stacks( - self, os_type_selected=None, custom_headers=None, raw=False, **operation_config): + self, + os_type_selected=None, # type: Optional[Union[str, "models.Enum4"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ApplicationStackCollection"] """Get available application frameworks and their versions. - Description for Get available application frameworks and their - versions. - - :param os_type_selected: Possible values include: 'Windows', 'Linux', - 'WindowsFunctions', 'LinuxFunctions' - :type os_type_selected: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ApplicationStackResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ApplicationStackResourcePaged[~azure.mgmt.web.v2019_08_01.models.ApplicationStackResource] - :raises: - :class:`DefaultErrorResponseException` + Description for Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2019_08_01.models.Enum4 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_available_stacks.metadata['url'] - + url = self.get_available_stacks.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] if os_type_selected is not None: query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ApplicationStackResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} + return ItemPaged( + get_next, extract_data + ) + get_available_stacks.metadata = {'url': '/providers/Microsoft.Web/availableStacks'} # type: ignore def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Gets all available operations for the Microsoft.Web resource provider. - Also exposes resource metric definitions. - - Description for Gets all available operations for the Microsoft.Web - resource provider. Also exposes resource metric definitions. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmOperationDescription - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmOperationDescriptionPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationDescription] - :raises: - :class:`DefaultErrorResponseException` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmOperationCollection"] + """Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions. + + Description for Gets all available operations for the Microsoft.Web resource provider. Also + exposes resource metric definitions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmOperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_operations.metadata['url'] - + url = self.list_operations.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmOperationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmOperationDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Web/operations'} # type: ignore def get_available_stacks_on_prem( - self, os_type_selected=None, custom_headers=None, raw=False, **operation_config): + self, + os_type_selected=None, # type: Optional[Union[str, "models.Enum5"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ApplicationStackCollection"] """Get available application frameworks and their versions. - Description for Get available application frameworks and their - versions. - - :param os_type_selected: Possible values include: 'Windows', 'Linux', - 'WindowsFunctions', 'LinuxFunctions' - :type os_type_selected: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ApplicationStackResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ApplicationStackResourcePaged[~azure.mgmt.web.v2019_08_01.models.ApplicationStackResource] - :raises: - :class:`DefaultErrorResponseException` + Description for Get available application frameworks and their versions. + + :param os_type_selected: + :type os_type_selected: str or ~azure.mgmt.web.v2019_08_01.models.Enum5 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationStackCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ApplicationStackCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_available_stacks_on_prem.metadata['url'] + url = self.get_available_stacks_on_prem.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if os_type_selected is not None: query_parameters['osTypeSelected'] = self._serialize.query("os_type_selected", os_type_selected, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationStackCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ApplicationStackResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} + return ItemPaged( + get_next, extract_data + ) + get_available_stacks_on_prem.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py index cc1718ea0880..a8ff1276a2c2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py @@ -1,1070 +1,1075 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class RecommendationsOperations(object): """RecommendationsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """List all recommendations for a subscription. Description for List all recommendations for a subscription. - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RecommendationPaged[~azure.mgmt.web.v2019_08_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations'} # type: ignore def reset_all_filters( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for a subscription. - Description for Reset all recommendation opt-out settings for a - subscription. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + Description for Reset all recommendation opt-out settings for a subscription. + + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reset_all_filters.metadata['url'] + url = self.reset_all_filters.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} + reset_all_filters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset'} # type: ignore def disable_recommendation_for_subscription( - self, name, custom_headers=None, raw=False, **operation_config): - """Disables the specified rule so it will not apply to a subscription in - the future. + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Disables the specified rule so it will not apply to a subscription in the future. - Description for Disables the specified rule so it will not apply to a - subscription in the future. + Description for Disables the specified rule so it will not apply to a subscription in the + future. - :param name: Rule name + :param name: Rule name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.disable_recommendation_for_subscription.metadata['url'] + url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} + if cls: + return cls(pipeline_response, None, {}) - def list_history_for_hosting_environment( - self, resource_group_name, hosting_environment_name, expired_only=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get past recommendations for an app, optionally specified by the time - range. + disable_recommendation_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable'} # type: ignore - Description for Get past recommendations for an app, optionally - specified by the time range. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_history_for_hosting_environment( + self, + resource_group_name, # type: str + hosting_environment_name, # type: str + expired_only=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] + """Get past recommendations for an app, optionally specified by the time range. + + Description for Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param hosting_environment_name: Name of the hosting environment. :type hosting_environment_name: str - :param expired_only: Specify false to return all - recommendations. The default is true, which returns only - expired recommendations. + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. :type expired_only: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RecommendationPaged[~azure.mgmt.web.v2019_08_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_history_for_hosting_environment.metadata['url'] + url = self.list_history_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if expired_only is not None: query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_history_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory'} + return ItemPaged( + get_next, extract_data + ) + list_history_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory'} # type: ignore def list_recommended_rules_for_hosting_environment( - self, resource_group_name, hosting_environment_name, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + hosting_environment_name, # type: str + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """Get all recommendations for an app. Description for Get all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param hosting_environment_name: Name of the app. :type hosting_environment_name: str - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Return only channels specified in the filter. Filter is - specified by using OData syntax. Example: $filter=channel eq 'Api' or - channel eq 'Notification' + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RecommendationPaged[~azure.mgmt.web.v2019_08_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommended_rules_for_hosting_environment.metadata['url'] + url = self.list_recommended_rules_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_recommended_rules_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations'} # type: ignore def disable_all_for_hosting_environment( - self, resource_group_name, environment_name, hosting_environment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + environment_name, # type: str + hosting_environment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable all recommendations for an app. Description for Disable all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param environment_name: Name of the app. :type environment_name: str :param hosting_environment_name: :type hosting_environment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.disable_all_for_hosting_environment.metadata['url'] + url = self.disable_all_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_all_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable'} + disable_all_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable'} # type: ignore def reset_all_filters_for_hosting_environment( - self, resource_group_name, environment_name, hosting_environment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + environment_name, # type: str + hosting_environment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for an app. Description for Reset all recommendation opt-out settings for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param environment_name: Name of the app. :type environment_name: str :param hosting_environment_name: :type hosting_environment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reset_all_filters_for_hosting_environment.metadata['url'] + url = self.reset_all_filters_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset'} + reset_all_filters_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset'} # type: ignore def get_rule_details_by_hosting_environment( - self, resource_group_name, hosting_environment_name, name, update_seen=None, recommendation_id=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + hosting_environment_name, # type: str + name, # type: str + update_seen=None, # type: Optional[bool] + recommendation_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RecommendationRule" """Get a recommendation rule for an app. Description for Get a recommendation rule for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param hosting_environment_name: Name of the hosting environment. :type hosting_environment_name: str :param name: Name of the recommendation. :type name: str - :param update_seen: Specify true to update the last-seen - timestamp of the recommendation object. + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. :type update_seen: bool - :param recommendation_id: The GUID of the recommendation object if you - query an expired one. You don't need to specify it to query an active - entry. + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. :type recommendation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecommendationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.RecommendationRule or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_rule_details_by_hosting_environment.metadata['url'] + url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if update_seen is not None: query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') if recommendation_id is not None: query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RecommendationRule', response) + deserialized = self._deserialize('RecommendationRule', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_rule_details_by_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}'} + get_rule_details_by_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}'} # type: ignore def disable_recommendation_for_hosting_environment( - self, resource_group_name, environment_name, name, hosting_environment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + environment_name, # type: str + name, # type: str + hosting_environment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disables the specific rule for a web site permanently. Description for Disables the specific rule for a web site permanently. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param environment_name: Site name + :param environment_name: Site name. :type environment_name: str - :param name: Rule name + :param name: Rule name. :type name: str :param hosting_environment_name: :type hosting_environment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.disable_recommendation_for_hosting_environment.metadata['url'] + url = self.disable_recommendation_for_hosting_environment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostingEnvironmentName': self._serialize.url("hosting_environment_name", hosting_environment_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['environmentName'] = self._serialize.query("environment_name", environment_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable'} + if cls: + return cls(pipeline_response, None, {}) - def list_history_for_web_app( - self, resource_group_name, site_name, expired_only=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Get past recommendations for an app, optionally specified by the time - range. - - Description for Get past recommendations for an app, optionally - specified by the time range. + disable_recommendation_for_hosting_environment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_history_for_web_app( + self, + resource_group_name, # type: str + site_name, # type: str + expired_only=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] + """Get past recommendations for an app, optionally specified by the time range. + + Description for Get past recommendations for an app, optionally specified by the time range. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param expired_only: Specify false to return all - recommendations. The default is true, which returns only - expired recommendations. + :param expired_only: Specify :code:`false` to return all recommendations. The + default is :code:`true`, which returns only expired recommendations. :type expired_only: bool - :param filter: Filter is specified by using OData syntax. Example: - $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[PT1H|PT1M|P1D] + :param filter: Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or + channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq + 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RecommendationPaged[~azure.mgmt.web.v2019_08_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_history_for_web_app.metadata['url'] + url = self.list_history_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if expired_only is not None: query_parameters['expiredOnly'] = self._serialize.query("expired_only", expired_only, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} + return ItemPaged( + get_next, extract_data + ) + list_history_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory'} # type: ignore def list_recommended_rules_for_web_app( - self, resource_group_name, site_name, featured=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + featured=None, # type: Optional[bool] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RecommendationCollection"] """Get all recommendations for an app. Description for Get all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param featured: Specify true to return only the most - critical recommendations. The default is false, which - returns all recommendations. + :param featured: Specify :code:`true` to return only the most critical + recommendations. The default is :code:`false`, which returns all recommendations. :type featured: bool - :param filter: Return only channels specified in the filter. Filter is - specified by using OData syntax. Example: $filter=channel eq 'Api' or - channel eq 'Notification' + :param filter: Return only channels specified in the filter. Filter is specified by using OData + syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Recommendation - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RecommendationPaged[~azure.mgmt.web.v2019_08_01.models.Recommendation] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecommendationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.RecommendationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_recommended_rules_for_web_app.metadata['url'] + url = self.list_recommended_rules_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if featured is not None: query_parameters['featured'] = self._serialize.query("featured", featured, 'bool') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RecommendationCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} + return ItemPaged( + get_next, extract_data + ) + list_recommended_rules_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations'} # type: ignore def disable_all_for_web_app( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable all recommendations for an app. Description for Disable all recommendations for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.disable_all_for_web_app.metadata['url'] + url = self.disable_all_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} + disable_all_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable'} # type: ignore def reset_all_filters_for_web_app( - self, resource_group_name, site_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reset all recommendation opt-out settings for an app. Description for Reset all recommendation opt-out settings for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reset_all_filters_for_web_app.metadata['url'] + url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} + reset_all_filters_for_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset'} # type: ignore def get_rule_details_by_web_app( - self, resource_group_name, site_name, name, update_seen=None, recommendation_id=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + name, # type: str + update_seen=None, # type: Optional[bool] + recommendation_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RecommendationRule" """Get a recommendation rule for an app. Description for Get a recommendation rule for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param site_name: Name of the app. :type site_name: str :param name: Name of the recommendation. :type name: str - :param update_seen: Specify true to update the last-seen - timestamp of the recommendation object. + :param update_seen: Specify :code:`true` to update the last-seen timestamp of the + recommendation object. :type update_seen: bool - :param recommendation_id: The GUID of the recommendation object if you - query an expired one. You don't need to specify it to query an active - entry. + :param recommendation_id: The GUID of the recommendation object if you query an expired one. + You don't need to specify it to query an active entry. :type recommendation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecommendationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.RecommendationRule or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationRule, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RecommendationRule + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_rule_details_by_web_app.metadata['url'] + url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if update_seen is not None: query_parameters['updateSeen'] = self._serialize.query("update_seen", update_seen, 'bool') if recommendation_id is not None: query_parameters['recommendationId'] = self._serialize.query("recommendation_id", recommendation_id, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RecommendationRule', response) + deserialized = self._deserialize('RecommendationRule', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} + get_rule_details_by_web_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}'} # type: ignore def disable_recommendation_for_site( - self, resource_group_name, site_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + site_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disables the specific rule for a web site permanently. Description for Disables the specific rule for a web site permanently. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param site_name: Site name + :param site_name: Site name. :type site_name: str - :param name: Rule name + :param name: Rule name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.disable_recommendation_for_site.metadata['url'] + url = self.disable_recommendation_for_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'siteName': self._serialize.url("site_name", site_name, 'str'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} + disable_recommendation_for_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py index 50613aefaa9a..985da1e8d448 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py @@ -1,468 +1,463 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class ResourceHealthMetadataOperations(object): """ResourceHealthMetadataOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] """List all ResourceHealthMetadata for all sites in the subscription. - Description for List all ResourceHealthMetadata for all sites in the - subscription. + Description for List all ResourceHealthMetadata for all sites in the subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """List all ResourceHealthMetadata for all sites in the resource group in - the subscription. - - Description for List all ResourceHealthMetadata for all sites in the - resource group in the subscription. + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """List all ResourceHealthMetadata for all sites in the resource group in the subscription. + + Description for List all ResourceHealthMetadata for all sites in the resource group in the + subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata'} # type: ignore def list_by_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the category of ResourceHealthMetadata to use for the given site - as a collection. - - Description for Gets the category of ResourceHealthMetadata to use for - the given site as a collection. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Description for Gets the category of ResourceHealthMetadata to use for the given site as a + collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_site.metadata['url'] + url = self.list_by_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata'} # type: ignore def get_by_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceHealthMetadata" """Gets the category of ResourceHealthMetadata to use for the given site. - Description for Gets the category of ResourceHealthMetadata to use for - the given site. + Description for Gets the category of ResourceHealthMetadata to use for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of web app + :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceHealthMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_by_site.metadata['url'] + url = self.get_by_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceHealthMetadata', response) + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} + get_by_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default'} # type: ignore def list_by_site_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets the category of ResourceHealthMetadata to use for the given site - as a collection. - - Description for Gets the category of ResourceHealthMetadata to use for - the given site as a collection. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceHealthMetadataCollection"] + """Gets the category of ResourceHealthMetadata to use for the given site as a collection. + + Description for Gets the category of ResourceHealthMetadata to use for the given site as a + collection. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceHealthMetadata - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceHealthMetadataCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadataCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_site_slot.metadata['url'] + url = self.list_by_site_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceHealthMetadataCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceHealthMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} + return ItemPaged( + get_next, extract_data + ) + list_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata'} # type: ignore def get_by_site_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceHealthMetadata" """Gets the category of ResourceHealthMetadata to use for the given site. - Description for Gets the category of ResourceHealthMetadata to use for - the given site. + Description for Gets the category of ResourceHealthMetadata to use for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Name of web app + :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceHealthMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceHealthMetadata, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceHealthMetadata + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_by_site_slot.metadata['url'] + url = self.get_by_site_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceHealthMetadata', response) + deserialized = self._deserialize('ResourceHealthMetadata', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} + get_by_site_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py index a57504878d0f..0b0467b3acfd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py @@ -1,534 +1,541 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class StaticSitesOperations(object): """StaticSitesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteCollection"] """Get all Static Sites for a subscription. Description for Get all Static Sites for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StaticSiteARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites'} # type: ignore def get_static_sites_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteCollection"] """Gets all static sites in the specified resource group. Description for Gets all static sites in the specified resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StaticSiteARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_static_sites_by_resource_group.metadata['url'] + url = self.get_static_sites_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - get_static_sites_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites'} + return ItemPaged( + get_next, extract_data + ) + get_static_sites_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites'} # type: ignore def get_static_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteARMResource" """Gets the details of a static site. Description for Gets the details of a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteARMResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_static_site.metadata['url'] + url = self.get_static_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StaticSiteARMResource', response) + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} + get_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore def create_or_update_static_site( - self, resource_group_name, name, static_site_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new static site in an existing resource group, or updates an - existing static site. - - Description for Creates a new static site in an existing resource - group, or updates an existing static site. + self, + resource_group_name, # type: str + name, # type: str + static_site_envelope, # type: "models.StaticSiteARMResource" + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteARMResource" + """Creates a new static site in an existing resource group, or updates an existing static site. + + Description for Creates a new static site in an existing resource group, or updates an existing + static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site to create or update. :type name: str - :param static_site_envelope: A JSON representation of the staticsite - properties. See example. - :type static_site_envelope: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteARMResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param static_site_envelope: A JSON representation of the staticsite properties. See example. + :type static_site_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_static_site.metadata['url'] + url = self.create_or_update_static_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_envelope, 'StaticSiteARMResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StaticSiteARMResource', response) + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StaticSiteARMResource', response) + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} + create_or_update_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore def delete_static_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a static site. Description for Deletes a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site to delete. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_static_site.metadata['url'] + url = self.delete_static_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} + if cls: + return cls(pipeline_response, None, {}) - def update_static_site( - self, resource_group_name, name, static_site_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new static site in an existing resource group, or updates an - existing static site. + delete_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore - Description for Creates a new static site in an existing resource - group, or updates an existing static site. + def update_static_site( + self, + resource_group_name, # type: str + name, # type: str + static_site_envelope, # type: "models.StaticSitePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteARMResource" + """Creates a new static site in an existing resource group, or updates an existing static site. + + Description for Creates a new static site in an existing resource group, or updates an existing + static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site to create or update. :type name: str - :param static_site_envelope: A JSON representation of the staticsite - properties. See example. - :type static_site_envelope: - ~azure.mgmt.web.v2019_08_01.models.StaticSitePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteARMResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param static_site_envelope: A JSON representation of the staticsite properties. See example. + :type static_site_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteARMResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_static_site.metadata['url'] + url = self.update_static_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_envelope, 'StaticSitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StaticSiteARMResource', response) + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StaticSiteARMResource', response) + deserialized = self._deserialize('StaticSiteARMResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} + update_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}'} # type: ignore def list_static_site_users( - self, resource_group_name, name, authprovider, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + authprovider, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteUserCollection"] """Gets the list of users of a static site. Description for Gets the list of users of a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param authprovider: The auth provider for the users. :type authprovider: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StaticSiteUserARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteUserCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteUserCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_static_site_users.metadata['url'] + url = self.list_static_site_users.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'authprovider': self._serialize.url("authprovider", authprovider, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.post(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteUserCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteUserARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_static_site_users.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/listUsers'} + return ItemPaged( + get_next, extract_data + ) + list_static_site_users.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/listUsers'} # type: ignore def delete_static_site_user( - self, resource_group_name, name, authprovider, userid, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + authprovider, # type: str + userid, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the user entry from the static site. Description for Deletes the user entry from the static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the staticsite. :type name: str @@ -536,60 +543,63 @@ def delete_static_site_user( :type authprovider: str :param userid: The user id of the user. :type userid: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_static_site_user.metadata['url'] + url = self.delete_static_site_user.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'authprovider': self._serialize.url("authprovider", authprovider, 'str'), 'userid': self._serialize.url("userid", userid, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_static_site_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_static_site_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}'} # type: ignore def update_static_site_user( - self, resource_group_name, name, authprovider, userid, kind=None, roles=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + authprovider, # type: str + userid, # type: str + static_site_user_envelope, # type: "models.StaticSiteUserARMResource" + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteUserARMResource" """Updates a user entry with the listed roles. Description for Updates a user entry with the listed roles. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str @@ -597,1224 +607,1193 @@ def update_static_site_user( :type authprovider: str :param userid: The user id of the user. :type userid: str - :param kind: Kind of resource. - :type kind: str - :param roles: The roles for the static site user, in free-form string - format - :type roles: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteUserARMResource or ClientRawResponse if raw=true + :param static_site_user_envelope: A JSON representation of the StaticSiteUser properties. See + example. + :type static_site_user_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteUserARMResource, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserARMResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - static_site_user_envelope = models.StaticSiteUserARMResource(kind=kind, roles=roles) + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_static_site_user.metadata['url'] + url = self.update_static_site_user.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'authprovider': self._serialize.url("authprovider", authprovider, 'str'), 'userid': self._serialize.url("userid", userid, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_user_envelope, 'StaticSiteUserARMResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StaticSiteUserARMResource', response) + deserialized = self._deserialize('StaticSiteUserARMResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_static_site_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}'} + update_static_site_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}'} # type: ignore def get_static_site_builds( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteBuildCollection"] """Gets all static site builds for a particular static site. - Description for Gets all static site builds for a particular static - site. + Description for Gets all static site builds for a particular static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StaticSiteBuildARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteBuildCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_static_site_builds.metadata['url'] + url = self.get_static_site_builds.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteBuildCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteBuildARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - get_static_site_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds'} + return ItemPaged( + get_next, extract_data + ) + get_static_site_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds'} # type: ignore def get_static_site_build( - self, resource_group_name, name, pr_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + pr_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteBuildARMResource" """Gets the details of a static site build. Description for Gets the details of a static site build. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param pr_id: The stage site identifier. :type pr_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteBuildARMResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteBuildARMResource, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteBuildARMResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_static_site_build.metadata['url'] + url = self.get_static_site_build.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'prId': self._serialize.url("pr_id", pr_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StaticSiteBuildARMResource', response) + deserialized = self._deserialize('StaticSiteBuildARMResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_static_site_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}'} + get_static_site_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}'} # type: ignore def delete_static_site_build( - self, resource_group_name, name, pr_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + pr_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a static site build. Description for Deletes a static site build. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param pr_id: The stage site identifier. :type pr_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_static_site_build.metadata['url'] + url = self.delete_static_site_build.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'prId': self._serialize.url("pr_id", pr_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_static_site_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}'} + delete_static_site_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}'} # type: ignore def create_or_update_static_site_build_function_app_settings( - self, resource_group_name, name, pr_id, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + pr_id, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Creates or updates the function app settings of a static site build. - Description for Creates or updates the function app settings of a - static site build. + Description for Creates or updates the function app settings of a static site build. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param pr_id: The stage site identifier. :type pr_id: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_settings: + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_static_site_build_function_app_settings.metadata['url'] + url = self.create_or_update_static_site_build_function_app_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'prId': self._serialize.url("pr_id", pr_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_static_site_build_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/config/functionappsettings'} + create_or_update_static_site_build_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/config/functionappsettings'} # type: ignore def list_static_site_build_functions( - self, resource_group_name, name, pr_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + pr_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteFunctionOverviewCollection"] """Gets the functions of a particular static site build. Description for Gets the functions of a particular static site build. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param pr_id: The stage site identifier. :type pr_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of - StaticSiteFunctionOverviewARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteFunctionOverviewCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_static_site_build_functions.metadata['url'] + url = self.list_static_site_build_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'prId': self._serialize.url("pr_id", pr_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteFunctionOverviewCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteFunctionOverviewARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_static_site_build_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_static_site_build_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/functions'} # type: ignore def list_static_site_build_function_app_settings( - self, resource_group_name, name, pr_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + pr_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of a static site. Description for Gets the application settings of a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param pr_id: The stage site identifier. :type pr_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_static_site_build_function_app_settings.metadata['url'] + url = self.list_static_site_build_function_app_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'prId': self._serialize.url("pr_id", pr_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_static_site_build_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/listFunctionAppSettings'} + list_static_site_build_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{prId}/listFunctionAppSettings'} # type: ignore def create_or_update_static_site_function_app_settings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Creates or updates the function app settings of a static site. - Description for Creates or updates the function app settings of a - static site. + Description for Creates or updates the function app settings of a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_settings: + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_static_site_function_app_settings.metadata['url'] + url = self.create_or_update_static_site_function_app_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_static_site_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/config/functionappsettings'} + create_or_update_static_site_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/config/functionappsettings'} # type: ignore def create_user_roles_invitation_link( - self, resource_group_name, name, static_site_user_roles_invitation_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + static_site_user_roles_invitation_envelope, # type: "models.StaticSiteUserInvitationRequestResource" + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteUserInvitationResponseResource" """Creates an invitation link for a user with the role. Description for Creates an invitation link for a user with the role. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param static_site_user_roles_invitation_envelope: - :type static_site_user_roles_invitation_envelope: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserInvitationRequestResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteUserInvitationResponseResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserInvitationResponseResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type static_site_user_roles_invitation_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserInvitationRequestResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteUserInvitationResponseResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteUserInvitationResponseResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserInvitationResponseResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_user_roles_invitation_link.metadata['url'] + url = self.create_user_roles_invitation_link.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_user_roles_invitation_envelope, 'StaticSiteUserInvitationRequestResource') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StaticSiteUserInvitationResponseResource', response) + deserialized = self._deserialize('StaticSiteUserInvitationResponseResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_user_roles_invitation_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/createUserInvitation'} + create_user_roles_invitation_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/createUserInvitation'} # type: ignore def list_static_site_custom_domains( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteCustomDomainOverviewCollection"] """Gets all static site custom domains for a particular static site. - Description for Gets all static site custom domains for a particular - static site. + Description for Gets all static site custom domains for a particular static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site resource to search in. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of - StaticSiteCustomDomainOverviewARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteCustomDomainOverviewCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_static_site_custom_domains.metadata['url'] + url = self.list_static_site_custom_domains.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteCustomDomainOverviewCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteCustomDomainOverviewARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_static_site_custom_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains'} + return ItemPaged( + get_next, extract_data + ) + list_static_site_custom_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains'} # type: ignore def create_or_update_static_site_custom_domain( - self, resource_group_name, name, domain_name, custom_headers=None, raw=False, **operation_config): - """Creates a new static site custom domain in an existing resource group - and static site. - - Description for Creates a new static site custom domain in an existing - resource group and static site. + self, + resource_group_name, # type: str + name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StaticSiteCustomDomainOverviewARMResource" + """Creates a new static site custom domain in an existing resource group and static site. + + Description for Creates a new static site custom domain in an existing resource group and + static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param domain_name: The custom domain to create. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StaticSiteCustomDomainOverviewARMResource or - ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticSiteCustomDomainOverviewARMResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StaticSiteCustomDomainOverviewARMResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewARMResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.create_or_update_static_site_custom_domain.metadata['url'] + url = self.create_or_update_static_site_custom_domain.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StaticSiteCustomDomainOverviewARMResource', response) + deserialized = self._deserialize('StaticSiteCustomDomainOverviewARMResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StaticSiteCustomDomainOverviewARMResource', response) + deserialized = self._deserialize('StaticSiteCustomDomainOverviewARMResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_static_site_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}'} + create_or_update_static_site_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}'} # type: ignore def delete_static_site_custom_domain( - self, resource_group_name, name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a custom domain. Description for Deletes a custom domain. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param domain_name: The custom domain to delete. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_static_site_custom_domain.metadata['url'] + url = self.delete_static_site_custom_domain.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_static_site_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_static_site_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}'} # type: ignore def validate_custom_domain_can_be_added_to_static_site( - self, resource_group_name, name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Validates a particular custom domain can be added to a static site. - Description for Validates a particular custom domain can be added to a - static site. + Description for Validates a particular custom domain can be added to a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param domain_name: The custom domain to validate. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.validate_custom_domain_can_be_added_to_static_site.metadata['url'] + url = self.validate_custom_domain_can_be_added_to_static_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_custom_domain_can_be_added_to_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}/validate'} + validate_custom_domain_can_be_added_to_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}/validate'} # type: ignore def detach_static_site( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Detaches a static site. Description for Detaches a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site to detach. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.detach_static_site.metadata['url'] + url = self.detach_static_site.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - detach_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/detach'} + if cls: + return cls(pipeline_response, None, {}) + + detach_static_site.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/detach'} # type: ignore def list_static_site_functions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StaticSiteFunctionOverviewCollection"] """Gets the functions of a static site. Description for Gets the functions of a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of - StaticSiteFunctionOverviewARMResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewARMResourcePaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewARMResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticSiteFunctionOverviewCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.StaticSiteFunctionOverviewCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_static_site_functions.metadata['url'] + url = self.list_static_site_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StaticSiteFunctionOverviewCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StaticSiteFunctionOverviewARMResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_static_site_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_static_site_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/functions'} # type: ignore def list_static_site_function_app_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of a static site. Description for Gets the application settings of a static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_static_site_function_app_settings.metadata['url'] + url = self.list_static_site_function_app_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_static_site_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listFunctionAppSettings'} + list_static_site_function_app_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listFunctionAppSettings'} # type: ignore def list_static_site_secrets( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Lists the secrets for an existing static site. Description for Lists the secrets for an existing static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_static_site_secrets.metadata['url'] + url = self.list_static_site_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_static_site_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listSecrets'} + list_static_site_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listSecrets'} # type: ignore def reset_static_site_api_key( - self, resource_group_name, name, reset_properties_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + reset_properties_envelope, # type: "models.StaticSiteResetPropertiesARMResource" + **kwargs # type: Any + ): + # type: (...) -> None """Resets the api key for an existing static site. Description for Resets the api key for an existing static site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the static site. :type name: str :param reset_properties_envelope: - :type reset_properties_envelope: - ~azure.mgmt.web.v2019_08_01.models.StaticSiteResetPropertiesARMResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type reset_properties_envelope: ~azure.mgmt.web.v2019_08_01.models.StaticSiteResetPropertiesARMResource + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.reset_static_site_api_key.metadata['url'] + url = self.reset_static_site_api_key.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reset_properties_envelope, 'StaticSiteResetPropertiesARMResource') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_static_site_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/resetapikey'} + reset_static_site_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/resetapikey'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py index 7d49b049304d..3bd7c9ff86de 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py @@ -1,251 +1,252 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat from .. import 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]] class TopLevelDomainsOperations(object): """TopLevelDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TopLevelDomainCollection"] """Get all top-level domains supported for registration. Description for Get all top-level domains supported for registration. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TopLevelDomain - :rtype: - ~azure.mgmt.web.v2019_08_01.models.TopLevelDomainPaged[~azure.mgmt.web.v2019_08_01.models.TopLevelDomain] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopLevelDomainCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.TopLevelDomainCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TopLevelDomainCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TopLevelDomainPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'} # type: ignore def get( - self, name, custom_headers=None, raw=False, **operation_config): + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TopLevelDomain" """Get details of a top-level domain. Description for Get details of a top-level domain. :param name: Name of the top-level domain. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TopLevelDomain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.TopLevelDomain or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopLevelDomain, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TopLevelDomain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TopLevelDomain', response) + deserialized = self._deserialize('TopLevelDomain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'} # type: ignore def list_agreements( - self, name, include_privacy=None, for_transfer=None, custom_headers=None, raw=False, **operation_config): - """Gets all legal agreements that user needs to accept before purchasing a - domain. + self, + name, # type: str + agreement_option, # type: "models.TopLevelDomainAgreementOption" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TldLegalAgreementCollection"] + """Gets all legal agreements that user needs to accept before purchasing a domain. - Description for Gets all legal agreements that user needs to accept - before purchasing a domain. + Description for Gets all legal agreements that user needs to accept before purchasing a domain. :param name: Name of the top-level domain. :type name: str - :param include_privacy: If true, then the list of - agreements will include agreements for domain privacy as well; - otherwise, false. - :type include_privacy: bool - :param for_transfer: If true, then the list of agreements - will include agreements for domain transfer as well; otherwise, - false. - :type for_transfer: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TldLegalAgreement - :rtype: - ~azure.mgmt.web.v2019_08_01.models.TldLegalAgreementPaged[~azure.mgmt.web.v2019_08_01.models.TldLegalAgreement] - :raises: - :class:`DefaultErrorResponseException` + :param agreement_option: Domain agreement options. + :type agreement_option: ~azure.mgmt.web.v2019_08_01.models.TopLevelDomainAgreementOption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TldLegalAgreementCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.TldLegalAgreementCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - agreement_option = models.TopLevelDomainAgreementOption(include_privacy=include_privacy, for_transfer=for_transfer) + cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_agreements.metadata['url'] + url = self.list_agreements.metadata['url'] # type: ignore path_format_arguments = { 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TldLegalAgreementCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TldLegalAgreementPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} + return ItemPaged( + get_next, extract_data + ) + list_agreements.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py index 02fa667f8284..e2142a687d71 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py @@ -1,921 +1,934 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class WebAppsOperations(object): """WebAppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.web.v2019_08_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. - :ivar api_version: API Version. Constant value: "2019-08-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-08-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Get all apps for a subscription. Description for Get all apps for a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SitePaged[~azure.mgmt.web.v2019_08_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites'} # type: ignore def list_by_resource_group( - self, resource_group_name, include_slots=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + include_slots=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Gets all web, mobile, and API apps in the specified resource group. - Description for Gets all web, mobile, and API apps in the specified - resource group. + Description for Gets all web, mobile, and API apps in the specified resource group. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param include_slots: Specify true to include - deployment slots in results. The default is false, which only gives - you the production slot of all apps. + :param include_slots: Specify :code:`true` to include deployment slots in + results. The default is false, which only gives you the production slot of all apps. :type include_slots: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SitePaged[~azure.mgmt.web.v2019_08_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if include_slots is not None: query_parameters['includeSlots'] = self._serialize.query("include_slots", include_slots, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites'} # type: ignore def get( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Site"] """Gets the details of a web, mobile, or API app. Description for Gets the details of a web, mobile, or API app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore - def create_or_update( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Site"] + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - Description for Creates a new web, mobile, or API app in an existing - resource group, or updates an existing app. + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. + :param site_envelope: A JSON representation of the app properties. See example. :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.Site - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Site or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.Site] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.Site]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - site_envelope=site_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Site', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + name=name, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + 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 + ) + 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.Web/sites/{name}'} # type: ignore def delete( - self, resource_group_name, name, delete_metrics=None, delete_empty_server_farm=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + delete_metrics=None, # type: Optional[bool] + delete_empty_server_farm=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a web, mobile, or API app, or one of the deployment slots. - Description for Deletes a web, mobile, or API app, or one of the - deployment slots. + Description for Deletes a web, mobile, or API app, or one of the deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app to delete. :type name: str :param delete_metrics: If true, web app metrics are also deleted. :type delete_metrics: bool - :param delete_empty_server_farm: Specify false if you want to keep - empty App Service plan. By default, empty App Service plan is deleted. + :param delete_empty_server_farm: Specify false if you want to keep empty App Service plan. By + default, empty App Service plan is deleted. :type delete_empty_server_farm: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if delete_metrics is not None: query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') if delete_empty_server_farm is not None: query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def update( - self, resource_group_name, name, site_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + self, + resource_group_name, # type: str + name, # type: str + site_envelope, # type: "models.SitePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - Description for Creates a new web, mobile, or API app in an existing - resource group, or updates an existing app. + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: - ~azure.mgmt.web.v2019_08_01.models.SitePatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}'} # type: ignore def analyze_custom_hostname( - self, resource_group_name, name, host_name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomHostnameAnalysisResult" """Analyze a custom hostname. Description for Analyze a custom hostname. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param host_name: Custom hostname. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomHostnameAnalysisResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CustomHostnameAnalysisResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.analyze_custom_hostname.metadata['url'] + url = self.analyze_custom_hostname.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if host_name is not None: query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomHostnameAnalysisResult', response) + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} + analyze_custom_hostname.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname'} # type: ignore def apply_slot_config_to_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - """Applies the configuration settings from the target slot onto the - current slot. + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + """Applies the configuration settings from the target slot onto the current slot. - Description for Applies the configuration settings from the target slot - onto the current slot. + Description for Applies the configuration settings from the target slot onto the current slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :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 """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.apply_slot_config_to_production.metadata['url'] + url = self.apply_slot_config_to_production.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} + apply_slot_config_to_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig'} # type: ignore def backup( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Creates a backup of an app. Description for Creates a backup of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: Backup configuration. You can use the JSON response - from the POST action as input here. + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.backup.metadata['url'] + url = self.backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} + backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup'} # type: ignore def list_backups( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Description for Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2019_08_01.models.BackupItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItem] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_backups.metadata['url'] + url = self.list_backups.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} + return ItemPaged( + get_next, extract_data + ) + list_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups'} # type: ignore def get_backup_status( - self, resource_group_name, name, backup_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Gets a backup of an app by its ID. Description for Gets a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_backup_status.metadata['url'] + url = self.get_backup_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} + get_backup_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore def delete_backup( - self, resource_group_name, name, backup_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a backup of an app by its ID. Description for Deletes a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_backup.metadata['url'] + url = self.delete_backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} + if cls: + return cls(pipeline_response, None, {}) - def list_backup_status_secrets( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, **operation_config): - """Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + delete_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}'} # type: ignore - Description for Gets status of a web app backup that may be in - progress, including secrets associated with the backup, such as the - Azure Storage SAS URL. Also can be used to update the SAS URL for the - backup if a new URL is passed in the request body. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_backup_status_secrets( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Description for Gets status of a web app backup that may be in progress, including secrets + associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the + SAS URL for the backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str @@ -923,114 +936,122 @@ def list_backup_status_secrets( :type backup_id: str :param request: Information on backup request. :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.list_backup_status_secrets.metadata['url'] + url = self.list_backup_status_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} - + list_backup_status_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list'} # type: ignore def _restore_initial( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore.metadata['url'] + url = self._restore_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def restore( - self, resource_group_name, name, backup_id, request, custom_headers=None, raw=False, polling=True, **operation_config): - """Restores a specific backup to another app (or deployment slot, if - specified). + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore - Description for Restores a specific backup to another app (or - deployment slot, if specified). + def begin_restore( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restores a specific backup to another app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + Description for Restores a specific backup to another app (or deployment slot, if specified). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str @@ -1038,2633 +1059,2859 @@ def restore( :type backup_id: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_initial( - resource_group_name=resource_group_name, - name=name, - backup_id=backup_id, - request=request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore'} # type: ignore + + def get_basic_publishing_credentials_policies( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CsmPublishingCredentialsPoliciesCollection" + """Returns whether Scm basic auth is allowed and whether Ftp is allowed for a given site. + + Description for Returns whether Scm basic auth is allowed and whether Ftp is allowed for a + given site. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesCollection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_basic_publishing_credentials_policies.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_basic_publishing_credentials_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies'} # type: ignore + + def get_ftp_allowed( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CsmPublishingCredentialsPoliciesEntity" + """Returns whether FTP is allowed on the site or not. + + Description for Returns whether FTP is allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_ftp_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ftp_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp'} # type: ignore + + def update_ftp_allowed( + self, + resource_group_name, # type: str + name, # type: str + csm_publishing_access_policies_entity, # type: "models.CsmPublishingCredentialsPoliciesEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.CsmPublishingCredentialsPoliciesEntity" + """Updates whether FTP is allowed on the site or not. + + Description for Updates whether FTP is allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param csm_publishing_access_policies_entity: + :type csm_publishing_access_policies_entity: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_ftp_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_ftp_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp'} # type: ignore + + def get_scm_allowed( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CsmPublishingCredentialsPoliciesEntity" + """Returns whether Scm basic auth is allowed on the site or not. + + Description for Returns whether Scm basic auth is allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + + # Construct URL + url = self.get_scm_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_scm_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm'} # type: ignore + + def update_scm_allowed( + self, + resource_group_name, # type: str + name, # type: str + csm_publishing_access_policies_entity, # type: "models.CsmPublishingCredentialsPoliciesEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.CsmPublishingCredentialsPoliciesEntity" + """Updates whether user publishing credentials are allowed on the site or not. + + Description for Updates whether user publishing credentials are allowed on the site or not. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the app. + :type name: str + :param csm_publishing_access_policies_entity: + :type csm_publishing_access_policies_entity: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CsmPublishingCredentialsPoliciesEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingCredentialsPoliciesEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_scm_allowed.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), + 'name': self._serialize.url("name", name, 'str'), + '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CsmPublishingCredentialsPoliciesEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_scm_allowed.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm'} # type: ignore def list_configurations( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigResourceCollection"] """List the configurations of an app. Description for List the configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigResourcePaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configurations.metadata['url'] + url = self.list_configurations.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} + return ItemPaged( + get_next, extract_data + ) + list_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config'} # type: ignore def update_application_settings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the application settings of an app. Description for Replaces the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_application_settings.metadata['url'] + url = self.update_application_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} + update_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings'} # type: ignore def list_application_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of an app. Description for Gets the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_application_settings.metadata['url'] + url = self.list_application_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} + list_application_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list'} # type: ignore def update_auth_settings( - self, resource_group_name, name, site_auth_settings, custom_headers=None, raw=False, **operation_config): - """Updates the Authentication / Authorization settings associated with web - app. + self, + resource_group_name, # type: str + name, # type: str + site_auth_settings, # type: "models.SiteAuthSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" + """Updates the Authentication / Authorization settings associated with web app. - Description for Updates the Authentication / Authorization settings - associated with web app. + Description for Updates the Authentication / Authorization settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param site_auth_settings: Auth settings associated with web app. - :type site_auth_settings: - ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type site_auth_settings: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_auth_settings.metadata['url'] + url = self.update_auth_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} + update_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings'} # type: ignore def get_auth_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" """Gets the Authentication/Authorization settings of an app. - Description for Gets the Authentication/Authorization settings of an - app. + Description for Gets the Authentication/Authorization settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_auth_settings.metadata['url'] + url = self.get_auth_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} + get_auth_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list'} # type: ignore def update_azure_storage_accounts( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + azure_storage_accounts, # type: "models.AzureStoragePropertyDictionaryResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Updates the Azure storage account configurations of an app. - Description for Updates the Azure storage account configurations of an - app. + Description for Updates the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AzureStorageInfoValue] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ - azure_storage_accounts = models.AzureStoragePropertyDictionaryResource(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_azure_storage_accounts.metadata['url'] + url = self.update_azure_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts'} + update_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts'} # type: ignore def list_azure_storage_accounts( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Gets the Azure storage account configurations of an app. - Description for Gets the Azure storage account configurations of an - app. + Description for Gets the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_azure_storage_accounts.metadata['url'] + url = self.list_azure_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list'} + list_azure_storage_accounts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list'} # type: ignore def update_backup_configuration( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Updates the backup configuration of an app. Description for Updates the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param request: Edited backup configuration. :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_backup_configuration.metadata['url'] + url = self.update_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} + update_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore def delete_backup_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the backup configuration of an app. Description for Deletes the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_backup_configuration.metadata['url'] + url = self.delete_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} + delete_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup'} # type: ignore def get_backup_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Gets the backup configuration of an app. Description for Gets the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_backup_configuration.metadata['url'] + url = self.get_backup_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} + get_backup_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list'} # type: ignore def get_app_settings_key_vault_references( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.KeyVaultReferenceCollection" """Gets the config reference app settings and status of an app. - Description for Gets the config reference app settings and status of an - app. + Description for Gets the config reference app settings and status of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyVaultReferenceCollection or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVaultReferenceCollection, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyVaultReferenceCollection - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_app_settings_key_vault_references.metadata['url'] + url = self.get_app_settings_key_vault_references.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVaultReferenceCollection', response) + deserialized = self._deserialize('KeyVaultReferenceCollection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_app_settings_key_vault_references.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings'} + get_app_settings_key_vault_references.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings'} # type: ignore def get_app_setting_key_vault_reference( - self, resource_group_name, name, app_setting_key, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + app_setting_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.KeyVaultReferenceResource" """Gets the config reference and status of an app. Description for Gets the config reference and status of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param app_setting_key: App Setting key name. :type app_setting_key: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyVaultReferenceResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVaultReferenceResource, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyVaultReferenceResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_app_setting_key_vault_reference.metadata['url'] + url = self.get_app_setting_key_vault_reference.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'appSettingKey': self._serialize.url("app_setting_key", app_setting_key, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVaultReferenceResource', response) + deserialized = self._deserialize('KeyVaultReferenceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_app_setting_key_vault_reference.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey}'} + get_app_setting_key_vault_reference.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey}'} # type: ignore def update_connection_strings( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + connection_strings, # type: "models.ConnectionStringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Replaces the connection strings of an app. Description for Replaces the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ConnStringValueTypePair] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - connection_strings = models.ConnectionStringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_connection_strings.metadata['url'] + url = self.update_connection_strings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} + update_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings'} # type: ignore def list_connection_strings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Gets the connection strings of an app. Description for Gets the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_connection_strings.metadata['url'] + url = self.list_connection_strings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} + list_connection_strings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list'} # type: ignore def get_diagnostic_logs_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Gets the logging configuration of an app. Description for Gets the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_diagnostic_logs_configuration.metadata['url'] + url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} + get_diagnostic_logs_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore def update_diagnostic_logs_config( - self, resource_group_name, name, site_logs_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_logs_config, # type: "models.SiteLogsConfig" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Updates the logging configuration of an app. Description for Updates the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_logs_config: A SiteLogsConfig JSON object that contains - the logging configuration to change in the "properties" property. - :type site_logs_config: - ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_diagnostic_logs_config.metadata['url'] + url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} + update_diagnostic_logs_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs'} # type: ignore def update_metadata( - self, resource_group_name, name, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + metadata, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the metadata of an app. Description for Replaces the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_metadata.metadata['url'] + url = self.update_metadata.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} + update_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata'} # type: ignore def list_metadata( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the metadata of an app. Description for Gets the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_metadata.metadata['url'] + url = self.list_metadata.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} - + list_metadata.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list'} # type: ignore def _list_publishing_credentials_initial( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.User" + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_publishing_credentials.metadata['url'] + url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _list_publishing_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore - def list_publishing_credentials( - self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_list_publishing_credentials( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.User"] """Gets the Git/FTP publishing credentials of an app. Description for Gets the Git/FTP publishing credentials of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns User or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.User] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.User]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._list_publishing_credentials_initial( - resource_group_name=resource_group_name, - name=name, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('User', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._list_publishing_credentials_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list'} # type: ignore def update_site_push_settings( - self, resource_group_name, name, push_settings, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + push_settings, # type: "models.PushSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Updates the Push settings associated with web app. Description for Updates the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param push_settings: Push settings associated with web app. :type push_settings: ~azure.mgmt.web.v2019_08_01.models.PushSettings - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_site_push_settings.metadata['url'] + url = self.update_site_push_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} + update_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings'} # type: ignore def list_site_push_settings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Gets the Push settings associated with web app. Description for Gets the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_site_push_settings.metadata['url'] + url = self.list_site_push_settings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} + list_site_push_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list'} # type: ignore def list_slot_configuration_names( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the names of app settings and connection strings that stick to the - slot (not swapped). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SlotConfigNamesResource" + """Gets the names of app settings and connection strings that stick to the slot (not swapped). - Description for Gets the names of app settings and connection strings - that stick to the slot (not swapped). + Description for Gets the names of app settings and connection strings that stick to the slot + (not swapped). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SlotConfigNamesResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_slot_configuration_names.metadata['url'] + url = self.list_slot_configuration_names.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SlotConfigNamesResource', response) + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} + list_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore def update_slot_configuration_names( - self, resource_group_name, name, slot_config_names, custom_headers=None, raw=False, **operation_config): - """Updates the names of application settings and connection string that - remain with the slot during swap operation. + self, + resource_group_name, # type: str + name, # type: str + slot_config_names, # type: "models.SlotConfigNamesResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SlotConfigNamesResource" + """Updates the names of application settings and connection string that remain with the slot during swap operation. - Description for Updates the names of application settings and - connection string that remain with the slot during swap operation. + Description for Updates the names of application settings and connection string that remain + with the slot during swap operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot_config_names: Names of application settings and connection - strings. See example. - :type slot_config_names: - ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SlotConfigNamesResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param slot_config_names: Names of application settings and connection strings. See example. + :type slot_config_names: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SlotConfigNamesResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SlotConfigNamesResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_slot_configuration_names.metadata['url'] + url = self.update_slot_configuration_names.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SlotConfigNamesResource', response) + deserialized = self._deserialize('SlotConfigNamesResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} + update_slot_configuration_names.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames'} # type: ignore def get_configuration( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. - Description for Gets the configuration of an app, such as platform - version and bitness, default documents, virtual applications, Always - On, etc. + Description for Gets the configuration of an app, such as platform version and bitness, default + documents, virtual applications, Always On, etc. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_configuration.metadata['url'] + url = self.get_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + get_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def create_or_update_configuration( - self, resource_group_name, name, site_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Description for Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_configuration.metadata['url'] + url = self.create_or_update_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + create_or_update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def update_configuration( - self, resource_group_name, name, site_config, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Description for Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_configuration.metadata['url'] + url = self.update_configuration.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} + update_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web'} # type: ignore def list_configuration_snapshot_info( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigurationSnapshotInfoCollection"] + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. - Description for Gets a list of web app configuration snapshots - identifiers. Each element of the list contains a timestamp and the ID - of the snapshot. + Description for Gets a list of web app configuration snapshots identifiers. Each element of the + list contains a timestamp and the ID of the snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigurationSnapshotInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfoPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configuration_snapshot_info.metadata['url'] + url = self.list_configuration_snapshot_info.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigurationSnapshotInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigurationSnapshotInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots'} # type: ignore def get_configuration_snapshot( - self, resource_group_name, name, snapshot_id, custom_headers=None, raw=False, **operation_config): - """Gets a snapshot of the configuration of an app at a previous point in - time. + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets a snapshot of the configuration of an app at a previous point in time. - Description for Gets a snapshot of the configuration of an app at a - previous point in time. + Description for Gets a snapshot of the configuration of an app at a previous point in time. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_configuration_snapshot.metadata['url'] + url = self.get_configuration_snapshot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} + get_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}'} # type: ignore def recover_site_configuration_snapshot( - self, resource_group_name, name, snapshot_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reverts the configuration of an app to a previous snapshot. - Description for Reverts the configuration of an app to a previous - snapshot. + Description for Reverts the configuration of an app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.recover_site_configuration_snapshot.metadata['url'] + url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} + recover_site_configuration_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover'} # type: ignore def get_web_site_container_logs( - self, resource_group_name, name, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the last lines of docker logs for the given site. Description for Gets the last lines of docker logs for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_web_site_container_logs.metadata['url'] + url = self.get_web_site_container_logs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/octet-stream' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} + get_web_site_container_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs'} # type: ignore def get_container_logs_zip( - self, resource_group_name, name, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the ZIP archived docker log files for the given site. - Description for Gets the ZIP archived docker log files for the given - site. + Description for Gets the ZIP archived docker log files for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_container_logs_zip.metadata['url'] + url = self.get_container_logs_zip.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/zip' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} + get_container_logs_zip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download'} # type: ignore def list_continuous_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ContinuousWebJobCollection"] """List continuous web jobs for an app, or a deployment slot. - Description for List continuous web jobs for an app, or a deployment - slot. + Description for List continuous web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContinuousWebJob - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobPaged[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_continuous_web_jobs.metadata['url'] + url = self.list_continuous_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContinuousWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContinuousWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs'} # type: ignore def get_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ContinuousWebJob"] """Gets a continuous web job by its ID for an app, or a deployment slot. - Description for Gets a continuous web job by its ID for an app, or a - deployment slot. + Description for Gets a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContinuousWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_continuous_web_job.metadata['url'] + url = self.get_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ContinuousWebJob', response) + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} + get_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore def delete_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a continuous web job by its ID for an app, or a deployment slot. - Description for Delete a continuous web job by its ID for an app, or a - deployment slot. + Description for Delete a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_continuous_web_job.metadata['url'] + url = self.delete_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} + delete_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}'} # type: ignore def start_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Start a continuous web job for an app, or a deployment slot. - Description for Start a continuous web job for an app, or a deployment - slot. + Description for Start a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_continuous_web_job.metadata['url'] + url = self.start_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} + start_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start'} # type: ignore def stop_continuous_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop a continuous web job for an app, or a deployment slot. - Description for Stop a continuous web job for an app, or a deployment - slot. + Description for Stop a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_continuous_web_job.metadata['url'] + url = self.stop_continuous_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} + if cls: + return cls(pipeline_response, None, {}) + + stop_continuous_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop'} # type: ignore def list_deployments( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentCollection"] """List deployments for an app, or a deployment slot. Description for List deployments for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Deployment - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DeploymentPaged[~azure.mgmt.web.v2019_08_01.models.Deployment] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_deployments.metadata['url'] + url = self.list_deployments.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments'} # type: ignore def get_deployment( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Get a deployment by its ID for an app, or a deployment slot. - Description for Get a deployment by its ID for an app, or a deployment - slot. + Description for Get a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_deployment.metadata['url'] + url = self.get_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + get_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def create_deployment( - self, resource_group_name, name, id, deployment, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + deployment, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Create a deployment for an app, or a deployment slot. Description for Create a deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str @@ -3672,1231 +3919,1236 @@ def create_deployment( :type id: str :param deployment: Deployment details. :type deployment: ~azure.mgmt.web.v2019_08_01.models.Deployment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_deployment.metadata['url'] + url = self.create_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + create_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def delete_deployment( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a deployment by its ID for an app, or a deployment slot. - Description for Delete a deployment by its ID for an app, or a - deployment slot. + Description for Delete a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_deployment.metadata['url'] + url = self.delete_deployment.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} + delete_deployment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}'} # type: ignore def list_deployment_log( - self, resource_group_name, name, id, custom_headers=None, raw=False, **operation_config): - """List deployment log for specific deployment for an app, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" + """List deployment log for specific deployment for an app, or a deployment slot. - Description for List deployment log for specific deployment for an app, - or a deployment slot. + Description for List deployment log for specific deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param id: The ID of a specific deployment. This is the value of the - name property in the JSON response from "GET - /api/sites/{siteName}/deployments". + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_deployment_log.metadata['url'] + url = self.list_deployment_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} + list_deployment_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log'} # type: ignore def discover_backup( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): - """Discovers an existing app backup that can be restored from a blob in - Azure storage. Use this to get information about the databases stored - in a backup. + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreRequest" + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. - Description for Discovers an existing app backup that can be restored - from a blob in Azure storage. Use this to get information about the - databases stored in a backup. + Description for Discovers an existing app backup that can be restored from a blob in Azure + storage. Use this to get information about the databases stored in a backup. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: A RestoreRequest object that includes Azure storage - URL and blog name for discovery of backup. + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RestoreRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.discover_backup.metadata['url'] + url = self.discover_backup.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RestoreRequest', response) + deserialized = self._deserialize('RestoreRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - discover_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup'} + discover_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup'} # type: ignore def list_domain_ownership_identifiers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """Lists ownership identifiers for domain associated with web app. - Description for Lists ownership identifiers for domain associated with - web app. + Description for Lists ownership identifiers for domain associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2019_08_01.models.IdentifierPaged[~azure.mgmt.web.v2019_08_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_domain_ownership_identifiers.metadata['url'] + url = self.list_domain_ownership_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers'} # type: ignore def get_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" """Get domain ownership identifier for web app. Description for Get domain ownership identifier for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_domain_ownership_identifier.metadata['url'] + url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def create_or_update_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, kind=None, value=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Description for Creates a domain ownership identifier for web app, or - updates an existing ownership identifier. + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param kind: Kind of resource. - :type kind: str - :param value: String representation of the identity. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_domain_ownership_identifier.metadata['url'] + url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + create_or_update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def delete_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a domain ownership identifier for a web app. Description for Deletes a domain ownership identifier for a web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_domain_ownership_identifier.metadata['url'] + url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + delete_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def update_domain_ownership_identifier( - self, resource_group_name, name, domain_ownership_identifier_name, kind=None, value=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. - Description for Creates a domain ownership identifier for web app, or - updates an existing ownership identifier. + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param kind: Kind of resource. - :type kind: str - :param value: String representation of the identity. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_domain_ownership_identifier.metadata['url'] + url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + update_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def get_ms_deploy_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Description for Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_ms_deploy_status.metadata['url'] + url = self.get_ms_deploy_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} - + get_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore def _create_ms_deploy_operation_initial( - self, resource_group_name, name, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_ms_deploy_operation.metadata['url'] + url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore - def create_ms_deploy_operation( - self, resource_group_name, name, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_ms_deploy_operation( + self, + resource_group_name, # type: str + name, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Description for Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_ms_deploy_operation_initial( - resource_group_name=resource_group_name, - name=name, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy'} # type: ignore def get_ms_deploy_log( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Description for Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_ms_deploy_log.metadata['url'] + url = self.get_ms_deploy_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} + get_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log'} # type: ignore def list_functions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.FunctionEnvelopeCollection"] """List the functions for a web site, or a deployment slot. - Description for List the functions for a web site, or a deployment - slot. + Description for List the functions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of FunctionEnvelope - :rtype: - ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelopePaged[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_functions.metadata['url'] + url = self.list_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('FunctionEnvelopeCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.FunctionEnvelopePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions'} # type: ignore def get_functions_admin_token( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Fetch a short lived token that can be exchanged for a master key. - Description for Fetch a short lived token that can be exchanged for a - master key. + Description for Fetch a short lived token that can be exchanged for a master key. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_functions_admin_token.metadata['url'] + url = self.get_functions_admin_token.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} + get_functions_admin_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token'} # type: ignore def get_function( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.FunctionEnvelope"] """Get function information by its ID for web site, or a deployment slot. - Description for Get function information by its ID for web site, or a - deployment slot. + Description for Get function information by its ID for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionEnvelope or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_function.metadata['url'] + url = self.get_function.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} - + get_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def _create_function_initial( - self, resource_group_name, name, function_name, function_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionEnvelope" + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_function.metadata['url'] + url = self._create_function_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_function_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore - def create_function( - self, resource_group_name, name, function_name, function_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_function( + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.FunctionEnvelope"] """Create function for web site, or a deployment slot. Description for Create function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str :param function_envelope: Function details. - :type function_envelope: - ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type function_envelope: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns FunctionEnvelope or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_function_initial( - resource_group_name=resource_group_name, - name=name, - function_name=function_name, - function_envelope=function_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('FunctionEnvelope', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_function_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def delete_function( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function for web site, or a deployment slot. Description for Delete a function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_function.metadata['url'] + url = self.delete_function.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} + delete_function.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}'} # type: ignore def create_or_update_function_secret( - self, resource_group_name, name, function_name, key_name, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a function secret. Description for Add or update a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -4904,80 +5156,78 @@ def create_or_update_function_secret( :type function_name: str :param key_name: The name of the key. :type key_name: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_function_secret.metadata['url'] + url = self.create_or_update_function_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} + create_or_update_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore def delete_function_secret( - self, resource_group_name, name, function_name, key_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function secret. Description for Delete a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -4985,370 +5235,358 @@ def delete_function_secret( :type function_name: str :param key_name: The name of the key. :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_function_secret.metadata['url'] + url = self.delete_function_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_function_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}'} # type: ignore def list_function_keys( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Get function keys for a function in a web site, or a deployment slot. - Description for Get function keys for a function in a web site, or a - deployment slot. + Description for Get function keys for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_function_keys.metadata['url'] + url = self.list_function_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys'} + list_function_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys'} # type: ignore def list_function_secrets( - self, resource_group_name, name, function_name, custom_headers=None, raw=False, **operation_config): - """Get function secrets for a function in a web site, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" + """Get function secrets for a function in a web site, or a deployment slot. - Description for Get function secrets for a function in a web site, or a - deployment slot. + Description for Get function secrets for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param function_name: Function name. :type function_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_function_secrets.metadata['url'] + url = self.list_function_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} + list_function_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets'} # type: ignore def list_host_keys( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostKeys" """Get host secrets for a function app. Description for Get host secrets for a function app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HostKeys or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_host_keys.metadata['url'] + url = self.list_host_keys.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostKeys', response) + deserialized = self._deserialize('HostKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_host_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys'} + list_host_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys'} # type: ignore def list_sync_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """This is to allow calling via powershell and ARM template. - Description for This is to allow calling via powershell and ARM - template. + Description for This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_sync_status.metadata['url'] + url = self.list_sync_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - list_sync_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus'} + list_sync_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus'} # type: ignore def sync_functions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. - Description for Syncs function trigger metadata to the management - database. + Description for Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.sync_functions.metadata['url'] + url = self.sync_functions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync'} + sync_functions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync'} # type: ignore def create_or_update_host_secret( - self, resource_group_name, name, key_type, key_name, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a host level secret. Description for Add or update a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -5356,80 +5594,78 @@ def create_or_update_host_secret( :type key_type: str :param key_name: The name of the key. :type key_name: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_host_secret.metadata['url'] + url = self.create_or_update_host_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} + create_or_update_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore def delete_host_secret( - self, resource_group_name, name, key_type, key_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a host level secret. Description for Delete a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -5437,336 +5673,332 @@ def delete_host_secret( :type key_type: str :param key_name: The name of the key. :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_host_secret.metadata['url'] + url = self.delete_host_secret.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}'} # type: ignore def list_host_name_bindings( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HostNameBindingCollection"] """Get hostname bindings for an app or a deployment slot. Description for Get hostname bindings for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HostNameBinding - :rtype: - ~azure.mgmt.web.v2019_08_01.models.HostNameBindingPaged[~azure.mgmt.web.v2019_08_01.models.HostNameBinding] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_host_name_bindings.metadata['url'] + url = self.list_host_name_bindings.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HostNameBindingCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HostNameBindingPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} + return ItemPaged( + get_next, extract_data + ) + list_host_name_bindings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings'} # type: ignore def get_host_name_binding( - self, resource_group_name, name, host_name, custom_headers=None, raw=False, **operation_config): - """Get the named hostname binding for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" + """Get the named hostname binding for an app (or deployment slot, if specified). - Description for Get the named hostname binding for an app (or - deployment slot, if specified). + Description for Get the named hostname binding for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_host_name_binding.metadata['url'] + url = self.get_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + get_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def create_or_update_host_name_binding( - self, resource_group_name, name, host_name, host_name_binding, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + host_name_binding, # type: "models.HostNameBinding" + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" """Creates a hostname binding for an app. Description for Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param host_name_binding: Binding details. This is the JSON - representation of a HostNameBinding object. - :type host_name_binding: - ~azure.mgmt.web.v2019_08_01.models.HostNameBinding - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_host_name_binding.metadata['url'] + url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + create_or_update_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def delete_host_name_binding( - self, resource_group_name, name, host_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Description for Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_host_name_binding.metadata['url'] + url = self.delete_host_name_binding.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} + delete_host_name_binding.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}'} # type: ignore def get_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): - """Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. - Description for Retrieves a specific Service Bus Hybrid Connection used - by this Web App. + Description for Retrieves a specific Service Bus Hybrid Connection used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5774,69 +6006,67 @@ def get_hybrid_connection( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_hybrid_connection.metadata['url'] + url = self.get_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def create_or_update_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. - Description for Creates a new Hybrid Connection using a Service Bus - relay. + Description for Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5845,74 +6075,73 @@ def create_or_update_hybrid_connection( :param relay_name: The relay name for this hybrid connection. :type relay_name: str :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.HybridConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_hybrid_connection.metadata['url'] + url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + create_or_update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Removes a Hybrid Connection from this site. Description for Removes a Hybrid Connection from this site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5920,61 +6149,63 @@ def delete_hybrid_connection( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_hybrid_connection.metadata['url'] + url = self.delete_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def update_hybrid_connection( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. - Description for Creates a new Hybrid Connection using a Service Bus - relay. + Description for Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -5983,1241 +6214,1230 @@ def update_hybrid_connection( :param relay_name: The relay name for this hybrid connection. :type relay_name: str :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.HybridConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_hybrid_connection.metadata['url'] + url = self.update_hybrid_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + update_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieves all Service Bus Hybrid Connections used by this Web App. - Description for Retrieves all Service Bus Hybrid Connections used by - this Web App. + Description for Retrieves all Service Bus Hybrid Connections used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_hybrid_connections.metadata['url'] + url = self.list_hybrid_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} + list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'} # type: ignore def list_relay_service_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets hybrid connections configured for an app (or deployment slot, if + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Description for Gets hybrid connections configured for an app (or deployment slot, if specified). - Description for Gets hybrid connections configured for an app (or - deployment slot, if specified). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_relay_service_connections.metadata['url'] + url = self.list_relay_service_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} + list_relay_service_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection'} # type: ignore def get_relay_service_connection( - self, resource_group_name, name, entity_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" """Gets a hybrid connection configuration by its name. Description for Gets a hybrid connection configuration by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection. :type entity_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_relay_service_connection.metadata['url'] + url = self.get_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + get_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def create_or_update_relay_service_connection( - self, resource_group_name, name, entity_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). - - Description for Creates a new hybrid connection configuration (PUT), or - updates an existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_relay_service_connection.metadata['url'] + url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + create_or_update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def delete_relay_service_connection( - self, resource_group_name, name, entity_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a relay service connection by its name. Description for Deletes a relay service connection by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_relay_service_connection.metadata['url'] + url = self.delete_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + if cls: + return cls(pipeline_response, None, {}) - def update_relay_service_connection( - self, resource_group_name, name, entity_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + delete_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore - Description for Creates a new hybrid connection configuration (PUT), or - updates an existing one (PATCH). + def update_relay_service_connection( + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_relay_service_connection.metadata['url'] + url = self.update_relay_service_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} + update_relay_service_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}'} # type: ignore def list_instance_identifiers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppInstanceCollection"] """Gets all scale-out instances of an app. Description for Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteInstance - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteInstancePaged[~azure.mgmt.web.v2019_08_01.models.SiteInstance] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_identifiers.metadata['url'] + url = self.list_instance_identifiers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppInstanceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} + return ItemPaged( + get_next, extract_data + ) + list_instance_identifiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances'} # type: ignore def get_instance_info( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebSiteInstanceStatus" """Gets all scale-out instances of an app. Description for Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param instance_id: :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebSiteInstanceStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WebSiteInstanceStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebSiteInstanceStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebSiteInstanceStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_info.metadata['url'] + url = self.get_instance_info.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WebSiteInstanceStatus', response) + deserialized = self._deserialize('WebSiteInstanceStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}'} + get_instance_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}'} # type: ignore def get_instance_ms_deploy_status( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Description for Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_ms_deploy_status.metadata['url'] + url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} - + get_instance_ms_deploy_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def _create_instance_ms_deploy_operation_initial( - self, resource_group_name, name, instance_id, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_ms_deploy_operation.metadata['url'] + url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_instance_ms_deploy_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore - def create_instance_ms_deploy_operation( - self, resource_group_name, name, instance_id, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_instance_ms_deploy_operation( + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Description for Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_instance_ms_deploy_operation_initial( - resource_group_name=resource_group_name, - name=name, - instance_id=instance_id, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_ms_deploy_operation_initial( + resource_group_name=resource_group_name, + name=name, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def get_instance_ms_deploy_log( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Description for Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_ms_deploy_log.metadata['url'] + url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} + get_instance_ms_deploy_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore def list_instance_processes( - self, resource_group_name, name, instance_id, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Description for Get list of processes for a web site, or a deployment - slot, or for a specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_processes.metadata['url'] + url = self.list_instance_processes.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_instance_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes'} # type: ignore def get_instance_process( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_process.metadata['url'] + url = self.get_instance_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} + get_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore def delete_instance_process( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Description for Terminate a process by its ID for a web site, or a - deployment slot, or specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_instance_process.metadata['url'] + url = self.delete_instance_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} + if cls: + return cls(pipeline_response, None, {}) - def get_instance_process_dump( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + delete_instance_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}'} # type: ignore - Description for Get a memory dump of a process by its ID for a specific - scaled-out instance in a web site. + def get_instance_process_dump( + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_process_dump.metadata['url'] + url = self.get_instance_process_dump.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} + get_instance_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore def list_instance_process_modules( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. - - Description for List module information for a process by its ID for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_modules.metadata['url'] + url = self.list_instance_process_modules.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore def get_instance_process_module( - self, resource_group_name, name, process_id, base_address, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -7225,1053 +7445,1050 @@ def get_instance_process_module( :type process_id: str :param base_address: Module base address. :type base_address: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_process_module.metadata['url'] + url = self.get_instance_process_module.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} + get_instance_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_instance_process_threads( - self, resource_group_name, name, process_id, instance_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - Description for List the threads in a process by its ID for a specific - scaled-out instance in a web site. + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_threads.metadata['url'] + url = self.list_instance_process_threads.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore def is_cloneable( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Shows whether an app can be cloned to another resource group or - subscription. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteCloneability" + """Shows whether an app can be cloned to another resource group or subscription. - Description for Shows whether an app can be cloned to another resource - group or subscription. + Description for Shows whether an app can be cloned to another resource group or subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteCloneability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteCloneability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.is_cloneable.metadata['url'] + url = self.is_cloneable.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteCloneability', response) + deserialized = self._deserialize('SiteCloneability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} + is_cloneable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable'} # type: ignore def list_site_backups( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Description for Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2019_08_01.models.BackupItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItem] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_backups.metadata['url'] + url = self.list_site_backups.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.post(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listbackups'} + return ItemPaged( + get_next, extract_data + ) + list_site_backups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listbackups'} # type: ignore def list_sync_function_triggers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" """This is to allow calling via powershell and ARM template. - Description for This is to allow calling via powershell and ARM - template. + Description for This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_sync_function_triggers.metadata['url'] + url = self.list_sync_function_triggers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} - + list_sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus'} # type: ignore def _migrate_storage_initial( - self, subscription_name, resource_group_name, name, migration_options, custom_headers=None, raw=False, **operation_config): + self, + subscription_name, # type: str + resource_group_name, # type: str + name, # type: str + migration_options, # type: "models.StorageMigrationOptions" + **kwargs # type: Any + ): + # type: (...) -> "models.StorageMigrationResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.migrate_storage.metadata['url'] + url = self._migrate_storage_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['subscriptionName'] = self._serialize.query("subscription_name", subscription_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('StorageMigrationResponse', response) + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _migrate_storage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore - def migrate_storage( - self, subscription_name, resource_group_name, name, migration_options, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_migrate_storage( + self, + subscription_name, # type: str + resource_group_name, # type: str + name, # type: str + migration_options, # type: "models.StorageMigrationOptions" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.StorageMigrationResponse"] """Restores a web app. Description for Restores a web app. :param subscription_name: Azure subscription. :type subscription_name: str - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param migration_options: Migration migrationOptions. - :type migration_options: - ~azure.mgmt.web.v2019_08_01.models.StorageMigrationOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type migration_options: ~azure.mgmt.web.v2019_08_01.models.StorageMigrationOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - StorageMigrationResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.StorageMigrationResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.StorageMigrationResponse]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._migrate_storage_initial( - subscription_name=subscription_name, - resource_group_name=resource_group_name, - name=name, - migration_options=migration_options, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageMigrationResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.StorageMigrationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('StorageMigrationResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._migrate_storage_initial( + subscription_name=subscription_name, + resource_group_name=resource_group_name, + name=name, + migration_options=migration_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageMigrationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_storage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate'} # type: ignore def _migrate_my_sql_initial( - self, resource_group_name, name, migration_request_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + migration_request_envelope, # type: "models.MigrateMySqlRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.Operation" + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.migrate_my_sql.metadata['url'] + url = self._migrate_my_sql_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('Operation', response) + deserialized = self._deserialize('Operation', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _migrate_my_sql_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore - def migrate_my_sql( - self, resource_group_name, name, migration_request_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_migrate_my_sql( + self, + resource_group_name, # type: str + name, # type: str + migration_request_envelope, # type: "models.MigrateMySqlRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Operation"] """Migrates a local (in-app) MySql database to a remote MySql database. - Description for Migrates a local (in-app) MySql database to a remote - MySql database. + Description for Migrates a local (in-app) MySql database to a remote MySql database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param migration_request_envelope: MySql migration options. - :type migration_request_envelope: - ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type migration_request_envelope: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Operation or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.Operation] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.Operation]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._migrate_my_sql_initial( - resource_group_name=resource_group_name, - name=name, - migration_request_envelope=migration_request_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Operation or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Operation', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._migrate_my_sql_initial( + resource_group_name=resource_group_name, + name=name, + migration_request_envelope=migration_request_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Operation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_migrate_my_sql.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql'} # type: ignore def get_migrate_my_sql_status( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MigrateMySqlStatus" + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - Description for Returns the status of MySql in app migration, if one is - active, and whether or not MySql in app is enabled. + Description for Returns the status of MySql in app migration, if one is active, and whether or + not MySql in app is enabled. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MigrateMySqlStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_migrate_my_sql_status.metadata['url'] + url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MigrateMySqlStatus', response) + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} + get_migrate_my_sql_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status'} # type: ignore def get_swift_virtual_network_connection( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" """Gets a Swift Virtual Network connection. Description for Gets a Swift Virtual Network connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_swift_virtual_network_connection.metadata['url'] + url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + get_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def create_or_update_swift_virtual_network_connection( - self, resource_group_name, name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Description for Integrates this Web App with a Virtual Network. This - requires that 1) "swiftSupported" is true when doing a GET against this - resource, and 2) that the target Subnet has already been delegated, and - is not + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_swift_virtual_network_connection.metadata['url'] + url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + create_or_update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def delete_swift_virtual_network( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Deletes a Swift Virtual Network connection from an app (or deployment - slot). + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Swift Virtual Network connection from an app (or deployment slot). - Description for Deletes a Swift Virtual Network connection from an app - (or deployment slot). + Description for Deletes a Swift Virtual Network connection from an app (or deployment slot). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_swift_virtual_network.metadata['url'] + url = self.delete_swift_virtual_network.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_swift_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + if cls: + return cls(pipeline_response, None, {}) + + delete_swift_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def update_swift_virtual_network_connection( - self, resource_group_name, name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Description for Integrates this Web App with a Virtual Network. This - requires that 1) "swiftSupported" is true when doing a GET against this - resource, and 2) that the target Subnet has already been delegated, and - is not + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_swift_virtual_network_connection.metadata['url'] + url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} + update_swift_virtual_network_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork'} # type: ignore def list_network_features( - self, resource_group_name, name, view, custom_headers=None, raw=False, **operation_config): - """Gets all network features used by the app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + view, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.NetworkFeatures"] + """Gets all network features used by the app (or deployment slot, if specified). - Description for Gets all network features used by the app (or - deployment slot, if specified). + Description for Gets all network features used by the app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param view: The type of view. This can either be "summary" or - "detailed". + :param view: The type of view. This can either be "summary" or "detailed". :type view: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NetworkFeatures or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.NetworkFeatures or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_network_features.metadata['url'] + url = self.list_network_features.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'view': self._serialize.url("view", view, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkFeatures', response) + deserialized = self._deserialize('NetworkFeatures', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} + list_network_features.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}'} # type: ignore def get_network_trace_operation( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). - - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_trace_operation.metadata['url'] + url = self.get_network_trace_operation.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}'} + get_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}'} # type: ignore def start_web_site_network_trace( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str """Start capturing network packets for the site (To be deprecated). - Description for Start capturing network packets for the site (To be - deprecated). + Description for Start capturing network packets for the site (To be deprecated). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -8281,123 +8498,130 @@ def start_web_site_network_trace( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_web_site_network_trace.metadata['url'] + url = self.start_web_site_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} - + start_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start'} # type: ignore def _start_web_site_network_trace_operation_initial( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_web_site_network_trace_operation.metadata['url'] + url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_web_site_network_trace_operation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore - def start_web_site_network_trace_operation( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_web_site_network_trace_operation( + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Description for Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -8407,1344 +8631,1323 @@ def start_web_site_network_trace_operation( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_web_site_network_trace_operation_initial( - resource_group_name=resource_group_name, - name=name, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_web_site_network_trace_operation_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_web_site_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation'} # type: ignore def stop_web_site_network_trace( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Description for Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_web_site_network_trace.metadata['url'] + url = self.stop_web_site_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} + if cls: + return cls(pipeline_response, None, {}) - def get_network_traces( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + stop_web_site_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop'} # type: ignore - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + def get_network_traces( + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_traces.metadata['url'] + url = self.get_network_traces.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}'} + get_network_traces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}'} # type: ignore def get_network_trace_operation_v2( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). - - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_trace_operation_v2.metadata['url'] + url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}'} + get_network_trace_operation_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}'} # type: ignore def get_network_traces_v2( - self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). - - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_traces_v2.metadata['url'] + url = self.get_network_traces_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}'} + get_network_traces_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}'} # type: ignore def generate_new_site_publishing_password( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Generates a new publishing password for an app (or deployment slot, if + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Generates a new publishing password for an app (or deployment slot, if specified). + + Description for Generates a new publishing password for an app (or deployment slot, if specified). - Description for Generates a new publishing password for an app (or - deployment slot, if specified). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.generate_new_site_publishing_password.metadata['url'] + url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} + generate_new_site_publishing_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword'} # type: ignore def list_perf_mon_counters( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PerfMonCounterCollection"] """Gets perfmon counters for web app. Description for Gets perfmon counters for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PerfMonResponse - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PerfMonResponsePaged[~azure.mgmt.web.v2019_08_01.models.PerfMonResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_perf_mon_counters.metadata['url'] + url = self.list_perf_mon_counters.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PerfMonResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} + return ItemPaged( + get_next, extract_data + ) + list_perf_mon_counters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters'} # type: ignore def get_site_php_error_log_flag( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SitePhpErrorLogFlag" """Gets web app's event logs. Description for Gets web app's event logs. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SitePhpErrorLogFlag or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SitePhpErrorLogFlag or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_php_error_log_flag.metadata['url'] + url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SitePhpErrorLogFlag', response) + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} + get_site_php_error_log_flag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging'} # type: ignore def list_premier_add_ons( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets the premier add-ons of an app. Description for Gets the premier add-ons of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_premier_add_ons.metadata['url'] + url = self.list_premier_add_ons.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} + list_premier_add_ons.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons'} # type: ignore def get_premier_add_on( - self, resource_group_name, name, premier_add_on_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets a named add-on of an app. Description for Gets a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_premier_add_on.metadata['url'] + url = self.get_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + get_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def add_premier_add_on( - self, resource_group_name, name, premier_add_on_name, premier_add_on, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + premier_add_on, # type: "models.PremierAddOn" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Description for Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. + :param premier_add_on: A JSON representation of the edited premier add-on. :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.add_premier_add_on.metadata['url'] + url = self.add_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + add_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def delete_premier_add_on( - self, resource_group_name, name, premier_add_on_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a premier add-on from an app. Description for Delete a premier add-on from an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_premier_add_on.metadata['url'] + url = self.delete_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + delete_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def update_premier_add_on( - self, resource_group_name, name, premier_add_on_name, premier_add_on, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + premier_add_on, # type: "models.PremierAddOnPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Description for Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: - ~azure.mgmt.web.v2019_08_01.models.PremierAddOnPatchResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_premier_add_on.metadata['url'] + url = self.update_premier_add_on.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} + update_premier_add_on.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}'} # type: ignore def get_private_access( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Gets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. - Description for Gets data around private site access enablement and - authorized Virtual Networks that can access the site. + Description for Gets data around private site access enablement and authorized Virtual Networks + that can access the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_private_access.metadata['url'] + url = self.get_private_access.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_private_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} + get_private_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore def put_private_access_vnet( - self, resource_group_name, name, access, custom_headers=None, raw=False, **operation_config): - """Sets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + access, # type: "models.PrivateAccess" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. - Description for Sets data around private site access enablement and - authorized Virtual Networks that can access the site. + Description for Sets data around private site access enablement and authorized Virtual Networks + that can access the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param access: The information for the private access + :param access: The information for the private access. :type access: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.put_private_access_vnet.metadata['url'] + url = self.put_private_access_vnet.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - put_private_access_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} + put_private_access_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks'} # type: ignore def list_processes( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Description for Get list of processes for a web site, or a deployment - slot, or for a specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_processes.metadata['url'] + url = self.list_processes.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_processes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes'} # type: ignore def get_process( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_process.metadata['url'] + url = self.get_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} + get_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore def delete_process( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Description for Terminate a process by its ID for a web site, or a - deployment slot, or specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_process.metadata['url'] + url = self.delete_process.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} + if cls: + return cls(pipeline_response, None, {}) - def get_process_dump( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + delete_process.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}'} # type: ignore - Description for Get a memory dump of a process by its ID for a specific - scaled-out instance in a web site. + def get_process_dump( + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_process_dump.metadata['url'] + url = self.get_process_dump.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} + get_process_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump'} # type: ignore def list_process_modules( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. - - Description for List module information for a process by its ID for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_modules.metadata['url'] + url = self.list_process_modules.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_process_modules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules'} # type: ignore def get_process_module( - self, resource_group_name, name, process_id, base_address, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -9752,5823 +9955,5886 @@ def get_process_module( :type process_id: str :param base_address: Module base address. :type base_address: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_process_module.metadata['url'] + url = self.get_process_module.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} + get_process_module.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_process_threads( - self, resource_group_name, name, process_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - Description for List the threads in a process by its ID for a specific - scaled-out instance in a web site. + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_threads.metadata['url'] + url = self.list_process_threads.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_process_threads.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads'} # type: ignore def list_public_certificates( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PublicCertificateCollection"] """Get public certificates for an app or a deployment slot. - Description for Get public certificates for an app or a deployment - slot. + Description for Get public certificates for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PublicCertificate - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PublicCertificatePaged[~azure.mgmt.web.v2019_08_01.models.PublicCertificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_public_certificates.metadata['url'] + url = self.list_public_certificates.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PublicCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PublicCertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} + return ItemPaged( + get_next, extract_data + ) + list_public_certificates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates'} # type: ignore def get_public_certificate( - self, resource_group_name, name, public_certificate_name, custom_headers=None, raw=False, **operation_config): - """Get the named public certificate for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" + """Get the named public certificate for an app (or deployment slot, if specified). - Description for Get the named public certificate for an app (or - deployment slot, if specified). + Description for Get the named public certificate for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_public_certificate.metadata['url'] + url = self.get_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + get_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def create_or_update_public_certificate( - self, resource_group_name, name, public_certificate_name, public_certificate, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + public_certificate, # type: "models.PublicCertificate" + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" """Creates a hostname binding for an app. Description for Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param public_certificate: Public certificate details. This is the - JSON representation of a PublicCertificate object. - :type public_certificate: - ~azure.mgmt.web.v2019_08_01.models.PublicCertificate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_public_certificate.metadata['url'] + url = self.create_or_update_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + create_or_update_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def delete_public_certificate( - self, resource_group_name, name, public_certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Description for Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_public_certificate.metadata['url'] + url = self.delete_public_certificate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_public_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}'} # type: ignore def list_publishing_profile_xml_with_secrets( - self, resource_group_name, name, format=None, include_disaster_recovery_endpoints=None, custom_headers=None, raw=False, callback=None, **operation_config): - """Gets the publishing profile for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + publishing_profile_options, # type: "models.CsmPublishingProfileOptions" + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets the publishing profile for an app (or deployment slot, if specified). - Description for Gets the publishing profile for an app (or deployment - slot, if specified). + Description for Gets the publishing profile for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param format: Name of the format. Valid values are: - FileZilla3 - WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2019_08_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the - DisasterRecover endpoint if true - :type include_disaster_recovery_endpoints: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError """ - publishing_profile_options = models.CsmPublishingProfileOptions(format=format, include_disaster_recovery_endpoints=include_disaster_recovery_endpoints) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.list_publishing_profile_xml_with_secrets.metadata['url'] + url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/xml' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} + list_publishing_profile_xml_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml'} # type: ignore def reset_production_slot_config( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): - """Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. - Description for Resets the configuration settings of the current slot - if they were previously modified by calling the API with POST. + Description for Resets the configuration settings of the current slot if they were previously + modified by calling the API with POST. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reset_production_slot_config.metadata['url'] + url = self.reset_production_slot_config.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} + if cls: + return cls(pipeline_response, None, {}) + + reset_production_slot_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig'} # type: ignore def restart( - self, resource_group_name, name, soft_restart=None, synchronous=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + soft_restart=None, # type: Optional[bool] + synchronous=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restarts an app (or deployment slot, if specified). Description for Restarts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param soft_restart: Specify true to apply the configuration settings - and restarts the app only if necessary. By default, the API always - restarts and reprovisions the app. + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. :type soft_restart: bool - :param synchronous: Specify true to block until the app is restarted. - By default, it is set to false, and the API responds immediately - (asynchronous). + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). :type synchronous: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.restart.metadata['url'] + url = self.restart.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') if synchronous is not None: query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} + if cls: + return cls(pipeline_response, None, {}) + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart'} # type: ignore def _restore_from_backup_blob_initial( - self, resource_group_name, name, request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_backup_blob.metadata['url'] + url = self._restore_from_backup_blob_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_backup_blob( - self, resource_group_name, name, request, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_backup_blob_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore + + def begin_restore_from_backup_blob( + self, + resource_group_name, # type: str + name, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores an app from a backup blob in Azure Storage. Description for Restores an app from a backup blob in Azure Storage. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_from_backup_blob_initial( - resource_group_name=resource_group_name, - name=name, - request=request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_backup_blob_initial( + resource_group_name=resource_group_name, + name=name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_backup_blob.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob'} # type: ignore def _restore_from_deleted_app_initial( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_deleted_app.metadata['url'] + url = self._restore_from_deleted_app_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_deleted_app( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_deleted_app_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore + + def begin_restore_from_deleted_app( + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a deleted web app to this web app. Description for Restores a deleted web app to this web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param restore_request: Deleted web app restore information. - :type restore_request: - ~azure.mgmt.web.v2019_08_01.models.DeletedAppRestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_from_deleted_app_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_deleted_app_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_deleted_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp'} # type: ignore def _restore_snapshot_initial( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_snapshot.metadata['url'] + url = self._restore_snapshot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_snapshot( - self, resource_group_name, name, restore_request, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_snapshot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore + + def begin_restore_snapshot( + self, + resource_group_name, # type: str + name, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a web app from a snapshot. Description for Restores a web app from a snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param restore_request: Snapshot restore settings. Snapshot - information can be obtained by calling GetDeletedSites or - GetSiteSnapshots API. - :type restore_request: - ~azure.mgmt.web.v2019_08_01.models.SnapshotRestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_snapshot_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_snapshot_initial( + resource_group_name=resource_group_name, + name=name, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot'} # type: ignore def list_site_extensions( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteExtensionInfoCollection"] """Get list of siteextensions for a web site, or a deployment slot. - Description for Get list of siteextensions for a web site, or a - deployment slot. + Description for Get list of siteextensions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteExtensionInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfoPaged[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_extensions.metadata['url'] + url = self.list_site_extensions.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteExtensionInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} + return ItemPaged( + get_next, extract_data + ) + list_site_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions'} # type: ignore def get_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): - """Get site extension information by its ID for a web site, or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + """Get site extension information by its ID for a web site, or a deployment slot. - Description for Get site extension information by its ID for a web - site, or a deployment slot. + Description for Get site extension information by its ID for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteExtensionInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_extension.metadata['url'] + url = self.get_site_extension.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} - + get_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def _install_site_extension_initial( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.install_site_extension.metadata['url'] + url = self._install_site_extension_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _install_site_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore - def install_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_install_site_extension( + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteExtensionInfo"] """Install site extension on a web site, or a deployment slot. - Description for Install site extension on a web site, or a deployment - slot. + Description for Install site extension on a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteExtensionInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._install_site_extension_initial( - resource_group_name=resource_group_name, - name=name, - site_extension_id=site_extension_id, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteExtensionInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_site_extension_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def delete_site_extension( - self, resource_group_name, name, site_extension_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Remove a site extension from a web site, or a deployment slot. - Description for Remove a site extension from a web site, or a - deployment slot. + Description for Remove a site extension from a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_site_extension.metadata['url'] + url = self.delete_site_extension.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} + if cls: + return cls(pipeline_response, None, {}) + delete_site_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}'} # type: ignore def _copy_production_slot_initial( - self, resource_group_name, name, target_slot, site_config, custom_headers=None, raw=False, **operation_config): - copy_slot_entity = models.CsmCopySlotEntity(target_slot=target_slot, site_config=site_config) + self, + resource_group_name, # type: str + name, # type: str + copy_slot_entity, # type: "models.CsmCopySlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.copy_production_slot.metadata['url'] + url = self._copy_production_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def copy_production_slot( - self, resource_group_name, name, target_slot, site_config, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _copy_production_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotcopy'} # type: ignore + + def begin_copy_production_slot( + self, + resource_group_name, # type: str + name, # type: str + copy_slot_entity, # type: "models.CsmCopySlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Copies a deployment slot to another deployment slot of an app. - Description for Copies a deployment slot to another deployment slot of - an app. + Description for Copies a deployment slot to another deployment slot of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during copy operation. - :type target_slot: str - :param site_config: The site object which will be merged with the - source slot site - to produce new destination slot site object. - null to just copy source slot content. Otherwise a - Site - object with properties to override source slot site. - :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param copy_slot_entity: JSON object that contains the target slot name and site config + properties to override the source slot config. See example. + :type copy_slot_entity: ~azure.mgmt.web.v2019_08_01.models.CsmCopySlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._copy_production_slot_initial( - resource_group_name=resource_group_name, - name=name, - target_slot=target_slot, - site_config=site_config, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._copy_production_slot_initial( + resource_group_name=resource_group_name, + name=name, + copy_slot_entity=copy_slot_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - copy_production_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotcopy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_copy_production_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotcopy'} # type: ignore def list_slots( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppCollection"] """Gets an app's deployment slots. Description for Gets an app's deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Site - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SitePaged[~azure.mgmt.web.v2019_08_01.models.Site] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slots.metadata['url'] + url = self.list_slots.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} + return ItemPaged( + get_next, extract_data + ) + list_slots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots'} # type: ignore def get_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Site"] """Gets the details of a web, mobile, or API app. Description for Gets the details of a web, mobile, or API app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. By default, this API returns - the production slot. + :param slot: Name of the deployment slot. By default, this API returns the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_slot.metadata['url'] + url = self.get_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} - + get_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def _create_or_update_slot_initial( - self, resource_group_name, name, site_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_slot.metadata['url'] + url = self._create_or_update_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore - def create_or_update_slot( - self, resource_group_name, name, site_envelope, slot, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + def begin_create_or_update_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.Site" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Site"] + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - Description for Creates a new web, mobile, or API app in an existing - resource group, or updates an existing app. + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.Site - :param slot: Name of the deployment slot to create or update. By - default, this API attempts to create or modify the production slot. + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Site or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.Site] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.Site]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_envelope=site_envelope, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Site', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_envelope=site_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def delete_slot( - self, resource_group_name, name, slot, delete_metrics=None, delete_empty_server_farm=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + delete_metrics=None, # type: Optional[bool] + delete_empty_server_farm=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a web, mobile, or API app, or one of the deployment slots. - Description for Deletes a web, mobile, or API app, or one of the - deployment slots. + Description for Deletes a web, mobile, or API app, or one of the deployment slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app to delete. :type name: str - :param slot: Name of the deployment slot to delete. By default, the - API deletes the production slot. + :param slot: Name of the deployment slot to delete. By default, the API deletes the production + slot. :type slot: str :param delete_metrics: If true, web app metrics are also deleted. :type delete_metrics: bool - :param delete_empty_server_farm: Specify true if the App Service plan - will be empty after app deletion and you want to delete the empty App - Service plan. By default, the empty App Service plan is not deleted. + :param delete_empty_server_farm: Specify true if the App Service plan will be empty after app + deletion and you want to delete the empty App Service plan. By default, the empty App Service + plan is not deleted. :type delete_empty_server_farm: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_slot.metadata['url'] + url = self.delete_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if delete_metrics is not None: query_parameters['deleteMetrics'] = self._serialize.query("delete_metrics", delete_metrics, 'bool') if delete_empty_server_farm is not None: query_parameters['deleteEmptyServerFarm'] = self._serialize.query("delete_empty_server_farm", delete_empty_server_farm, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} - - def update_slot( - self, resource_group_name, name, site_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new web, mobile, or API app in an existing resource group, or - updates an existing app. + if cls: + return cls(pipeline_response, None, {}) - Description for Creates a new web, mobile, or API app in an existing - resource group, or updates an existing app. + delete_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. - :type resource_group_name: str - :param name: Unique name of the app to create or update. To create or - update a deployment slot, use the {slot} parameter. - :type name: str - :param site_envelope: A JSON representation of the app properties. See - example. - :type site_envelope: - ~azure.mgmt.web.v2019_08_01.models.SitePatchResource - :param slot: Name of the deployment slot to create or update. By - default, this API attempts to create or modify the production slot. + def update_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_envelope, # type: "models.SitePatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.Site" + """Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + + Description for Creates a new web, mobile, or API app in an existing resource group, or updates + an existing app. + + :param resource_group_name: Name of the resource group to which the resource belongs. + :type resource_group_name: str + :param name: Unique name of the app to create or update. To create or update a deployment slot, + use the {slot} parameter. + :type name: str + :param slot: Name of the deployment slot to create or update. By default, this API attempts to + create or modify the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Site or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Site or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_envelope: A JSON representation of the app properties. See example. + :type site_envelope: ~azure.mgmt.web.v2019_08_01.models.SitePatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Site + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_slot.metadata['url'] + url = self.update_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('Site', response) + deserialized = self._deserialize('Site', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} + update_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}'} # type: ignore def analyze_custom_hostname_slot( - self, resource_group_name, name, slot, host_name=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomHostnameAnalysisResult" """Analyze a custom hostname. Description for Analyze a custom hostname. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param host_name: Custom hostname. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomHostnameAnalysisResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CustomHostnameAnalysisResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.analyze_custom_hostname_slot.metadata['url'] + url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if host_name is not None: query_parameters['hostName'] = self._serialize.query("host_name", host_name, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomHostnameAnalysisResult', response) + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} + analyze_custom_hostname_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname'} # type: ignore def apply_slot_configuration_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - """Applies the configuration settings from the target slot onto the - current slot. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + """Applies the configuration settings from the target slot onto the current slot. - Description for Applies the configuration settings from the target slot - onto the current slot. + Description for Applies the configuration settings from the target slot onto the current slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :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 """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.apply_slot_configuration_slot.metadata['url'] + url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} + apply_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig'} # type: ignore def backup_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Creates a backup of an app. Description for Creates a backup of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: Backup configuration. You can use the JSON response - from the POST action as input here. - :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a backup for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + backup for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param request: Backup configuration. You can use the JSON response from the POST action as + input here. + :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.backup_slot.metadata['url'] + url = self.backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} + backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup'} # type: ignore def list_backups_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Description for Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get backups of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2019_08_01.models.BackupItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItem] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_backups_slot.metadata['url'] + url = self.list_backups_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} + return ItemPaged( + get_next, extract_data + ) + list_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups'} # type: ignore def get_backup_status_slot( - self, resource_group_name, name, backup_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" """Gets a backup of an app by its ID. Description for Gets a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a backup + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_backup_status_slot.metadata['url'] + url = self.get_backup_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} + get_backup_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore def delete_backup_slot( - self, resource_group_name, name, backup_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a backup of an app by its ID. Description for Deletes a backup of an app by its ID. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete a backup of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + backup of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_backup_slot.metadata['url'] + url = self.delete_backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def list_backup_status_secrets_slot( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, **operation_config): - """Gets status of a web app backup that may be in progress, including - secrets associated with the backup, such as the Azure Storage SAS URL. - Also can be used to update the SAS URL for the backup if a new URL is - passed in the request body. + if cls: + return cls(pipeline_response, None, {}) - Description for Gets status of a web app backup that may be in - progress, including secrets associated with the backup, such as the - Azure Storage SAS URL. Also can be used to update the SAS URL for the - backup if a new URL is passed in the request body. + delete_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def list_backup_status_secrets_slot( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupItem" + """Gets status of a web app backup that may be in progress, including secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup if a new URL is passed in the request body. + + Description for Gets status of a web app backup that may be in progress, including secrets + associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the + SAS URL for the backup if a new URL is passed in the request body. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param backup_id: ID of backup. :type backup_id: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str :param request: Information on backup request. :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupItem or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupItem, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupItem + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.list_backup_status_secrets_slot.metadata['url'] + url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupItem', response) + deserialized = self._deserialize('BackupItem', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} - + list_backup_status_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list'} # type: ignore def _restore_slot_initial( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_slot.metadata['url'] + url = self._restore_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'backupId': self._serialize.url("backup_id", backup_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def restore_slot( - self, resource_group_name, name, backup_id, request, slot, custom_headers=None, raw=False, polling=True, **operation_config): - """Restores a specific backup to another app (or deployment slot, if - specified). + _restore_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore + + def begin_restore_slot( + self, + resource_group_name, # type: str + name, # type: str + backup_id, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restores a specific backup to another app (or deployment slot, if specified). - Description for Restores a specific backup to another app (or - deployment slot, if specified). + Description for Restores a specific backup to another app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param backup_id: ID of the backup. :type backup_id: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_slot_initial( - resource_group_name=resource_group_name, - name=name, - backup_id=backup_id, - request=request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_slot_initial( + resource_group_name=resource_group_name, + name=name, + backup_id=backup_id, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore'} # type: ignore def list_configurations_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigResourceCollection"] """List the configurations of an app. Description for List the configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigResource - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigResourcePaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigResource] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configurations_slot.metadata['url'] + url = self.list_configurations_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigResourceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} + return ItemPaged( + get_next, extract_data + ) + list_configurations_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config'} # type: ignore def update_application_settings_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + app_settings, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the application settings of an app. Description for Replaces the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the application settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + application settings for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param app_settings: Application settings of the app. + :type app_settings: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - app_settings = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_application_settings_slot.metadata['url'] + url = self.update_application_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} + update_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings'} # type: ignore def list_application_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the application settings of an app. Description for Gets the application settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the application settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + application settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_application_settings_slot.metadata['url'] + url = self.list_application_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} + list_application_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list'} # type: ignore def update_auth_settings_slot( - self, resource_group_name, name, site_auth_settings, slot, custom_headers=None, raw=False, **operation_config): - """Updates the Authentication / Authorization settings associated with web - app. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_auth_settings, # type: "models.SiteAuthSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" + """Updates the Authentication / Authorization settings associated with web app. - Description for Updates the Authentication / Authorization settings - associated with web app. + Description for Updates the Authentication / Authorization settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param site_auth_settings: Auth settings associated with web app. - :type site_auth_settings: - ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_auth_settings: Auth settings associated with web app. + :type site_auth_settings: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_auth_settings_slot.metadata['url'] + url = self.update_auth_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} + update_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings'} # type: ignore def get_auth_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteAuthSettings" """Gets the Authentication/Authorization settings of an app. - Description for Gets the Authentication/Authorization settings of an - app. + Description for Gets the Authentication/Authorization settings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteAuthSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteAuthSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteAuthSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_auth_settings_slot.metadata['url'] + url = self.get_auth_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteAuthSettings', response) + deserialized = self._deserialize('SiteAuthSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} + get_auth_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list'} # type: ignore def update_azure_storage_accounts_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + azure_storage_accounts, # type: "models.AzureStoragePropertyDictionaryResource" + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Updates the Azure storage account configurations of an app. - Description for Updates the Azure storage account configurations of an - app. + Description for Updates the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the Azure storage account configurations for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Azure storage accounts. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.AzureStorageInfoValue] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param azure_storage_accounts: Azure storage accounts of the app. + :type azure_storage_accounts: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ - azure_storage_accounts = models.AzureStoragePropertyDictionaryResource(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_azure_storage_accounts_slot.metadata['url'] + url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts'} + update_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts'} # type: ignore def list_azure_storage_accounts_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AzureStoragePropertyDictionaryResource" """Gets the Azure storage account configurations of an app. - Description for Gets the Azure storage account configurations of an - app. + Description for Gets the Azure storage account configurations of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the Azure storage account configurations for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + Azure storage account configurations for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AzureStoragePropertyDictionaryResource or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureStoragePropertyDictionaryResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.AzureStoragePropertyDictionaryResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_azure_storage_accounts_slot.metadata['url'] + url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', response) + deserialized = self._deserialize('AzureStoragePropertyDictionaryResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list'} + list_azure_storage_accounts_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list'} # type: ignore def update_backup_configuration_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Updates the backup configuration of an app. Description for Updates the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + backup configuration for the production slot. + :type slot: str :param request: Edited backup configuration. :type request: ~azure.mgmt.web.v2019_08_01.models.BackupRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the backup configuration for the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_backup_configuration_slot.metadata['url'] + url = self.update_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} + update_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore def delete_backup_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the backup configuration of an app. Description for Deletes the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the backup configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + backup configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_backup_configuration_slot.metadata['url'] + url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} + delete_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup'} # type: ignore def get_backup_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupRequest" """Gets the backup configuration of an app. Description for Gets the backup configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the backup configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + backup configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BackupRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.BackupRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_backup_configuration_slot.metadata['url'] + url = self.get_backup_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupRequest', response) + deserialized = self._deserialize('BackupRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} + get_backup_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list'} # type: ignore def update_connection_strings_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_strings, # type: "models.ConnectionStringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Replaces the connection strings of an app. Description for Replaces the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the connection settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + connection settings for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Connection strings. - :type properties: dict[str, - ~azure.mgmt.web.v2019_08_01.models.ConnStringValueTypePair] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :param connection_strings: Connection strings of the app or deployment slot. See example. + :type connection_strings: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ - connection_strings = models.ConnectionStringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_connection_strings_slot.metadata['url'] + url = self.update_connection_strings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} + update_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings'} # type: ignore def list_connection_strings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConnectionStringDictionary" """Gets the connection strings of an app. Description for Gets the connection strings of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the connection settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + connection settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConnectionStringDictionary or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionStringDictionary, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.ConnectionStringDictionary - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_connection_strings_slot.metadata['url'] + url = self.list_connection_strings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConnectionStringDictionary', response) + deserialized = self._deserialize('ConnectionStringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} + list_connection_strings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list'} # type: ignore def get_diagnostic_logs_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Gets the logging configuration of an app. Description for Gets the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the logging configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + logging configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_diagnostic_logs_configuration_slot.metadata['url'] + url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} + get_diagnostic_logs_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore def update_diagnostic_logs_config_slot( - self, resource_group_name, name, site_logs_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_logs_config, # type: "models.SiteLogsConfig" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteLogsConfig" """Updates the logging configuration of an app. Description for Updates the logging configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_logs_config: A SiteLogsConfig JSON object that contains - the logging configuration to change in the "properties" property. - :type site_logs_config: - ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the logging configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + logging configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteLogsConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_logs_config: A SiteLogsConfig JSON object that contains the logging configuration + to change in the "properties" property. + :type site_logs_config: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteLogsConfig, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteLogsConfig + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_diagnostic_logs_config_slot.metadata['url'] + url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteLogsConfig', response) + deserialized = self._deserialize('SiteLogsConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} + update_diagnostic_logs_config_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs'} # type: ignore def update_metadata_slot( - self, resource_group_name, name, slot, kind=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + metadata, # type: "models.StringDictionary" + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Replaces the metadata of an app. Description for Replaces the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the metadata for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + metadata for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param properties: Settings. - :type properties: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param metadata: Edited metadata of the app or deployment slot. See example. + :type metadata: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata = models.StringDictionary(kind=kind, properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_metadata_slot.metadata['url'] + url = self.update_metadata_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} + update_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata'} # type: ignore def list_metadata_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Gets the metadata of an app. Description for Gets the metadata of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the metadata for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + metadata for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_metadata_slot.metadata['url'] + url = self.list_metadata_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} - + list_metadata_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list'} # type: ignore def _list_publishing_credentials_slot_initial( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.User" + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_publishing_credentials_slot.metadata['url'] + url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _list_publishing_credentials_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore - def list_publishing_credentials_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_list_publishing_credentials_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.User"] """Gets the Git/FTP publishing credentials of an app. Description for Gets the Git/FTP publishing credentials of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the publishing credentials for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing credentials for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns User or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.User] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.User]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._list_publishing_credentials_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('User', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._list_publishing_credentials_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_publishing_credentials_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list'} # type: ignore def update_site_push_settings_slot( - self, resource_group_name, name, push_settings, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + push_settings, # type: "models.PushSettings" + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Updates the Push settings associated with web app. Description for Updates the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str + :param slot: Name of web app slot. If not specified then will default to production slot. + :type slot: str :param push_settings: Push settings associated with web app. :type push_settings: ~azure.mgmt.web.v2019_08_01.models.PushSettings - :param slot: Name of web app slot. If not specified then will default - to production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_site_push_settings_slot.metadata['url'] + url = self.update_site_push_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} + update_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings'} # type: ignore def list_site_push_settings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PushSettings" """Gets the Push settings associated with web app. Description for Gets the Push settings associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PushSettings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PushSettings, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PushSettings + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_site_push_settings_slot.metadata['url'] + url = self.list_site_push_settings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PushSettings', response) + deserialized = self._deserialize('PushSettings', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} + list_site_push_settings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list'} # type: ignore def get_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets the configuration of an app, such as platform version and bitness, - default documents, virtual applications, Always On, etc. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets the configuration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc. - Description for Gets the configuration of an app, such as platform - version and bitness, default documents, virtual applications, Always - On, etc. + Description for Gets the configuration of an app, such as platform version and bitness, default + documents, virtual applications, Always On, etc. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_configuration_slot.metadata['url'] + url = self.get_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + get_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def create_or_update_configuration_slot( - self, resource_group_name, name, site_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Description for Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_configuration_slot.metadata['url'] + url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + create_or_update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def update_configuration_slot( - self, resource_group_name, name, site_config, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_config, # type: "models.SiteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" """Updates the configuration of an app. Description for Updates the configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_config: JSON representation of a SiteConfig object. See - example. - :type site_config: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_config: JSON representation of a SiteConfig object. See example. + :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_configuration_slot.metadata['url'] + url = self.update_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} + update_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web'} # type: ignore def list_configuration_snapshot_info_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets a list of web app configuration snapshots identifiers. Each - element of the list contains a timestamp and the ID of the snapshot. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteConfigurationSnapshotInfoCollection"] + """Gets a list of web app configuration snapshots identifiers. Each element of the list contains a timestamp and the ID of the snapshot. - Description for Gets a list of web app configuration snapshots - identifiers. Each element of the list contains a timestamp and the ID - of the snapshot. + Description for Gets a list of web app configuration snapshots identifiers. Each element of the + list contains a timestamp and the ID of the snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteConfigurationSnapshotInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfoPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteConfigurationSnapshotInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteConfigurationSnapshotInfoCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_configuration_snapshot_info_slot.metadata['url'] + url = self.list_configuration_snapshot_info_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteConfigurationSnapshotInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteConfigurationSnapshotInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_configuration_snapshot_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots'} # type: ignore def get_configuration_snapshot_slot( - self, resource_group_name, name, snapshot_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a snapshot of the configuration of an app at a previous point in - time. + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteConfigResource" + """Gets a snapshot of the configuration of an app at a previous point in time. - Description for Gets a snapshot of the configuration of an app at a - previous point in time. + Description for Gets a snapshot of the configuration of an app at a previous point in time. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteConfigResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_configuration_snapshot_slot.metadata['url'] + url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteConfigResource', response) + deserialized = self._deserialize('SiteConfigResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} + get_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}'} # type: ignore def recover_site_configuration_snapshot_slot( - self, resource_group_name, name, snapshot_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + snapshot_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Reverts the configuration of an app to a previous snapshot. - Description for Reverts the configuration of an app to a previous - snapshot. + Description for Reverts the configuration of an app to a previous snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param snapshot_id: The ID of the snapshot to read. :type snapshot_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will return configuration for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will return + configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.recover_site_configuration_snapshot_slot.metadata['url'] + url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} + if cls: + return cls(pipeline_response, None, {}) + + recover_site_configuration_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover'} # type: ignore def get_web_site_container_logs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the last lines of docker logs for the given site. Description for Gets the last lines of docker logs for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_web_site_container_logs_slot.metadata['url'] + url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/octet-stream' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} + get_web_site_container_logs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs'} # type: ignore def get_container_logs_zip_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, callback=None, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] """Gets the ZIP archived docker log files for the given site. - Description for Gets the ZIP archived docker log files for the given - site. + Description for Gets the ZIP archived docker log files for the given site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_container_logs_zip_slot.metadata['url'] + url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/zip' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} + get_container_logs_zip_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download'} # type: ignore def list_continuous_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ContinuousWebJobCollection"] """List continuous web jobs for an app, or a deployment slot. - Description for List continuous web jobs for an app, or a deployment - slot. + Description for List continuous web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContinuousWebJob - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobPaged[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContinuousWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ContinuousWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_continuous_web_jobs_slot.metadata['url'] + url = self.list_continuous_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContinuousWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContinuousWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_continuous_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs'} # type: ignore def get_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ContinuousWebJob"] """Gets a continuous web job by its ID for an app, or a deployment slot. - Description for Gets a continuous web job by its ID for an app, or a - deployment slot. + Description for Gets a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContinuousWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContinuousWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ContinuousWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_continuous_web_job_slot.metadata['url'] + url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ContinuousWebJob', response) + deserialized = self._deserialize('ContinuousWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} + get_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore def delete_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a continuous web job by its ID for an app, or a deployment slot. - Description for Delete a continuous web job by its ID for an app, or a - deployment slot. + Description for Delete a continuous web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_continuous_web_job_slot.metadata['url'] + url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}'} # type: ignore def start_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Start a continuous web job for an app, or a deployment slot. - Description for Start a continuous web job for an app, or a deployment - slot. + Description for Start a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_continuous_web_job_slot.metadata['url'] + url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} + start_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start'} # type: ignore def stop_continuous_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop a continuous web job for an app, or a deployment slot. - Description for Stop a continuous web job for an app, or a deployment - slot. + Description for Stop a continuous web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_continuous_web_job_slot.metadata['url'] + url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} + if cls: + return cls(pipeline_response, None, {}) + + stop_continuous_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop'} # type: ignore def list_deployments_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentCollection"] """List deployments for an app, or a deployment slot. Description for List deployments for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Deployment - :rtype: - ~azure.mgmt.web.v2019_08_01.models.DeploymentPaged[~azure.mgmt.web.v2019_08_01.models.Deployment] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.DeploymentCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_deployments_slot.metadata['url'] + url = self.list_deployments_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list_deployments_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments'} # type: ignore def get_deployment_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Get a deployment by its ID for an app, or a deployment slot. - Description for Get a deployment by its ID for an app, or a deployment - slot. + Description for Get a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets a deployment + for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_deployment_slot.metadata['url'] + url = self.get_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + get_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def create_deployment_slot( - self, resource_group_name, name, id, slot, deployment, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + deployment, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" """Create a deployment for an app, or a deployment slot. Description for Create a deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: ID of an existing deployment. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API creates a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API creates a + deployment for the production slot. :type slot: str :param deployment: Deployment details. :type deployment: ~azure.mgmt.web.v2019_08_01.models.Deployment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_deployment_slot.metadata['url'] + url = self.create_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + create_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def delete_deployment_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a deployment by its ID for an app, or a deployment slot. - Description for Delete a deployment by its ID for an app, or a - deployment slot. + Description for Delete a deployment by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param id: Deployment ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_deployment_slot.metadata['url'] + url = self.delete_deployment_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} + delete_deployment_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}'} # type: ignore def list_deployment_log_slot( - self, resource_group_name, name, id, slot, custom_headers=None, raw=False, **operation_config): - """List deployment log for specific deployment for an app, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Deployment" + """List deployment log for specific deployment for an app, or a deployment slot. - Description for List deployment log for specific deployment for an app, - or a deployment slot. + Description for List deployment log for specific deployment for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param id: The ID of a specific deployment. This is the value of the - name property in the JSON response from "GET - /api/sites/{siteName}/deployments". + :param id: The ID of a specific deployment. This is the value of the name property in the JSON + response from "GET /api/sites/{siteName}/deployments". :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Deployment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_deployment_log_slot.metadata['url'] + url = self.list_deployment_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Deployment', response) + deserialized = self._deserialize('Deployment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} + list_deployment_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log'} # type: ignore def discover_backup_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): - """Discovers an existing app backup that can be restored from a blob in - Azure storage. Use this to get information about the databases stored - in a backup. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.RestoreRequest" + """Discovers an existing app backup that can be restored from a blob in Azure storage. Use this to get information about the databases stored in a backup. - Description for Discovers an existing app backup that can be restored - from a blob in Azure storage. Use this to get information about the - databases stored in a backup. + Description for Discovers an existing app backup that can be restored from a blob in Azure + storage. Use this to get information about the databases stored in a backup. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param request: A RestoreRequest object that includes Azure storage - URL and blog name for discovery of backup. - :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will perform discovery for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will perform + discovery for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RestoreRequest or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param request: A RestoreRequest object that includes Azure storage URL and blog name for + discovery of backup. + :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestoreRequest, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.discover_backup_slot.metadata['url'] + url = self.discover_backup_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RestoreRequest', response) + deserialized = self._deserialize('RestoreRequest', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - discover_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup'} + discover_backup_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup'} # type: ignore def list_domain_ownership_identifiers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """Lists ownership identifiers for domain associated with web app. - Description for Lists ownership identifiers for domain associated with - web app. + Description for Lists ownership identifiers for domain associated with web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2019_08_01.models.IdentifierPaged[~azure.mgmt.web.v2019_08_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_domain_ownership_identifiers_slot.metadata['url'] + url = self.list_domain_ownership_identifiers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} + return ItemPaged( + get_next, extract_data + ) + list_domain_ownership_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers'} # type: ignore def get_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" """Get domain ownership identifier for web app. Description for Get domain ownership identifier for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_domain_ownership_identifier_slot.metadata['url'] + url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + get_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def create_or_update_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, kind=None, value=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. - - Description for Creates a domain ownership identifier for web app, or - updates an existing ownership identifier. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param value: String representation of the identity. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] + url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + create_or_update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def delete_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a domain ownership identifier for a web app. Description for Deletes a domain ownership identifier for a web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_domain_ownership_identifier_slot.metadata['url'] + url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def update_domain_ownership_identifier_slot( - self, resource_group_name, name, domain_ownership_identifier_name, slot, kind=None, value=None, custom_headers=None, raw=False, **operation_config): - """Creates a domain ownership identifier for web app, or updates an - existing ownership identifier. + if cls: + return cls(pipeline_response, None, {}) - Description for Creates a domain ownership identifier for web app, or - updates an existing ownership identifier. + delete_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def update_domain_ownership_identifier_slot( + self, + resource_group_name, # type: str + name, # type: str + domain_ownership_identifier_name, # type: str + slot, # type: str + domain_ownership_identifier, # type: "models.Identifier" + **kwargs # type: Any + ): + # type: (...) -> "models.Identifier" + """Creates a domain ownership identifier for web app, or updates an existing ownership identifier. + + Description for Creates a domain ownership identifier for web app, or updates an existing + ownership identifier. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param domain_ownership_identifier_name: Name of domain ownership - identifier. + :param domain_ownership_identifier_name: Name of domain ownership identifier. :type domain_ownership_identifier_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str - :param kind: Kind of resource. - :type kind: str - :param value: String representation of the identity. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Identifier or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param domain_ownership_identifier: A JSON representation of the domain ownership properties. + :type domain_ownership_identifier: ~azure.mgmt.web.v2019_08_01.models.Identifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Identifier, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.Identifier + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_ownership_identifier = models.Identifier(kind=kind, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_domain_ownership_identifier_slot.metadata['url'] + url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'domainOwnershipIdentifierName': self._serialize.url("domain_ownership_identifier_name", domain_ownership_identifier_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Identifier', response) + deserialized = self._deserialize('Identifier', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} + update_domain_ownership_identifier_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}'} # type: ignore def get_ms_deploy_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Description for Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_ms_deploy_status_slot.metadata['url'] + url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} - + get_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore def _create_ms_deploy_operation_slot_initial( - self, resource_group_name, name, slot, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_ms_deploy_operation_slot.metadata['url'] + url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore - def create_ms_deploy_operation_slot( - self, resource_group_name, name, slot, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_ms_deploy_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Description for Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_ms_deploy_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy'} # type: ignore def get_ms_deploy_log_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Description for Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_ms_deploy_log_slot.metadata['url'] + url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} + get_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log'} # type: ignore def list_instance_functions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.FunctionEnvelopeCollection"] """List the functions for a web site, or a deployment slot. - Description for List the functions for a web site, or a deployment - slot. + Description for List the functions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of FunctionEnvelope - :rtype: - ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelopePaged[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FunctionEnvelopeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelopeCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_functions_slot.metadata['url'] + url = self.list_instance_functions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('FunctionEnvelopeCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.FunctionEnvelopePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} + return ItemPaged( + get_next, extract_data + ) + list_instance_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions'} # type: ignore def get_functions_admin_token_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> str """Fetch a short lived token that can be exchanged for a master key. - Description for Fetch a short lived token that can be exchanged for a - master key. + Description for Fetch a short lived token that can be exchanged for a master key. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_functions_admin_token_slot.metadata['url'] + url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} + get_functions_admin_token_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token'} # type: ignore def get_instance_function_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.FunctionEnvelope"] """Get function information by its ID for web site, or a deployment slot. - Description for Get function information by its ID for web site, or a - deployment slot. + Description for Get function information by its ID for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15576,118 +15842,126 @@ def get_instance_function_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionEnvelope or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionEnvelope, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_function_slot.metadata['url'] + url = self.get_instance_function_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} - + get_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def _create_instance_function_slot_initial( - self, resource_group_name, name, function_name, slot, function_envelope, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionEnvelope" + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_function_slot.metadata['url'] + url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('FunctionEnvelope', response) + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_instance_function_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore - def create_instance_function_slot( - self, resource_group_name, name, function_name, slot, function_envelope, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_instance_function_slot( + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + function_envelope, # type: "models.FunctionEnvelope" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.FunctionEnvelope"] """Create function for web site, or a deployment slot. Description for Create function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15696,59 +15970,73 @@ def create_instance_function_slot( :param slot: Name of the deployment slot. :type slot: str :param function_envelope: Function details. - :type function_envelope: - ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type function_envelope: ~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns FunctionEnvelope or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_instance_function_slot_initial( - resource_group_name=resource_group_name, - name=name, - function_name=function_name, - slot=slot, - function_envelope=function_envelope, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either FunctionEnvelope or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.FunctionEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('FunctionEnvelope', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_function_slot_initial( + resource_group_name=resource_group_name, + name=name, + function_name=function_name, + slot=slot, + function_envelope=function_envelope, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FunctionEnvelope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def delete_instance_function_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function for web site, or a deployment slot. Description for Delete a function for web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15756,60 +16044,64 @@ def delete_instance_function_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_instance_function_slot.metadata['url'] + url = self.delete_instance_function_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} + delete_instance_function_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}'} # type: ignore def create_or_update_function_secret_slot( - self, resource_group_name, name, function_name, key_name, slot, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + slot, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a function secret. Description for Add or update a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15819,81 +16111,80 @@ def create_or_update_function_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_function_secret_slot.metadata['url'] + url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} + create_or_update_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore def delete_function_secret_slot( - self, resource_group_name, name, function_name, key_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + key_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a function secret. Description for Delete a function secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15903,62 +16194,63 @@ def delete_function_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_function_secret_slot.metadata['url'] + url = self.delete_function_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_function_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}'} # type: ignore def list_function_keys_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StringDictionary" """Get function keys for a function in a web site, or a deployment slot. - Description for Get function keys for a function in a web site, or a - deployment slot. + Description for Get function keys for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -15966,70 +16258,66 @@ def list_function_keys_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StringDictionary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StringDictionary, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.StringDictionary + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_function_keys_slot.metadata['url'] + url = self.list_function_keys_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StringDictionary', response) + deserialized = self._deserialize('StringDictionary', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys'} + list_function_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys'} # type: ignore def list_function_secrets_slot( - self, resource_group_name, name, function_name, slot, custom_headers=None, raw=False, **operation_config): - """Get function secrets for a function in a web site, or a deployment - slot. + self, + resource_group_name, # type: str + name, # type: str + function_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" + """Get function secrets for a function in a web site, or a deployment slot. - Description for Get function secrets for a function in a web site, or a - deployment slot. + Description for Get function secrets for a function in a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16037,252 +16325,249 @@ def list_function_secrets_slot( :type function_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_function_secrets_slot.metadata['url'] + url = self.list_function_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'functionName': self._serialize.url("function_name", function_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} + list_function_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets'} # type: ignore def list_host_keys_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostKeys" """Get host secrets for a function app. Description for Get host secrets for a function app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HostKeys or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostKeys, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_host_keys_slot.metadata['url'] + url = self.list_host_keys_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostKeys', response) + deserialized = self._deserialize('HostKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_host_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys'} + list_host_keys_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys'} # type: ignore def list_sync_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """This is to allow calling via powershell and ARM template. - Description for This is to allow calling via powershell and ARM - template. + Description for This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_sync_status_slot.metadata['url'] + url = self.list_sync_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - list_sync_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus'} + list_sync_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus'} # type: ignore def sync_functions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. - Description for Syncs function trigger metadata to the management - database. + Description for Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.sync_functions_slot.metadata['url'] + url = self.sync_functions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync'} + sync_functions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync'} # type: ignore def create_or_update_host_secret_slot( - self, resource_group_name, name, key_type, key_name, slot, name1=None, value=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + slot, # type: str + key, # type: "models.KeyInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.KeyInfo" """Add or update a host level secret. Description for Add or update a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16292,81 +16577,80 @@ def create_or_update_host_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param name1: Key name - :type name1: str - :param value: Key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param key: The key to create or update. + :type key: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.KeyInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - key = models.KeyInfo(name=name1, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update_host_secret_slot.metadata['url'] + url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('KeyInfo', response) + deserialized = self._deserialize('KeyInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} + create_or_update_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore def delete_host_secret_slot( - self, resource_group_name, name, key_type, key_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + key_type, # type: str + key_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a host level secret. Description for Delete a host level secret. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -16376,353 +16660,354 @@ def delete_host_secret_slot( :type key_name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_host_secret_slot.metadata['url'] + url = self.delete_host_secret_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'keyType': self._serialize.url("key_type", key_type, 'str'), 'keyName': self._serialize.url("key_name", key_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_host_secret_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}'} # type: ignore def list_host_name_bindings_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.HostNameBindingCollection"] """Get hostname bindings for an app or a deployment slot. Description for Get hostname bindings for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets hostname bindings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of HostNameBinding - :rtype: - ~azure.mgmt.web.v2019_08_01.models.HostNameBindingPaged[~azure.mgmt.web.v2019_08_01.models.HostNameBinding] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostNameBindingCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.HostNameBindingCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_host_name_bindings_slot.metadata['url'] + url = self.list_host_name_bindings_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('HostNameBindingCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.HostNameBindingPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} + return ItemPaged( + get_next, extract_data + ) + list_host_name_bindings_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings'} # type: ignore def get_host_name_binding_slot( - self, resource_group_name, name, slot, host_name, custom_headers=None, raw=False, **operation_config): - """Get the named hostname binding for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" + """Get the named hostname binding for an app (or deployment slot, if specified). - Description for Get the named hostname binding for an app (or - deployment slot, if specified). + Description for Get the named hostname binding for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API the named binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. :type slot: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_host_name_binding_slot.metadata['url'] + url = self.get_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + get_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def create_or_update_host_name_binding_slot( - self, resource_group_name, name, host_name, host_name_binding, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + host_name, # type: str + slot, # type: str + host_name_binding, # type: "models.HostNameBinding" + **kwargs # type: Any + ): + # type: (...) -> "models.HostNameBinding" """Creates a hostname binding for an app. Description for Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param host_name_binding: Binding details. This is the JSON - representation of a HostNameBinding object. - :type host_name_binding: - ~azure.mgmt.web.v2019_08_01.models.HostNameBinding - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HostNameBinding or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param host_name_binding: Binding details. This is the JSON representation of a HostNameBinding + object. + :type host_name_binding: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostNameBinding, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HostNameBinding + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_host_name_binding_slot.metadata['url'] + url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HostNameBinding', response) + deserialized = self._deserialize('HostNameBinding', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + create_or_update_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def delete_host_name_binding_slot( - self, resource_group_name, name, slot, host_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Description for Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str :param host_name: Hostname in the hostname binding. :type host_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_host_name_binding_slot.metadata['url'] + url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'hostName': self._serialize.url("host_name", host_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} + delete_host_name_binding_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}'} # type: ignore def get_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): - """Retrieves a specific Service Bus Hybrid Connection used by this Web - App. + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" + """Retrieves a specific Service Bus Hybrid Connection used by this Web App. - Description for Retrieves a specific Service Bus Hybrid Connection used - by this Web App. + Description for Retrieves a specific Service Bus Hybrid Connection used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16732,70 +17017,69 @@ def get_hybrid_connection_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_hybrid_connection_slot.metadata['url'] + url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + get_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def create_or_update_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. - Description for Creates a new Hybrid Connection using a Service Bus - relay. + Description for Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16803,78 +17087,78 @@ def create_or_update_hybrid_connection_slot( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.HybridConnection :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_hybrid_connection_slot.metadata['url'] + url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + create_or_update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def delete_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Removes a Hybrid Connection from this site. Description for Removes a Hybrid Connection from this site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16884,62 +17168,65 @@ def delete_hybrid_connection_slot( :type relay_name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_hybrid_connection_slot.metadata['url'] + url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + delete_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def update_hybrid_connection_slot( - self, resource_group_name, name, namespace_name, relay_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + namespace_name, # type: str + relay_name, # type: str + slot, # type: str + connection_envelope, # type: "models.HybridConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Creates a new Hybrid Connection using a Service Bus relay. - Description for Creates a new Hybrid Connection using a Service Bus - relay. + Description for Creates a new Hybrid Connection using a Service Bus relay. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -16947,1311 +17234,1313 @@ def update_hybrid_connection_slot( :type namespace_name: str :param relay_name: The relay name for this hybrid connection. :type relay_name: str - :param connection_envelope: The details of the hybrid connection. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.HybridConnection :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The details of the hybrid connection. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_hybrid_connection_slot.metadata['url'] + url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), 'relayName': self._serialize.url("relay_name", relay_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} + update_hybrid_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'} # type: ignore def list_hybrid_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HybridConnection" """Retrieves all Service Bus Hybrid Connections used by this Web App. - Description for Retrieves all Service Bus Hybrid Connections used by - this Web App. + Description for Retrieves all Service Bus Hybrid Connections used by this Web App. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: HybridConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridConnection, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.HybridConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_hybrid_connections_slot.metadata['url'] + url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HybridConnection', response) + deserialized = self._deserialize('HybridConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} + list_hybrid_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'} # type: ignore def list_relay_service_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets hybrid connections configured for an app (or deployment slot, if + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Gets hybrid connections configured for an app (or deployment slot, if specified). + + Description for Gets hybrid connections configured for an app (or deployment slot, if specified). - Description for Gets hybrid connections configured for an app (or - deployment slot, if specified). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get hybrid connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get hybrid + connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_relay_service_connections_slot.metadata['url'] + url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} + list_relay_service_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection'} # type: ignore def get_relay_service_connection_slot( - self, resource_group_name, name, entity_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" """Gets a hybrid connection configuration by its name. Description for Gets a hybrid connection configuration by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection. :type entity_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a hybrid connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a hybrid + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_relay_service_connection_slot.metadata['url'] + url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + get_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def create_or_update_relay_service_connection_slot( - self, resource_group_name, name, entity_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). - - Description for Creates a new hybrid connection configuration (PUT), or - updates an existing one (PATCH). + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create or update a hybrid connection for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_relay_service_connection_slot.metadata['url'] + url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + create_or_update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def delete_relay_service_connection_slot( - self, resource_group_name, name, entity_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a relay service connection by its name. Description for Deletes a relay service connection by its name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete a hybrid connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete a + hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_relay_service_connection_slot.metadata['url'] + url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + if cls: + return cls(pipeline_response, None, {}) - def update_relay_service_connection_slot( - self, resource_group_name, name, entity_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Creates a new hybrid connection configuration (PUT), or updates an - existing one (PATCH). + delete_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore - Description for Creates a new hybrid connection configuration (PUT), or - updates an existing one (PATCH). + def update_relay_service_connection_slot( + self, + resource_group_name, # type: str + name, # type: str + entity_name, # type: str + slot, # type: str + connection_envelope, # type: "models.RelayServiceConnectionEntity" + **kwargs # type: Any + ): + # type: (...) -> "models.RelayServiceConnectionEntity" + """Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + + Description for Creates a new hybrid connection configuration (PUT), or updates an existing one + (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param entity_name: Name of the hybrid connection configuration. :type entity_name: str - :param connection_envelope: Details of the hybrid connection - configuration. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create or update a hybrid connection for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create or + update a hybrid connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RelayServiceConnectionEntity or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Details of the hybrid connection configuration. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RelayServiceConnectionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.RelayServiceConnectionEntity + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_relay_service_connection_slot.metadata['url'] + url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'entityName': self._serialize.url("entity_name", entity_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RelayServiceConnectionEntity', response) + deserialized = self._deserialize('RelayServiceConnectionEntity', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} + update_relay_service_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}'} # type: ignore def list_instance_identifiers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebAppInstanceCollection"] """Gets all scale-out instances of an app. Description for Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets the production slot instances. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteInstance - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteInstancePaged[~azure.mgmt.web.v2019_08_01.models.SiteInstance] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebAppInstanceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebAppInstanceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_identifiers_slot.metadata['url'] + url = self.list_instance_identifiers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebAppInstanceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} + return ItemPaged( + get_next, extract_data + ) + list_instance_identifiers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances'} # type: ignore def get_instance_info_slot( - self, resource_group_name, name, instance_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + instance_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebSiteInstanceStatus" """Gets all scale-out instances of an app. Description for Gets all scale-out instances of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param instance_id: :type instance_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets the production slot instances. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets the + production slot instances. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebSiteInstanceStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WebSiteInstanceStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebSiteInstanceStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebSiteInstanceStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_info_slot.metadata['url'] + url = self.get_instance_info_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WebSiteInstanceStatus', response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + deserialized = self._deserialize('WebSiteInstanceStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}'} + get_instance_info_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}'} # type: ignore def get_instance_ms_deploy_status_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MSDeployStatus" """Get the status of the last MSDeploy operation. Description for Get the status of the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_ms_deploy_status_slot.metadata['url'] + url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} - + get_instance_ms_deploy_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def _create_instance_ms_deploy_operation_slot_initial( - self, resource_group_name, name, slot, instance_id, ms_deploy, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_instance_ms_deploy_operation_slot.metadata['url'] + url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201, 409]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('MSDeployStatus', response) + deserialized = self._deserialize('MSDeployStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_instance_ms_deploy_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore - def create_instance_ms_deploy_operation_slot( - self, resource_group_name, name, slot, instance_id, ms_deploy, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_instance_ms_deploy_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + ms_deploy, # type: "models.MSDeploy" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.MSDeployStatus"] """Invoke the MSDeploy web app extension. Description for Invoke the MSDeploy web app extension. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param ms_deploy: Details of MSDeploy operation + :param ms_deploy: Details of MSDeploy operation. :type ms_deploy: ~azure.mgmt.web.v2019_08_01.models.MSDeploy - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns MSDeployStatus or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_instance_ms_deploy_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - instance_id=instance_id, - ms_deploy=ms_deploy, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MSDeployStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.MSDeployStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MSDeployStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_instance_ms_deploy_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + instance_id=instance_id, + ms_deploy=ms_deploy, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MSDeployStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_instance_ms_deploy_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy'} # type: ignore def get_instance_ms_deploy_log_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.MSDeployLog"] """Get the MSDeploy Log for the last MSDeploy operation. Description for Get the MSDeploy Log for the last MSDeploy operation. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str :param instance_id: ID of web app instance. :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MSDeployLog or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSDeployLog, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MSDeployLog or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_ms_deploy_log_slot.metadata['url'] + url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MSDeployLog', response) + deserialized = self._deserialize('MSDeployLog', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} + get_instance_ms_deploy_log_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log'} # type: ignore def list_instance_processes_slot( - self, resource_group_name, name, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Description for Get list of processes for a web site, or a deployment - slot, or for a specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_processes_slot.metadata['url'] + url = self.list_instance_processes_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} + return ItemPaged( + get_next, extract_data + ) + list_instance_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes'} # type: ignore def get_instance_process_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_process_slot.metadata['url'] + url = self.get_instance_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} + get_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore def delete_instance_process_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Description for Terminate a process by its ID for a web site, or a - deployment slot, or specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_instance_process_slot.metadata['url'] + url = self.delete_instance_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} + if cls: + return cls(pipeline_response, None, {}) - def get_instance_process_dump_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + delete_instance_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}'} # type: ignore - Description for Get a memory dump of a process by its ID for a specific - scaled-out instance in a web site. + def get_instance_process_dump_slot( + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_process_dump_slot.metadata['url'] + url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} + get_instance_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump'} # type: ignore def list_instance_process_modules_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. - - Description for List module information for a process by its ID for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_modules_slot.metadata['url'] + url = self.list_instance_process_modules_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules'} # type: ignore def get_instance_process_module_slot( - self, resource_group_name, name, process_id, base_address, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -18259,26 +18548,24 @@ def get_instance_process_module_slot( :type process_id: str :param base_address: Module base address. :type base_address: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_instance_process_module_slot.metadata['url'] + url = self.get_instance_process_module_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), @@ -18286,860 +18573,835 @@ def get_instance_process_module_slot( 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} + get_instance_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_instance_process_threads_slot( - self, resource_group_name, name, process_id, slot, instance_id, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. - - Description for List the threads in a process by its ID for a specific - scaled-out instance in a web site. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. + + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param instance_id: ID of a specific scaled-out instance. This is the - value of the name property in the JSON response from "GET - api/sites/{siteName}/instances". + :param instance_id: ID of a specific scaled-out instance. This is the value of the name + property in the JSON response from "GET api/sites/{siteName}/instances". :type instance_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_instance_process_threads_slot.metadata['url'] + url = self.list_instance_process_threads_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_instance_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads'} # type: ignore def is_cloneable_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Shows whether an app can be cloned to another resource group or - subscription. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteCloneability" + """Shows whether an app can be cloned to another resource group or subscription. - Description for Shows whether an app can be cloned to another resource - group or subscription. + Description for Shows whether an app can be cloned to another resource group or subscription. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. By default, this API returns - information on the production slot. + :param slot: Name of the deployment slot. By default, this API returns information on the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteCloneability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteCloneability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteCloneability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteCloneability + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.is_cloneable_slot.metadata['url'] + url = self.is_cloneable_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteCloneability', response) + deserialized = self._deserialize('SiteCloneability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} + is_cloneable_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable'} # type: ignore def list_site_backups_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BackupItemCollection"] """Gets existing backups of an app. Description for Gets existing backups of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get backups of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get backups + of the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BackupItem - :rtype: - ~azure.mgmt.web.v2019_08_01.models.BackupItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItem] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackupItemCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BackupItemCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_backups_slot.metadata['url'] + url = self.list_site_backups_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.post(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BackupItemCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BackupItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_site_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listbackups'} + return ItemPaged( + get_next, extract_data + ) + list_site_backups_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listbackups'} # type: ignore def list_sync_function_triggers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.FunctionSecrets" """This is to allow calling via powershell and ARM template. - Description for This is to allow calling via powershell and ARM - template. + Description for This is to allow calling via powershell and ARM template. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: FunctionSecrets or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FunctionSecrets, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.FunctionSecrets + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_sync_function_triggers_slot.metadata['url'] + url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('FunctionSecrets', response) + deserialized = self._deserialize('FunctionSecrets', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} + list_sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus'} # type: ignore def get_migrate_my_sql_status_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Returns the status of MySql in app migration, if one is active, and - whether or not MySql in app is enabled. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MigrateMySqlStatus" + """Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - Description for Returns the status of MySql in app migration, if one is - active, and whether or not MySql in app is enabled. + Description for Returns the status of MySql in app migration, if one is active, and whether or + not MySql in app is enabled. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MigrateMySqlStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrateMySqlStatus, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.MigrateMySqlStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_migrate_my_sql_status_slot.metadata['url'] + url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MigrateMySqlStatus', response) + deserialized = self._deserialize('MigrateMySqlStatus', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} + get_migrate_my_sql_status_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status'} # type: ignore def get_swift_virtual_network_connection_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" """Gets a Swift Virtual Network connection. Description for Gets a Swift Virtual Network connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a gateway for the production slot's Virtual Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_swift_virtual_network_connection_slot.metadata['url'] + url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + get_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def create_or_update_swift_virtual_network_connection_slot( - self, resource_group_name, name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Description for Integrates this Web App with a Virtual Network. This - requires that 1) "swiftSupported" is true when doing a GET against this - resource, and 2) that the target Subnet has already been delegated, and - is not + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] + url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + create_or_update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def delete_swift_virtual_network_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Deletes a Swift Virtual Network connection from an app (or deployment - slot). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Swift Virtual Network connection from an app (or deployment slot). - Description for Deletes a Swift Virtual Network connection from an app - (or deployment slot). + Description for Deletes a Swift Virtual Network connection from an app (or deployment slot). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_swift_virtual_network_slot.metadata['url'] + url = self.delete_swift_virtual_network_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_swift_virtual_network_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + delete_swift_virtual_network_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def update_swift_virtual_network_connection_slot( - self, resource_group_name, name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Integrates this Web App with a Virtual Network. This requires that 1) - "swiftSupported" is true when doing a GET against this resource, and 2) - that the target Subnet has already been delegated, and is not + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + connection_envelope, # type: "models.SwiftVirtualNetwork" + **kwargs # type: Any + ): + # type: (...) -> "models.SwiftVirtualNetwork" + """Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - Description for Integrates this Web App with a Virtual Network. This - requires that 1) "swiftSupported" is true when doing a GET against this - resource, and 2) that the target Subnet has already been delegated, and - is not + Description for Integrates this Web App with a Virtual Network. This requires that 1) + "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet + has already been delegated, and is not in use by another App Service Plan other than the one this App is in. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SwiftVirtualNetwork or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwiftVirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SwiftVirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_swift_virtual_network_connection_slot.metadata['url'] + url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SwiftVirtualNetwork', response) + deserialized = self._deserialize('SwiftVirtualNetwork', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} + update_swift_virtual_network_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork'} # type: ignore def list_network_features_slot( - self, resource_group_name, name, view, slot, custom_headers=None, raw=False, **operation_config): - """Gets all network features used by the app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + view, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.NetworkFeatures"] + """Gets all network features used by the app (or deployment slot, if specified). - Description for Gets all network features used by the app (or - deployment slot, if specified). + Description for Gets all network features used by the app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param view: The type of view. This can either be "summary" or - "detailed". + :param view: The type of view. This can either be "summary" or "detailed". :type view: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get network features for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get network + features for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NetworkFeatures or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.NetworkFeatures or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFeatures, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.NetworkFeatures or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_network_features_slot.metadata['url'] + url = self.list_network_features_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'view': self._serialize.url("view", view, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkFeatures', response) + deserialized = self._deserialize('NetworkFeatures', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} + list_network_features_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}'} # type: ignore def get_network_trace_operation_slot( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). - - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_trace_operation_slot.metadata['url'] + url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}'} + get_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}'} # type: ignore def start_web_site_network_trace_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str """Start capturing network packets for the site (To be deprecated). - Description for Start capturing network packets for the site (To be - deprecated). + Description for Start capturing network packets for the site (To be deprecated). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -19151,125 +19413,134 @@ def start_web_site_network_trace_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_web_site_network_trace_slot.metadata['url'] + url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} - + start_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start'} # type: ignore def _start_web_site_network_trace_operation_slot_initial( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_web_site_network_trace_operation_slot.metadata['url'] + url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_web_site_network_trace_operation_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore - def start_web_site_network_trace_operation_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_web_site_network_trace_operation_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Description for Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -19281,1765 +19552,1791 @@ def start_web_site_network_trace_operation_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_web_site_network_trace_operation_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_web_site_network_trace_operation_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_web_site_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_web_site_network_trace_operation_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation'} # type: ignore def stop_web_site_network_trace_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Description for Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for this web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_web_site_network_trace_slot.metadata['url'] + url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} + if cls: + return cls(pipeline_response, None, {}) - def get_network_traces_slot( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). + stop_web_site_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop'} # type: ignore - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + def get_network_traces_slot( + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_traces_slot.metadata['url'] + url = self.get_network_traces_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}'} + get_network_traces_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}'} # type: ignore def get_network_trace_operation_slot_v2( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). - - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_trace_operation_slot_v2.metadata['url'] + url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_trace_operation_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}'} + get_network_trace_operation_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}'} # type: ignore def get_network_traces_slot_v2( - self, resource_group_name, name, operation_id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a named operation for a network trace capturing (or deployment - slot, if specified). - - Description for Gets a named operation for a network trace capturing - (or deployment slot, if specified). + self, + resource_group_name, # type: str + name, # type: str + operation_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + """Gets a named operation for a network trace capturing (or deployment slot, if specified). + + Description for Gets a named operation for a network trace capturing (or deployment slot, if + specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param operation_id: GUID of the operation. :type operation_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get an operation for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get an + operation for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of NetworkTrace, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_network_traces_slot_v2.metadata['url'] + url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_network_traces_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}'} + get_network_traces_slot_v2.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}'} # type: ignore def generate_new_site_publishing_password_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Generates a new publishing password for an app (or deployment slot, if + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Generates a new publishing password for an app (or deployment slot, if specified). + + Description for Generates a new publishing password for an app (or deployment slot, if specified). - Description for Generates a new publishing password for an app (or - deployment slot, if specified). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API generate a new publishing password for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API generate a new + publishing password for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.generate_new_site_publishing_password_slot.metadata['url'] + url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} + if cls: + return cls(pipeline_response, None, {}) + + generate_new_site_publishing_password_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword'} # type: ignore def list_perf_mon_counters_slot( - self, resource_group_name, name, slot, filter=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PerfMonCounterCollection"] """Gets perfmon counters for web app. Description for Gets perfmon counters for web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param filter: Return only usages/metrics specified in the filter. - Filter conforms to odata syntax. Example: $filter=(startTime eq - 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain - eq duration'[Hour|Minute|Day]'. + :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata + syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z + and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PerfMonResponse - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PerfMonResponsePaged[~azure.mgmt.web.v2019_08_01.models.PerfMonResponse] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PerfMonCounterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PerfMonCounterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_perf_mon_counters_slot.metadata['url'] + url = self.list_perf_mon_counters_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PerfMonCounterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PerfMonResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} + return ItemPaged( + get_next, extract_data + ) + list_perf_mon_counters_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters'} # type: ignore def get_site_php_error_log_flag_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SitePhpErrorLogFlag" """Gets web app's event logs. Description for Gets web app's event logs. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SitePhpErrorLogFlag or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SitePhpErrorLogFlag or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SitePhpErrorLogFlag, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SitePhpErrorLogFlag + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_php_error_log_flag_slot.metadata['url'] + url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SitePhpErrorLogFlag', response) + deserialized = self._deserialize('SitePhpErrorLogFlag', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} + get_site_php_error_log_flag_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging'} # type: ignore def list_premier_add_ons_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets the premier add-ons of an app. Description for Gets the premier add-ons of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the premier add-ons for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + premier add-ons for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_premier_add_ons_slot.metadata['url'] + url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} + list_premier_add_ons_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons'} # type: ignore def get_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Gets a named add-on of an app. Description for Gets a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_premier_add_on_slot.metadata['url'] + url = self.get_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + get_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def add_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, premier_add_on, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + premier_add_on, # type: "models.PremierAddOn" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Description for Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.add_premier_add_on_slot.metadata['url'] + url = self.add_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + add_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def delete_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a premier add-on from an app. Description for Delete a premier add-on from an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_premier_add_on_slot.metadata['url'] + url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def update_premier_add_on_slot( - self, resource_group_name, name, premier_add_on_name, premier_add_on, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + premier_add_on_name, # type: str + slot, # type: str + premier_add_on, # type: "models.PremierAddOnPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.PremierAddOn" """Updates a named add-on of an app. Description for Updates a named add-on of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param premier_add_on_name: Add-on name. :type premier_add_on_name: str - :param premier_add_on: A JSON representation of the edited premier - add-on. - :type premier_add_on: - ~azure.mgmt.web.v2019_08_01.models.PremierAddOnPatchResource - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the named add-on for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + named add-on for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PremierAddOn or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param premier_add_on: A JSON representation of the edited premier add-on. + :type premier_add_on: ~azure.mgmt.web.v2019_08_01.models.PremierAddOnPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PremierAddOn, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PremierAddOn + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_premier_add_on_slot.metadata['url'] + url = self.update_premier_add_on_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'premierAddOnName': self._serialize.url("premier_add_on_name", premier_add_on_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PremierAddOn', response) + deserialized = self._deserialize('PremierAddOn', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} + update_premier_add_on_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}'} # type: ignore def get_private_access_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Gets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Gets data around private site access enablement and authorized Virtual Networks that can access the site. - Description for Gets data around private site access enablement and - authorized Virtual Networks that can access the site. + Description for Gets data around private site access enablement and authorized Virtual Networks + that can access the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_private_access_slot.metadata['url'] + url = self.get_private_access_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_private_access_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} + get_private_access_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore def put_private_access_vnet_slot( - self, resource_group_name, name, access, slot, custom_headers=None, raw=False, **operation_config): - """Sets data around private site access enablement and authorized Virtual - Networks that can access the site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + access, # type: "models.PrivateAccess" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateAccess" + """Sets data around private site access enablement and authorized Virtual Networks that can access the site. - Description for Sets data around private site access enablement and - authorized Virtual Networks that can access the site. + Description for Sets data around private site access enablement and authorized Virtual Networks + that can access the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param access: The information for the private access - :type access: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess :param slot: The name of the slot for the web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateAccess or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param access: The information for the private access. + :type access: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateAccess, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateAccess + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.put_private_access_vnet_slot.metadata['url'] + url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateAccess', response) + deserialized = self._deserialize('PrivateAccess', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - put_private_access_vnet_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} + put_private_access_vnet_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks'} # type: ignore def get_private_endpoint_connection( - self, resource_group_name, name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnectionResource" """Gets a private endpoint connection. Description for Gets a private endpoint connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the site. :type name: str :param private_endpoint_connection_name: :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnectionResource or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionResource, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_private_endpoint_connection.metadata['url'] + url = self.get_private_endpoint_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnectionResource', response) + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} - + get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _approve_or_reject_private_endpoint_connection_initial( - self, resource_group_name, name, private_endpoint_connection_name, kind=None, private_link_service_connection_state=None, custom_headers=None, raw=False, **operation_config): - private_endpoint_wrapper = models.PrivateLinkConnectionApprovalRequestResource(kind=kind, private_link_service_connection_state=private_link_service_connection_state) + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_wrapper, # type: "models.PrivateLinkConnectionApprovalRequestResource" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnectionResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.approve_or_reject_private_endpoint_connection.metadata['url'] + url = self._approve_or_reject_private_endpoint_connection_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(private_endpoint_wrapper, 'PrivateLinkConnectionApprovalRequestResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnectionResource', response) + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('PrivateEndpointConnectionResource', response) + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _approve_or_reject_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def approve_or_reject_private_endpoint_connection( - self, resource_group_name, name, private_endpoint_connection_name, kind=None, private_link_service_connection_state=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_approve_or_reject_private_endpoint_connection( + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_wrapper, # type: "models.PrivateLinkConnectionApprovalRequestResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.PrivateEndpointConnectionResource"] """Approves or rejects a private endpoint connection. Description for Approves or rejects a private endpoint connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the site. :type name: str :param private_endpoint_connection_name: :type private_endpoint_connection_name: str - :param kind: Kind of resource. - :type kind: str - :param private_link_service_connection_state: - :type private_link_service_connection_state: - ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionState - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param private_endpoint_wrapper: + :type private_endpoint_wrapper: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkConnectionApprovalRequestResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - PrivateEndpointConnectionResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._approve_or_reject_private_endpoint_connection_initial( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - kind=kind, - private_link_service_connection_state=private_link_service_connection_state, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnectionResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('PrivateEndpointConnectionResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._approve_or_reject_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_wrapper=private_endpoint_wrapper, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - approve_or_reject_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_approve_or_reject_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_private_endpoint_connection_initial( - self, resource_group_name, name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> object + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_private_endpoint_connection.metadata['url'] + url = self._delete_private_endpoint_connection_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) + if response.status_code == 204: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def delete_private_endpoint_connection( - self, resource_group_name, name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_delete_private_endpoint_connection( + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Deletes a private endpoint connection. Description for Deletes a private endpoint connection. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the site. :type name: str :param private_endpoint_connection_name: :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._delete_private_endpoint_connection_initial( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def get_private_link_resources( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateLinkResourcesWrapper" """Gets the private link resources. Description for Gets the private link resources. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the site. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateLinkResourcesWrapper or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesWrapper, or the result of cls(response) :rtype: ~azure.mgmt.web.v2019_08_01.models.PrivateLinkResourcesWrapper - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesWrapper"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_private_link_resources.metadata['url'] + url = self.get_private_link_resources.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateLinkResourcesWrapper', response) + deserialized = self._deserialize('PrivateLinkResourcesWrapper', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateLinkResources'} + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateLinkResources'} # type: ignore def list_processes_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Get list of processes for a web site, or a deployment slot, or for a - specific scaled-out instance in a web site. - - Description for Get list of processes for a web site, or a deployment - slot, or for a specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessInfoCollection"] + """Get list of processes for a web site, or a deployment slot, or for a specific scaled-out instance in a web site. + + Description for Get list of processes for a web site, or a deployment slot, or for a specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_processes_slot.metadata['url'] + url = self.list_processes_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized - list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} + return pipeline_response - def get_process_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. + return ItemPaged( + get_next, extract_data + ) + list_processes_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes'} # type: ignore - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + def get_process_slot( + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_process_slot.metadata['url'] + url = self.get_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessInfo', response) + deserialized = self._deserialize('ProcessInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} + get_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore def delete_process_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """Terminate a process by its ID for a web site, or a deployment slot, or - specific scaled-out instance in a web site. - - Description for Terminate a process by its ID for a web site, or a - deployment slot, or specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Terminate a process by its ID for a web site, or a deployment slot, or specific scaled-out instance in a web site. + + Description for Terminate a process by its ID for a web site, or a deployment slot, or specific + scaled-out instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_process_slot.metadata['url'] + url = self.delete_process_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} + if cls: + return cls(pipeline_response, None, {}) - def get_process_dump_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, callback=None, **operation_config): - """Get a memory dump of a process by its ID for a specific scaled-out - instance in a web site. + delete_process_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}'} # type: ignore - Description for Get a memory dump of a process by its ID for a specific - scaled-out instance in a web site. + def get_process_dump_slot( + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[IO] + """Get a memory dump of a process by its ID for a specific scaled-out instance in a web site. + + Description for Get a memory dump of a process by its ID for a specific scaled-out instance in + a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_process_dump_slot.metadata['url'] + url = self.get_process_dump_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = None + if response.status_code == 200: + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} + get_process_dump_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump'} # type: ignore def list_process_modules_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """List module information for a process by its ID for a specific - scaled-out instance in a web site. - - Description for List module information for a process by its ID for a - specific scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessModuleInfoCollection"] + """List module information for a process by its ID for a specific scaled-out instance in a web site. + + Description for List module information for a process by its ID for a specific scaled-out + instance in a web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessModuleInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessModuleInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_modules_slot.metadata['url'] + url = self.list_process_modules_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessModuleInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessModuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} + return ItemPaged( + get_next, extract_data + ) + list_process_modules_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules'} # type: ignore def get_process_module_slot( - self, resource_group_name, name, process_id, base_address, slot, custom_headers=None, raw=False, **operation_config): - """Get process information by its ID for a specific scaled-out instance in - a web site. - - Description for Get process information by its ID for a specific - scaled-out instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + base_address, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ProcessModuleInfo"] + """Get process information by its ID for a specific scaled-out instance in a web site. + + Description for Get process information by its ID for a specific scaled-out instance in a web + site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -21047,2154 +21344,2321 @@ def get_process_module_slot( :type process_id: str :param base_address: Module base address. :type base_address: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProcessModuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProcessModuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ProcessModuleInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_process_module_slot.metadata['url'] + url = self.get_process_module_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'baseAddress': self._serialize.url("base_address", base_address, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProcessModuleInfo', response) + deserialized = self._deserialize('ProcessModuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} + get_process_module_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}'} # type: ignore def list_process_threads_slot( - self, resource_group_name, name, process_id, slot, custom_headers=None, raw=False, **operation_config): - """List the threads in a process by its ID for a specific scaled-out - instance in a web site. + self, + resource_group_name, # type: str + name, # type: str + process_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProcessThreadInfoCollection"] + """List the threads in a process by its ID for a specific scaled-out instance in a web site. - Description for List the threads in a process by its ID for a specific - scaled-out instance in a web site. + Description for List the threads in a process by its ID for a specific scaled-out instance in a + web site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param process_id: PID. :type process_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProcessThreadInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProcessThreadInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.ProcessThreadInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_process_threads_slot.metadata['url'] + url = self.list_process_threads_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'processId': self._serialize.url("process_id", process_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ProcessThreadInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProcessThreadInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} + return ItemPaged( + get_next, extract_data + ) + list_process_threads_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads'} # type: ignore def list_public_certificates_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PublicCertificateCollection"] """Get public certificates for an app or a deployment slot. - Description for Get public certificates for an app or a deployment - slot. + Description for Get public certificates for an app or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API gets hostname bindings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API gets hostname + bindings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PublicCertificate - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PublicCertificatePaged[~azure.mgmt.web.v2019_08_01.models.PublicCertificate] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicCertificateCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PublicCertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_public_certificates_slot.metadata['url'] + url = self.list_public_certificates_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PublicCertificateCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PublicCertificatePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} + return ItemPaged( + get_next, extract_data + ) + list_public_certificates_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates'} # type: ignore def get_public_certificate_slot( - self, resource_group_name, name, slot, public_certificate_name, custom_headers=None, raw=False, **operation_config): - """Get the named public certificate for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" + """Get the named public certificate for an app (or deployment slot, if specified). - Description for Get the named public certificate for an app (or - deployment slot, if specified). + Description for Get the named public certificate for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API the named binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API the named binding + for the production slot. :type slot: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_public_certificate_slot.metadata['url'] + url = self.get_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + get_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def create_or_update_public_certificate_slot( - self, resource_group_name, name, public_certificate_name, public_certificate, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + public_certificate_name, # type: str + slot, # type: str + public_certificate, # type: "models.PublicCertificate" + **kwargs # type: Any + ): + # type: (...) -> "models.PublicCertificate" """Creates a hostname binding for an app. Description for Creates a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param public_certificate: Public certificate details. This is the - JSON representation of a PublicCertificate object. - :type public_certificate: - ~azure.mgmt.web.v2019_08_01.models.PublicCertificate - :param slot: Name of the deployment slot. If a slot is not specified, - the API will create a binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will create a + binding for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PublicCertificate or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param public_certificate: Public certificate details. This is the JSON representation of a + PublicCertificate object. + :type public_certificate: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicCertificate, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.PublicCertificate + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_public_certificate_slot.metadata['url'] + url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PublicCertificate', response) + deserialized = self._deserialize('PublicCertificate', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + create_or_update_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def delete_public_certificate_slot( - self, resource_group_name, name, slot, public_certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + public_certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a hostname binding for an app. Description for Deletes a hostname binding for an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the binding for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + binding for the production slot. :type slot: str :param public_certificate_name: Public certificate name. :type public_certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_public_certificate_slot.metadata['url'] + url = self.delete_public_certificate_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), 'publicCertificateName': self._serialize.url("public_certificate_name", public_certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} + delete_public_certificate_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}'} # type: ignore def list_publishing_profile_xml_with_secrets_slot( - self, resource_group_name, name, slot, format=None, include_disaster_recovery_endpoints=None, custom_headers=None, raw=False, callback=None, **operation_config): - """Gets the publishing profile for an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + publishing_profile_options, # type: "models.CsmPublishingProfileOptions" + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets the publishing profile for an app (or deployment slot, if specified). - Description for Gets the publishing profile for an app (or deployment - slot, if specified). + Description for Gets the publishing profile for an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the publishing profile for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + publishing profile for the production slot. :type slot: str - :param format: Name of the format. Valid values are: - FileZilla3 - WebDeploy -- default - Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp' - :type format: str or - ~azure.mgmt.web.v2019_08_01.models.PublishingProfileFormat - :param include_disaster_recovery_endpoints: Include the - DisasterRecover endpoint if true - :type include_disaster_recovery_endpoints: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` - """ - publishing_profile_options = models.CsmPublishingProfileOptions(format=format, include_disaster_recovery_endpoints=include_disaster_recovery_endpoints) - - # Construct URL - url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] + :param publishing_profile_options: Specifies publishingProfileOptions for publishing profile. + For example, use {"format": "FileZilla3"} to get a FileZilla publishing profile. + :type publishing_profile_options: ~azure.mgmt.web.v2019_08_01.models.CsmPublishingProfileOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/xml' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._client.stream_download(response, callback) + deserialized = response.stream_download(self._client._pipeline) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} + list_publishing_profile_xml_with_secrets_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml'} # type: ignore def reset_slot_configuration_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): - """Resets the configuration settings of the current slot if they were - previously modified by calling the API with POST. + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Resets the configuration settings of the current slot if they were previously modified by calling the API with POST. - Description for Resets the configuration settings of the current slot - if they were previously modified by calling the API with POST. + Description for Resets the configuration settings of the current slot if they were previously + modified by calling the API with POST. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API resets configuration settings for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API resets + configuration settings for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.reset_slot_configuration_slot.metadata['url'] + url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} + if cls: + return cls(pipeline_response, None, {}) + + reset_slot_configuration_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig'} # type: ignore def restart_slot( - self, resource_group_name, name, slot, soft_restart=None, synchronous=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + soft_restart=None, # type: Optional[bool] + synchronous=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None """Restarts an app (or deployment slot, if specified). Description for Restarts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restart the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will restart the + production slot. :type slot: str - :param soft_restart: Specify true to apply the configuration settings - and restarts the app only if necessary. By default, the API always - restarts and reprovisions the app. + :param soft_restart: Specify true to apply the configuration settings and restarts the app only + if necessary. By default, the API always restarts and reprovisions the app. :type soft_restart: bool - :param synchronous: Specify true to block until the app is restarted. - By default, it is set to false, and the API responds immediately - (asynchronous). + :param synchronous: Specify true to block until the app is restarted. By default, it is set to + false, and the API responds immediately (asynchronous). :type synchronous: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.restart_slot.metadata['url'] + url = self.restart_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if soft_restart is not None: query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool') if synchronous is not None: query_parameters['synchronous'] = self._serialize.query("synchronous", synchronous, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} + if cls: + return cls(pipeline_response, None, {}) + restart_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart'} # type: ignore def _restore_from_backup_blob_slot_initial( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_backup_blob_slot.metadata['url'] + url = self._restore_from_backup_blob_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_backup_blob_slot( - self, resource_group_name, name, request, slot, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_backup_blob_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore + + def begin_restore_from_backup_blob_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + request, # type: "models.RestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores an app from a backup blob in Azure Storage. Description for Restores an app from a backup blob in Azure Storage. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str + :param slot: Name of the deployment slot. If a slot is not specified, the API will restore a + backup of the production slot. + :type slot: str :param request: Information on restore request . :type request: ~azure.mgmt.web.v2019_08_01.models.RestoreRequest - :param slot: Name of the deployment slot. If a slot is not specified, - the API will restore a backup of the production slot. - :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_from_backup_blob_slot_initial( - resource_group_name=resource_group_name, - name=name, - request=request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_backup_blob_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_backup_blob_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_backup_blob_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob'} # type: ignore def _restore_from_deleted_app_slot_initial( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_from_deleted_app_slot.metadata['url'] + url = self._restore_from_deleted_app_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_from_deleted_app_slot( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_from_deleted_app_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore + + def begin_restore_from_deleted_app_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.DeletedAppRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a deleted web app to this web app. Description for Restores a deleted web app to this web app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param restore_request: Deleted web app restore information. - :type restore_request: - ~azure.mgmt.web.v2019_08_01.models.DeletedAppRestoreRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param restore_request: Deleted web app restore information. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.DeletedAppRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_from_deleted_app_slot_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_from_deleted_app_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_from_deleted_app_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} - + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_from_deleted_app_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp'} # type: ignore def _restore_snapshot_slot_initial( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.restore_snapshot_slot.metadata['url'] + url = self._restore_snapshot_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restore_snapshot_slot( - self, resource_group_name, name, restore_request, slot, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restore_snapshot_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore + + def begin_restore_snapshot_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + restore_request, # type: "models.SnapshotRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restores a web app from a snapshot. Description for Restores a web app from a snapshot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param restore_request: Snapshot restore settings. Snapshot - information can be obtained by calling GetDeletedSites or - GetSiteSnapshots API. - :type restore_request: - ~azure.mgmt.web.v2019_08_01.models.SnapshotRestoreRequest - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param restore_request: Snapshot restore settings. Snapshot information can be obtained by + calling GetDeletedSites or GetSiteSnapshots API. + :type restore_request: ~azure.mgmt.web.v2019_08_01.models.SnapshotRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._restore_snapshot_slot_initial( - resource_group_name=resource_group_name, - name=name, - restore_request=restore_request, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restore_snapshot_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + restore_request=restore_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restore_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_snapshot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot'} # type: ignore def list_site_extensions_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SiteExtensionInfoCollection"] """Get list of siteextensions for a web site, or a deployment slot. - Description for Get list of siteextensions for a web site, or a - deployment slot. + Description for Get list of siteextensions for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SiteExtensionInfo - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfoPaged[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteExtensionInfoCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfoCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_extensions_slot.metadata['url'] + url = self.list_site_extensions_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfoCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SiteExtensionInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} + return ItemPaged( + get_next, extract_data + ) + list_site_extensions_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions'} # type: ignore def get_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): - """Get site extension information by its ID for a web site, or a - deployment slot. + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + """Get site extension information by its ID for a web site, or a deployment slot. - Description for Get site extension information by its ID for a web - site, or a deployment slot. + Description for Get site extension information by its ID for a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteExtensionInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteExtensionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_site_extension_slot.metadata['url'] + url = self.get_site_extension_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} - + get_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def _install_site_extension_slot_initial( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SiteExtensionInfo"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.install_site_extension_slot.metadata['url'] + url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteExtensionInfo', response) + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _install_site_extension_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore - def install_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_install_site_extension_slot( + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteExtensionInfo"] """Install site extension on a web site, or a deployment slot. - Description for Install site extension on a web site, or a deployment - slot. + Description for Install site extension on a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteExtensionInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._install_site_extension_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_extension_id=site_extension_id, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteExtensionInfo or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.SiteExtensionInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteExtensionInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_site_extension_slot_initial( + resource_group_name=resource_group_name, + name=name, + site_extension_id=site_extension_id, + slot=slot, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteExtensionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore def delete_site_extension_slot( - self, resource_group_name, name, site_extension_id, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_extension_id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Remove a site extension from a web site, or a deployment slot. - Description for Remove a site extension from a web site, or a - deployment slot. + Description for Remove a site extension from a web site, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param site_extension_id: Site extension name. :type site_extension_id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_site_extension_slot.metadata['url'] + url = self.delete_site_extension_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'siteExtensionId': self._serialize.url("site_extension_id", site_extension_id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} + if cls: + return cls(pipeline_response, None, {}) + delete_site_extension_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}'} # type: ignore - def _copy_slot_slot_initial( - self, resource_group_name, name, slot, target_slot, site_config, custom_headers=None, raw=False, **operation_config): - copy_slot_entity = models.CsmCopySlotEntity(target_slot=target_slot, site_config=site_config) + def _copy_slot_initial( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + copy_slot_entity, # type: "models.CsmCopySlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.copy_slot_slot.metadata['url'] + url = self._copy_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def copy_slot_slot( - self, resource_group_name, name, slot, target_slot, site_config, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _copy_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotcopy'} # type: ignore + + def begin_copy_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + copy_slot_entity, # type: "models.CsmCopySlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Copies a deployment slot to another deployment slot of an app. - Description for Copies a deployment slot to another deployment slot of - an app. + Description for Copies a deployment slot to another deployment slot of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during copy operation. - :type target_slot: str - :param site_config: The site object which will be merged with the - source slot site - to produce new destination slot site object. - null to just copy source slot content. Otherwise a - Site - object with properties to override source slot site. - :type site_config: ~azure.mgmt.web.v2019_08_01.models.SiteConfig - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param copy_slot_entity: JSON object that contains the target slot name and site config + properties to override the source slot config. See example. + :type copy_slot_entity: ~azure.mgmt.web.v2019_08_01.models.CsmCopySlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._copy_slot_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - target_slot=target_slot, - site_config=site_config, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._copy_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + copy_slot_entity=copy_slot_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - copy_slot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotcopy'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_copy_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotcopy'} # type: ignore def list_slot_differences_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SlotDifferenceCollection"] """Get the difference in configuration settings between two web app slots. - Description for Get the difference in configuration settings between - two web app slots. + Description for Get the difference in configuration settings between two web app slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SlotDifference - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SlotDifferencePaged[~azure.mgmt.web.v2019_08_01.models.SlotDifference] - :raises: - :class:`DefaultErrorResponseException` - """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slot_differences_slot.metadata['url'] + url = self.list_slot_differences_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SlotDifferencePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_slot_differences_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs'} # type: ignore - def _swap_slot_slot_initial( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + def _swap_slot_initial( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.swap_slot_slot.metadata['url'] + url = self._swap_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def swap_slot_slot( - self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _swap_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore + + def begin_swap_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Swaps two deployment slots of an app. Description for Swaps two deployment slots of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the source slot. If a slot is not specified, the - production slot is used as the source slot. + :param slot: Name of the source slot. If a slot is not specified, the production slot is used + as the source slot. :type slot: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._swap_slot_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - target_slot=target_slot, - preserve_vnet=preserve_vnet, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._swap_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - swap_slot_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap'} # type: ignore def list_snapshots_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user. Description for Returns all Snapshots to the user. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str :param slot: Website Slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SnapshotPaged[~azure.mgmt.web.v2019_08_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_slot.metadata['url'] + url = self.list_snapshots_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots'} # type: ignore def list_snapshots_from_dr_secondary_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user from DRSecondary endpoint. - Description for Returns all Snapshots to the user from DRSecondary - endpoint. + Description for Returns all Snapshots to the user from DRSecondary endpoint. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str :param slot: Website Slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SnapshotPaged[~azure.mgmt.web.v2019_08_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_from_dr_secondary_slot.metadata['url'] + url = self.list_snapshots_from_dr_secondary_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_snapshots_from_dr_secondary_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr'} # type: ignore def get_source_control_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Gets the source control configuration of an app. Description for Gets the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the source control configuration for the production - slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_source_control_slot.metadata['url'] + url = self.get_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} - + get_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def _create_or_update_source_control_slot_initial( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_source_control_slot.metadata['url'] + url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_source_control_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore - def create_or_update_source_control_slot( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_or_update_source_control_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteSourceControl"] """Updates the source control configuration of an app. Description for Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteSourceControl or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_source_control_slot_initial( - resource_group_name=resource_group_name, - name=name, - site_source_control=site_source_control, - slot=slot, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteSourceControl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_source_control_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def delete_source_control_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the source control configuration of an app. Description for Deletes the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_source_control_slot.metadata['url'] + url = self.delete_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + if cls: + return cls(pipeline_response, None, {}) + + delete_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def update_source_control_slot( - self, resource_group_name, name, site_source_control, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Updates the source control configuration of an app. Description for Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl - :param slot: Name of the deployment slot. If a slot is not specified, - the API will update the source control configuration for the - production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will update the + source control configuration for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control_slot.metadata['url'] + url = self.update_source_control_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} + update_source_control_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web'} # type: ignore def start_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Starts an app (or deployment slot, if specified). Description for Starts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will start the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will start the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_slot.metadata['url'] + url = self.start_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} + if cls: + return cls(pipeline_response, None, {}) + start_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start'} # type: ignore def _start_network_trace_slot_initial( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_network_trace_slot.metadata['url'] + url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_network_trace_slot_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore - def start_network_trace_slot( - self, resource_group_name, name, slot, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_network_trace_slot( + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Description for Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -23206,590 +23670,610 @@ def start_network_trace_slot( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_network_trace_slot_initial( - resource_group_name=resource_group_name, - name=name, - slot=slot, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_network_trace_slot_initial( + resource_group_name=resource_group_name, + name=name, + slot=slot, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace'} # type: ignore def stop_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stops an app (or deployment slot, if specified). Description for Stops an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will stop the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will stop the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_slot.metadata['url'] + url = self.stop_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} + stop_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop'} # type: ignore def stop_network_trace_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Description for Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param slot: The name of the slot for this web app. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_network_trace_slot.metadata['url'] + url = self.stop_network_trace_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace'} + stop_network_trace_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace'} # type: ignore def sync_repository_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync web app repository. Description for Sync web app repository. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param slot: Name of web app slot. If not specified then will default - to production slot. + :param slot: Name of web app slot. If not specified then will default to production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.sync_repository_slot.metadata['url'] + url = self.sync_repository_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} + sync_repository_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync'} # type: ignore def sync_function_triggers_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. - Description for Syncs function trigger metadata to the management - database. + Description for Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the deployment slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.sync_function_triggers_slot.metadata['url'] + url = self.sync_function_triggers_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} + sync_function_triggers_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers'} # type: ignore def list_triggered_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredWebJobCollection"] """List triggered web jobs for an app, or a deployment slot. - Description for List triggered web jobs for an app, or a deployment - slot. + Description for List triggered web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes a deployment for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes a + deployment for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredWebJob - :rtype: - ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_jobs_slot.metadata['url'] + url = self.list_triggered_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs'} # type: ignore def get_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredWebJob"] """Gets a triggered web job by its ID for an app, or a deployment slot. - Description for Gets a triggered web job by its ID for an app, or a - deployment slot. + Description for Gets a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_triggered_web_job_slot.metadata['url'] + url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TriggeredWebJob', response) + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} + get_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore def delete_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a triggered web job by its ID for an app, or a deployment slot. - Description for Delete a triggered web job by its ID for an app, or a - deployment slot. + Description for Delete a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API deletes web job for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API deletes web job + for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_triggered_web_job_slot.metadata['url'] + url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} + delete_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}'} # type: ignore def list_triggered_web_job_history_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredJobHistoryCollection"] """List a triggered web job's history for an app, or a deployment slot. - Description for List a triggered web job's history for an app, or a - deployment slot. + Description for List a triggered web job's history for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredJobHistory - :rtype: - ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistoryPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_job_history_slot.metadata['url'] + url = self.list_triggered_web_job_history_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredJobHistoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredJobHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history'} # type: ignore def get_triggered_web_job_history_slot( - self, resource_group_name, name, web_job_name, id, slot, custom_headers=None, raw=False, **operation_config): - """Gets a triggered web job's history by its ID for an app, , or a - deployment slot. - - Description for Gets a triggered web job's history by its ID for an - app, , or a deployment slot. + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + id, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredJobHistory"] + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Description for Gets a triggered web job's history by its ID for an app, , or a deployment + slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -23797,1719 +24281,1752 @@ def get_triggered_web_job_history_slot( :type web_job_name: str :param id: History ID. :type id: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredJobHistory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_triggered_web_job_history_slot.metadata['url'] + url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'id': self._serialize.url("id", id, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TriggeredJobHistory', response) + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} + get_triggered_web_job_history_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore def run_triggered_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Run a triggered web job for an app, or a deployment slot. - Description for Run a triggered web job for an app, or a deployment - slot. + Description for Run a triggered web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API uses the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API uses the + production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.run_triggered_web_job_slot.metadata['url'] + url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} + run_triggered_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run'} # type: ignore def list_usages_slot( - self, resource_group_name, name, slot, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the quota usage information of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] + """Gets the quota usage information of an app (or deployment slot, if specified). - Description for Gets the quota usage information of an app (or - deployment slot, if specified). + Description for Gets the quota usage information of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get quota information of the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get quota + information of the production slot. :type slot: str - :param filter: Return only information specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and - endTime eq 2014-12-31T23:59:59Z and timeGrain eq + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages_slot.metadata['url'] + url = self.list_usages_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages'} # type: ignore def list_vnet_connections_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Gets the virtual networks the app (or deployment slot) is connected to. - Description for Gets the virtual networks the app (or deployment slot) - is connected to. + Description for Gets the virtual networks the app (or deployment slot) is connected to. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get virtual network connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get virtual + network connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_vnet_connections_slot.metadata['url'] + url = self.list_vnet_connections_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} + list_vnet_connections_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections'} # type: ignore def get_vnet_connection_slot( - self, resource_group_name, name, vnet_name, slot, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network the app (or deployment slot) is connected to by - name. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Gets a virtual network the app (or deployment slot) is connected to by name. - Description for Gets a virtual network the app (or deployment slot) is - connected to by name. + Description for Gets a virtual network the app (or deployment slot) is connected to by name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get the named virtual network for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get the + named virtual network for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vnet_connection_slot.metadata['url'] + url = self.get_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + get_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def create_or_update_vnet_connection_slot( - self, resource_group_name, name, vnet_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). - - Description for Adds a Virtual Network connection to an app or slot - (PUT) or updates the connection properties (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_slot.metadata['url'] + url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + create_or_update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def delete_vnet_connection_slot( - self, resource_group_name, name, vnet_name, slot, custom_headers=None, raw=False, **operation_config): - """Deletes a connection from an app (or deployment slot to a named virtual + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Description for Deletes a connection from an app (or deployment slot to a named virtual network. - Description for Deletes a connection from an app (or deployment slot to - a named virtual network. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will delete the connection for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will delete the + connection for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_vnet_connection_slot.metadata['url'] + url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def update_vnet_connection_slot( - self, resource_group_name, name, vnet_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + if cls: + return cls(pipeline_response, None, {}) - Description for Adds a Virtual Network connection to an app or slot - (PUT) or updates the connection properties (PATCH). + delete_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore - :param resource_group_name: Name of the resource group to which the - resource belongs. + def update_vnet_connection_slot( + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). + + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. - :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update connections for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update connections for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: Properties of the Virtual Network connection. See example. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_slot.metadata['url'] + url = self.update_vnet_connection_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} + update_vnet_connection_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetGateway"] """Gets an app's Virtual Network gateway. Description for Gets an app's Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API will get a gateway for the production slot's Virtual Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will get a + gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vnet_connection_gateway_slot.metadata['url'] + url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def create_or_update_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - Description for Adds a gateway to a connected Virtual Network (PUT) or - updates it (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.VnetGateway - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update a gateway for the production slot's Virtual - Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] + url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + create_or_update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_connection_gateway_slot( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, slot, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). - - Description for Adds a gateway to a connected Virtual Network (PUT) or - updates it (PATCH). - - :param resource_group_name: Name of the resource group to which the - resource belongs. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + slot, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). + + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.VnetGateway - :param slot: Name of the deployment slot. If a slot is not specified, - the API will add or update a gateway for the production slot's Virtual - Network. + :param slot: Name of the deployment slot. If a slot is not specified, the API will add or + update a gateway for the production slot's Virtual Network. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_gateway_slot.metadata['url'] + url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_connection_gateway_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_web_jobs_slot( - self, resource_group_name, name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebJobCollection"] """List webjobs for an app, or a deployment slot. Description for List webjobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WebJob - :rtype: - ~azure.mgmt.web.v2019_08_01.models.WebJobPaged[~azure.mgmt.web.v2019_08_01.models.WebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_jobs_slot.metadata['url'] + url = self.list_web_jobs_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} + return ItemPaged( + get_next, extract_data + ) + list_web_jobs_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs'} # type: ignore def get_web_job_slot( - self, resource_group_name, name, web_job_name, slot, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + slot, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebJob" """Get webjob information for an app, or a deployment slot. - Description for Get webjob information for an app, or a deployment - slot. + Description for Get webjob information for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of the web job. :type web_job_name: str - :param slot: Name of the deployment slot. If a slot is not specified, - the API returns deployments for the production slot. + :param slot: Name of the deployment slot. If a slot is not specified, the API returns + deployments for the production slot. :type slot: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_web_job_slot.metadata['url'] + url = self.get_web_job_slot.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'slot': self._serialize.url("slot", slot, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WebJob', response) + deserialized = self._deserialize('WebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} + get_web_job_slot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}'} # type: ignore def list_slot_differences_from_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SlotDifferenceCollection"] """Get the difference in configuration settings between two web app slots. - Description for Get the difference in configuration settings between - two web app slots. + Description for Get the difference in configuration settings between two web app slots. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SlotDifference - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SlotDifferencePaged[~azure.mgmt.web.v2019_08_01.models.SlotDifference] - :raises: - :class:`DefaultErrorResponseException` - """ - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SlotDifferenceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SlotDifferenceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_slot_differences_from_production.metadata['url'] + url = self.list_slot_differences_from_production.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SlotDifferenceCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SlotDifferencePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_slot_differences_from_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs'} # type: ignore def _swap_slot_with_production_initial( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): - slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.swap_slot_with_production.metadata['url'] + url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def swap_slot_with_production( - self, resource_group_name, name, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _swap_slot_with_production_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore + + def begin_swap_slot_with_production( + self, + resource_group_name, # type: str + name, # type: str + slot_swap_entity, # type: "models.CsmSlotEntity" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Swaps two deployment slots of an app. Description for Swaps two deployment slots of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param target_slot: Destination deployment slot during swap operation. - :type target_slot: str - :param preserve_vnet: true to preserve Virtual Network to - the slot during swap; otherwise, false. - :type preserve_vnet: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param slot_swap_entity: JSON object that contains the target slot name. See example. + :type slot_swap_entity: ~azure.mgmt.web.v2019_08_01.models.CsmSlotEntity + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._swap_slot_with_production_initial( - resource_group_name=resource_group_name, - name=name, - target_slot=target_slot, - preserve_vnet=preserve_vnet, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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: + """ + 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 ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._swap_slot_with_production_initial( + resource_group_name=resource_group_name, + name=name, + slot_swap_entity=slot_swap_entity, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_swap_slot_with_production.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap'} # type: ignore def list_snapshots( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user. Description for Returns all Snapshots to the user. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SnapshotPaged[~azure.mgmt.web.v2019_08_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots.metadata['url'] + url = self.list_snapshots.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots'} # type: ignore def list_snapshots_from_dr_secondary( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SnapshotCollection"] """Returns all Snapshots to the user from DRSecondary endpoint. - Description for Returns all Snapshots to the user from DRSecondary - endpoint. + Description for Returns all Snapshots to the user from DRSecondary endpoint. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Website Name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SnapshotPaged[~azure.mgmt.web.v2019_08_01.models.Snapshot] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SnapshotCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_snapshots_from_dr_secondary.metadata['url'] + url = self.list_snapshots_from_dr_secondary.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SnapshotCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_snapshots_from_dr_secondary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr'} + return ItemPaged( + get_next, extract_data + ) + list_snapshots_from_dr_secondary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr'} # type: ignore def get_source_control( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Gets the source control configuration of an app. Description for Gets the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_source_control.metadata['url'] + url = self.get_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} - + get_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def _create_or_update_source_control_initial( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_source_control.metadata['url'] + url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_source_control_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore - def create_or_update_source_control( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_create_or_update_source_control( + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SiteSourceControl"] """Updates the source control configuration of an app. Description for Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SiteSourceControl or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._create_or_update_source_control_initial( - resource_group_name=resource_group_name, - name=name, - site_source_control=site_source_control, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SiteSourceControl or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.web.v2019_08_01.models.SiteSourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SiteSourceControl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_source_control_initial( + resource_group_name=resource_group_name, + name=name, + site_source_control=site_source_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def delete_source_control( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the source control configuration of an app. Description for Deletes the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_source_control.metadata['url'] + url = self.delete_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + if cls: + return cls(pipeline_response, None, {}) + + delete_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def update_source_control( - self, resource_group_name, name, site_source_control, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + site_source_control, # type: "models.SiteSourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SiteSourceControl" """Updates the source control configuration of an app. Description for Updates the source control configuration of an app. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param site_source_control: JSON representation of a SiteSourceControl - object. See example. - :type site_source_control: - ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SiteSourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param site_source_control: JSON representation of a SiteSourceControl object. See example. + :type site_source_control: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteSourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SiteSourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control.metadata['url'] + url = self.update_source_control.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('SiteSourceControl', response) + deserialized = self._deserialize('SiteSourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} + update_source_control.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web'} # type: ignore def start( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Starts an app (or deployment slot, if specified). Description for Starts an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start.metadata['url'] + url = self.start.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} + if cls: + return cls(pipeline_response, None, {}) + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start'} # type: ignore def _start_network_trace_initial( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.NetworkTrace"] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.start_network_trace.metadata['url'] + url = self._start_network_trace_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if duration_in_seconds is not None: query_parameters['durationInSeconds'] = self._serialize.query("duration_in_seconds", duration_in_seconds, 'int') if max_frame_length is not None: query_parameters['maxFrameLength'] = self._serialize.query("max_frame_length", max_frame_length, 'int') if sas_url is not None: query_parameters['sasUrl'] = self._serialize.query("sas_url", sas_url, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('[NetworkTrace]', response) + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized + _start_network_trace_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore - def start_network_trace( - self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_start_network_trace( + self, + resource_group_name, # type: str + name, # type: str + duration_in_seconds=None, # type: Optional[int] + max_frame_length=None, # type: Optional[int] + sas_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["models.NetworkTrace"]] """Start capturing network packets for the site. Description for Start capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str @@ -25519,559 +26036,571 @@ def start_network_trace( :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns list or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]]] - :raises: - :class:`DefaultErrorResponseException` - """ - raw_result = self._start_network_trace_initial( - resource_group_name=resource_group_name, - name=name, - duration_in_seconds=duration_in_seconds, - max_frame_length=max_frame_length, - sas_url=sas_url, - custom_headers=custom_headers, - raw=True, - **operation_config + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either list of NetworkTrace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.web.v2019_08_01.models.NetworkTrace]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('[NetworkTrace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_network_trace_initial( + resource_group_name=resource_group_name, + name=name, + duration_in_seconds=duration_in_seconds, + max_frame_length=max_frame_length, + sas_url=sas_url, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('[NetworkTrace]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace'} # type: ignore def stop( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stops an app (or deployment slot, if specified). Description for Stops an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop.metadata['url'] + url = self.stop.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} + if cls: + return cls(pipeline_response, None, {}) + + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop'} # type: ignore def stop_network_trace( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Stop ongoing capturing network packets for the site. Description for Stop ongoing capturing network packets for the site. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.stop_network_trace.metadata['url'] + url = self.stop_network_trace.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace'} + if cls: + return cls(pipeline_response, None, {}) + + stop_network_trace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace'} # type: ignore def sync_repository( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync web app repository. Description for Sync web app repository. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of web app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.sync_repository.metadata['url'] + url = self.sync_repository.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} + if cls: + return cls(pipeline_response, None, {}) + + sync_repository.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync'} # type: ignore def sync_function_triggers( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Syncs function trigger metadata to the management database. - Description for Syncs function trigger metadata to the management - database. + Description for Syncs function trigger metadata to the management database. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.sync_function_triggers.metadata['url'] + url = self.sync_function_triggers.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} + if cls: + return cls(pipeline_response, None, {}) + + sync_function_triggers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers'} # type: ignore def list_triggered_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredWebJobCollection"] """List triggered web jobs for an app, or a deployment slot. - Description for List triggered web jobs for an app, or a deployment - slot. + Description for List triggered web jobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredWebJob - :rtype: - ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredWebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredWebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_jobs.metadata['url'] + url = self.list_triggered_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredWebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredWebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs'} # type: ignore def get_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredWebJob"] """Gets a triggered web job by its ID for an app, or a deployment slot. - Description for Gets a triggered web job by its ID for an app, or a - deployment slot. + Description for Gets a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredWebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredWebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredWebJob or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_triggered_web_job.metadata['url'] + url = self.get_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TriggeredWebJob', response) + deserialized = self._deserialize('TriggeredWebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} + get_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore def delete_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a triggered web job by its ID for an app, or a deployment slot. - Description for Delete a triggered web job by its ID for an app, or a - deployment slot. + Description for Delete a triggered web job by its ID for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_triggered_web_job.metadata['url'] + url = self.delete_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} + delete_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}'} # type: ignore def list_triggered_web_job_history( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TriggeredJobHistoryCollection"] """List a triggered web job's history for an app, or a deployment slot. - Description for List a triggered web job's history for an app, or a - deployment slot. + Description for List a triggered web job's history for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TriggeredJobHistory - :rtype: - ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistoryPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggeredJobHistoryCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistoryCollectionor None] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_triggered_web_job_history.metadata['url'] + url = self.list_triggered_web_job_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TriggeredJobHistoryCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TriggeredJobHistoryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} + return ItemPaged( + get_next, extract_data + ) + list_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history'} # type: ignore def get_triggered_web_job_history( - self, resource_group_name, name, web_job_name, id, custom_headers=None, raw=False, **operation_config): - """Gets a triggered web job's history by its ID for an app, , or a - deployment slot. - - Description for Gets a triggered web job's history by its ID for an - app, , or a deployment slot. + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.TriggeredJobHistory"] + """Gets a triggered web job's history by its ID for an app, , or a deployment slot. + + Description for Gets a triggered web job's history by its ID for an app, , or a deployment + slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str @@ -26079,912 +26608,879 @@ def get_triggered_web_job_history( :type web_job_name: str :param id: History ID. :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TriggeredJobHistory or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredJobHistory, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.TriggeredJobHistory or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_triggered_web_job_history.metadata['url'] + url = self.get_triggered_web_job_history.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), 'id': self._serialize.url("id", id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TriggeredJobHistory', response) + deserialized = self._deserialize('TriggeredJobHistory', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} + get_triggered_web_job_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}'} # type: ignore def run_triggered_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Run a triggered web job for an app, or a deployment slot. - Description for Run a triggered web job for an app, or a deployment - slot. + Description for Run a triggered web job for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of Web Job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.run_triggered_web_job.metadata['url'] + url = self.run_triggered_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} + if cls: + return cls(pipeline_response, None, {}) + + run_triggered_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run'} # type: ignore def list_usages( - self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the quota usage information of an app (or deployment slot, if - specified). + self, + resource_group_name, # type: str + name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CsmUsageQuotaCollection"] + """Gets the quota usage information of an app (or deployment slot, if specified). - Description for Gets the quota usage information of an app (or - deployment slot, if specified). + Description for Gets the quota usage information of an app (or deployment slot, if specified). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param filter: Return only information specified in the filter (using - OData syntax). For example: $filter=(name.value eq 'Metric1' or - name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and - endTime eq 2014-12-31T23:59:59Z and timeGrain eq + :param filter: Return only information specified in the filter (using OData syntax). For + example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq + 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CsmUsageQuota - :rtype: - ~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuota] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.CsmUsageQuotaCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_usages.metadata['url'] + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CsmUsageQuotaCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} + return ItemPaged( + get_next, extract_data + ) + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages'} # type: ignore def list_vnet_connections( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["models.VnetInfo"] """Gets the virtual networks the app (or deployment slot) is connected to. - Description for Gets the virtual networks the app (or deployment slot) - is connected to. + Description for Gets the virtual networks the app (or deployment slot) is connected to. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VnetInfo, or the result of cls(response) + :rtype: list[~azure.mgmt.web.v2019_08_01.models.VnetInfo] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_vnet_connections.metadata['url'] + url = self.list_vnet_connections.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[VnetInfo]', response) + deserialized = self._deserialize('[VnetInfo]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} + list_vnet_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections'} # type: ignore def get_vnet_connection( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network the app (or deployment slot) is connected to by - name. + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Gets a virtual network the app (or deployment slot) is connected to by name. - Description for Gets a virtual network the app (or deployment slot) is - connected to by name. + Description for Gets a virtual network the app (or deployment slot) is connected to by name. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vnet_connection.metadata['url'] + url = self.get_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + get_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def create_or_update_vnet_connection( - self, resource_group_name, name, vnet_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). - Description for Adds a Virtual Network connection to an app or slot - (PUT) or updates the connection properties (PATCH). + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. + :param connection_envelope: Properties of the Virtual Network connection. See example. :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection.metadata['url'] + url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + create_or_update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def delete_vnet_connection( - self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes a connection from an app (or deployment slot to a named virtual + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a connection from an app (or deployment slot to a named virtual network. + + Description for Deletes a connection from an app (or deployment slot to a named virtual network. - Description for Deletes a connection from an app (or deployment slot to - a named virtual network. - - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the virtual network. :type vnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.delete_vnet_connection.metadata['url'] + url = self.delete_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def update_vnet_connection( - self, resource_group_name, name, vnet_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a Virtual Network connection to an app or slot (PUT) or updates - the connection properties (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + connection_envelope, # type: "models.VnetInfo" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetInfo" + """Adds a Virtual Network connection to an app or slot (PUT) or updates the connection properties (PATCH). - Description for Adds a Virtual Network connection to an app or slot - (PUT) or updates the connection properties (PATCH). + Description for Adds a Virtual Network connection to an app or slot (PUT) or updates the + connection properties (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of an existing Virtual Network. :type vnet_name: str - :param connection_envelope: Properties of the Virtual Network - connection. See example. + :param connection_envelope: Properties of the Virtual Network connection. See example. :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetInfo, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection.metadata['url'] + url = self.update_vnet_connection.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetInfo', response) + deserialized = self._deserialize('VnetInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} + update_vnet_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}'} # type: ignore def get_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.VnetGateway"] """Gets an app's Virtual Network gateway. Description for Gets an app's Virtual Network gateway. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_vnet_connection_gateway.metadata['url'] + url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + get_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def create_or_update_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - Description for Adds a gateway to a connected Virtual Network (PUT) or - updates it (PATCH). + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.create_or_update_vnet_connection_gateway.metadata['url'] + url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + create_or_update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def update_vnet_connection_gateway( - self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config): - """Adds a gateway to a connected Virtual Network (PUT) or updates it - (PATCH). + self, + resource_group_name, # type: str + name, # type: str + vnet_name, # type: str + gateway_name, # type: str + connection_envelope, # type: "models.VnetGateway" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetGateway" + """Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - Description for Adds a gateway to a connected Virtual Network (PUT) or - updates it (PATCH). + Description for Adds a gateway to a connected Virtual Network (PUT) or updates it (PATCH). - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param vnet_name: Name of the Virtual Network. :type vnet_name: str - :param gateway_name: Name of the gateway. Currently, the only - supported string is "primary". + :param gateway_name: Name of the gateway. Currently, the only supported string is "primary". :type gateway_name: str - :param connection_envelope: The properties to update this gateway - with. - :type connection_envelope: - ~azure.mgmt.web.v2019_08_01.models.VnetGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetGateway or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param connection_envelope: The properties to update this gateway with. + :type connection_envelope: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetGateway, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetGateway + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_vnet_connection_gateway.metadata['url'] + url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'), 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetGateway', response) + deserialized = self._deserialize('VnetGateway', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} + update_vnet_connection_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'} # type: ignore def list_web_jobs( - self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WebJobCollection"] """List webjobs for an app, or a deployment slot. Description for List webjobs for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of WebJob - :rtype: - ~azure.mgmt.web.v2019_08_01.models.WebJobPaged[~azure.mgmt.web.v2019_08_01.models.WebJob] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebJobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.WebJobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_web_jobs.metadata['url'] + url = self.list_web_jobs.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WebJobCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WebJobPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} + return ItemPaged( + get_next, extract_data + ) + list_web_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs'} # type: ignore def get_web_job( - self, resource_group_name, name, web_job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + name, # type: str + web_job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WebJob" """Get webjob information for an app, or a deployment slot. - Description for Get webjob information for an app, or a deployment - slot. + Description for Get webjob information for an app, or a deployment slot. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Site name. :type name: str :param web_job_name: Name of the web job. :type web_job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WebJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.WebJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebJob, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.WebJob + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_web_job.metadata['url'] + url = self.get_web_job.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'webJobName': self._serialize.url("web_job_name", web_job_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WebJob', response) + deserialized = self._deserialize('WebJob', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} + get_web_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py index 236763bb8094..8853aeea0bf6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py @@ -1,564 +1,557 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling from .. import models -import uuid +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 WebSiteManagementClientOperationsMixin(object): def get_publishing_user( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.User" """Gets publishing user. Description for Gets publishing user. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_publishing_user.metadata['url'] + url = self.get_publishing_user.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} + get_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore def update_publishing_user( - self, user_details, custom_headers=None, raw=False, **operation_config): + self, + user_details, # type: "models.User" + **kwargs # type: Any + ): + # type: (...) -> "models.User" """Updates publishing user. Description for Updates publishing user. - :param user_details: Details of publishing user + :param user_details: Details of publishing user. :type user_details: ~azure.mgmt.web.v2019_08_01.models.User - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: User or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.User or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.User"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_publishing_user.metadata['url'] + url = self.update_publishing_user.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('User', response) + deserialized = self._deserialize('User', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} + update_publishing_user.metadata = {'url': '/providers/Microsoft.Web/publishingUsers/web'} # type: ignore def list_source_controls( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SourceControlCollection"] """Gets the source controls available for Azure websites. Description for Gets the source controls available for Azure websites. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SourceControl - :rtype: - ~azure.mgmt.web.v2019_08_01.models.SourceControlPaged[~azure.mgmt.web.v2019_08_01.models.SourceControl] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_source_controls.metadata['url'] - + url = self.list_source_controls.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SourceControlCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SourceControlPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} + return ItemPaged( + get_next, extract_data + ) + list_source_controls.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols'} # type: ignore def get_source_control( - self, source_control_type, custom_headers=None, raw=False, **operation_config): + self, + source_control_type, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SourceControl" """Gets source control token. Description for Gets source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_source_control.metadata['url'] + url = self.get_source_control.metadata['url'] # type: ignore path_format_arguments = { - 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str') + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SourceControl', response) + deserialized = self._deserialize('SourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} + get_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore def update_source_control( - self, source_control_type, request_message, custom_headers=None, raw=False, **operation_config): + self, + source_control_type, # type: str + request_message, # type: "models.SourceControl" + **kwargs # type: Any + ): + # type: (...) -> "models.SourceControl" """Updates source control token. Description for Updates source control token. - :param source_control_type: Type of source control + :param source_control_type: Type of source control. :type source_control_type: str - :param request_message: Source control token information - :type request_message: - ~azure.mgmt.web.v2019_08_01.models.SourceControl - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SourceControl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param request_message: Source control token information. + :type request_message: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_source_control.metadata['url'] + url = self.update_source_control.metadata['url'] # type: ignore path_format_arguments = { - 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str') + 'sourceControlType': self._serialize.url("source_control_type", source_control_type, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SourceControl', response) + deserialized = self._deserialize('SourceControl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} + update_source_control.metadata = {'url': '/providers/Microsoft.Web/sourcecontrols/{sourceControlType}'} # type: ignore def list_billing_meters( - self, billing_location=None, os_type=None, custom_headers=None, raw=False, **operation_config): + self, + billing_location=None, # type: Optional[str] + os_type=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.BillingMeterCollection"] """Gets a list of meters for a given location. Description for Gets a list of meters for a given location. - :param billing_location: Azure Location of billable resource + :param billing_location: Azure Location of billable resource. :type billing_location: str - :param os_type: App Service OS type meters used for + :param os_type: App Service OS type meters used for. :type os_type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BillingMeter - :rtype: - ~azure.mgmt.web.v2019_08_01.models.BillingMeterPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeter] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BillingMeterCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.BillingMeterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_billing_meters.metadata['url'] + url = self.list_billing_meters.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if billing_location is not None: query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') if os_type is not None: query_parameters['osType'] = self._serialize.query("os_type", os_type, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BillingMeterCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BillingMeterPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_billing_meters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} + return ItemPaged( + get_next, extract_data + ) + list_billing_meters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} # type: ignore def check_name_availability( - self, name, type, is_fqdn=None, custom_headers=None, raw=False, **operation_config): + self, + name, # type: str + type, # type: Union[str, "models.CheckNameResourceTypes"] + is_fqdn=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceNameAvailability" """Check if a resource name is available. Description for Check if a resource name is available. :param name: Resource name to verify. :type name: str - :param type: Resource type used for verification. Possible values - include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', - 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', - 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' - :type type: str or - ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes + :param type: Resource type used for verification. + :type type: str or ~azure.mgmt.web.v2019_08_01.models.CheckNameResourceTypes :param is_fqdn: Is fully qualified domain name. :type is_fqdn: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceNameAvailability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ResourceNameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(request, 'ResourceNameAvailabilityRequest') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceNameAvailability', response) + deserialized = self._deserialize('ResourceNameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability'} # type: ignore def get_subscription_deployment_locations( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentLocations" """Gets list of available geo regions plus ministamps. Description for Gets list of available geo regions plus ministamps. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentLocations or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentLocations, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.DeploymentLocations + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.get_subscription_deployment_locations.metadata['url'] + url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeploymentLocations', response) + deserialized = self._deserialize('DeploymentLocations', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} + get_subscription_deployment_locations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations'} # type: ignore def list_geo_regions( - self, sku=None, linux_workers_enabled=None, xenon_workers_enabled=None, linux_dynamic_workers_enabled=None, custom_headers=None, raw=False, **operation_config): + self, + sku=None, # type: Optional[Union[str, "models.SkuName"]] + linux_workers_enabled=None, # type: Optional[bool] + xenon_workers_enabled=None, # type: Optional[bool] + linux_dynamic_workers_enabled=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.GeoRegionCollection"] """Get a list of available geographical regions. Description for Get a list of available geographical regions. - :param sku: Name of SKU used to filter the regions. Possible values - include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', 'Dynamic', - 'Isolated', 'PremiumV2', 'ElasticPremium', 'ElasticIsolated' + :param sku: Name of SKU used to filter the regions. :type sku: str or ~azure.mgmt.web.v2019_08_01.models.SkuName - :param linux_workers_enabled: Specify true if you want to - filter to only regions that support Linux workers. + :param linux_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Linux workers. :type linux_workers_enabled: bool - :param xenon_workers_enabled: Specify true if you want to - filter to only regions that support Xenon workers. + :param xenon_workers_enabled: Specify :code:`true` if you want to filter to only + regions that support Xenon workers. :type xenon_workers_enabled: bool - :param linux_dynamic_workers_enabled: Specify true if you - want to filter to only regions that support Linux Consumption Workers. + :param linux_dynamic_workers_enabled: Specify :code:`true` if you want to filter + to only regions that support Linux Consumption Workers. :type linux_dynamic_workers_enabled: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of GeoRegion - :rtype: - ~azure.mgmt.web.v2019_08_01.models.GeoRegionPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegion] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GeoRegionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.GeoRegionCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_geo_regions.metadata['url'] + url = self.list_geo_regions.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} + query_parameters = {} # type: Dict[str, Any] if sku is not None: query_parameters['sku'] = self._serialize.query("sku", sku, 'str') if linux_workers_enabled is not None: @@ -567,495 +560,479 @@ def prepare_request(next_link=None): query_parameters['xenonWorkersEnabled'] = self._serialize.query("xenon_workers_enabled", xenon_workers_enabled, 'bool') if linux_dynamic_workers_enabled is not None: query_parameters['linuxDynamicWorkersEnabled'] = self._serialize.query("linux_dynamic_workers_enabled", linux_dynamic_workers_enabled, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('GeoRegionCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.GeoRegionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} + return ItemPaged( + get_next, extract_data + ) + list_geo_regions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions'} # type: ignore def list_site_identifiers_assigned_to_host_name( - self, name=None, custom_headers=None, raw=False, **operation_config): + self, + name_identifier, # type: "models.NameIdentifier" + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.IdentifierCollection"] """List all apps that are assigned to a hostname. Description for List all apps that are assigned to a hostname. - :param name: Name of the object. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Identifier - :rtype: - ~azure.mgmt.web.v2019_08_01.models.IdentifierPaged[~azure.mgmt.web.v2019_08_01.models.Identifier] - :raises: - :class:`DefaultErrorResponseException` + :param name_identifier: Hostname information. + :type name_identifier: ~azure.mgmt.web.v2019_08_01.models.NameIdentifier + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IdentifierCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.IdentifierCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ - name_identifier = models.NameIdentifier(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_site_identifiers_assigned_to_host_name.metadata['url'] + url = self.list_site_identifiers_assigned_to_host_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(name_identifier, 'NameIdentifier') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(name_identifier, 'NameIdentifier') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IdentifierCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IdentifierPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} + return ItemPaged( + get_next, extract_data + ) + list_site_identifiers_assigned_to_host_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName'} # type: ignore def list_premier_add_on_offers( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PremierAddOnOfferCollection"] """List all premier add-on offers. Description for List all premier add-on offers. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PremierAddOnOffer - :rtype: - ~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOffer] - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremierAddOnOfferCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.web.v2019_08_01.models.PremierAddOnOfferCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.list_premier_add_on_offers.metadata['url'] + url = self.list_premier_add_on_offers.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PremierAddOnOfferCollection', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) - - return response + error = self._deserialize(models.DefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PremierAddOnOfferPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} + return ItemPaged( + get_next, extract_data + ) + list_premier_add_on_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers'} # type: ignore def list_skus( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.SkuInfos" """List all SKUs. Description for List all SKUs. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SkuInfos or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuInfos, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.SkuInfos + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + # Construct URL - url = self.list_skus.metadata['url'] + url = self.list_skus.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SkuInfos', response) + deserialized = self._deserialize('SkuInfos', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus'} # type: ignore def verify_hosting_environment_vnet( - self, parameters, custom_headers=None, raw=False, **operation_config): - """Verifies if this VNET is compatible with an App Service Environment by + self, + parameters, # type: "models.VnetParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.VnetValidationFailureDetails" + """Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + + Description for Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. - Description for Verifies if this VNET is compatible with an App Service - Environment by analyzing the Network Security Group rules. - - :param parameters: VNET information + :param parameters: VNET information. :type parameters: ~azure.mgmt.web.v2019_08_01.models.VnetParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VnetValidationFailureDetails or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VnetValidationFailureDetails, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.VnetValidationFailureDetails + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.verify_hosting_environment_vnet.metadata['url'] + url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VnetValidationFailureDetails', response) + deserialized = self._deserialize('VnetValidationFailureDetails', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} + verify_hosting_environment_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet'} # type: ignore def move( - self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): + # type: (...) -> None """Move resources between resource groups. Description for Move resources between resource groups. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 """ - move_resource_envelope = models.CsmMoveResourceEnvelope(target_resource_group=target_resource_group, resources=resources) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.move.metadata['url'] + url = self.move.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} # type: ignore def validate( - self, resource_group_name, validate_request, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + validate_request, # type: "models.ValidateRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.ValidateResponse" """Validate if a resource can be created. Description for Validate if a resource can be created. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param validate_request: Request with the resources to validate. - :type validate_request: - ~azure.mgmt.web.v2019_08_01.models.ValidateRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ValidateResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :type validate_request: ~azure.mgmt.web.v2019_08_01.models.ValidateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.web.v2019_08_01.models.ValidateResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.validate.metadata['url'] + url = self.validate.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ValidateResponse', response) + deserialized = self._deserialize('ValidateResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate'} # type: ignore def validate_move( - self, resource_group_name, target_resource_group=None, resources=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + move_resource_envelope, # type: "models.CsmMoveResourceEnvelope" + **kwargs # type: Any + ): + # type: (...) -> None """Validate whether a resource can be moved. Description for Validate whether a resource can be moved. - :param resource_group_name: Name of the resource group to which the - resource belongs. + :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str - :param target_resource_group: - :type target_resource_group: str - :param resources: - :type resources: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DefaultErrorResponseException` + :param move_resource_envelope: Object that represents the resource to move. + :type move_resource_envelope: ~azure.mgmt.web.v2019_08_01.models.CsmMoveResourceEnvelope + :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 """ - move_resource_envelope = models.CsmMoveResourceEnvelope(target_resource_group=target_resource_group, resources=resources) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-08-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.validate_move.metadata['url'] + url = self.validate_move.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [204]: - raise models.DefaultErrorResponseException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} + validate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources'} # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/py.typed b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/setup.py b/sdk/appservice/azure-mgmt-web/setup.py index 9732fafbe91e..bf245b12d22d 100644 --- a/sdk/appservice/azure-mgmt-web/setup.py +++ b/sdk/appservice/azure-mgmt-web/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -79,8 +79,8 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', + 'azure-mgmt-core>=1.0.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_app_service.test_app_service_plan.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_app_service.test_app_service_plan.yaml new file mode 100644 index 000000000000..5eab0230d703 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_app_service.test_app_service_plan.yaml @@ -0,0 +1,202 @@ +interactions: +- request: + body: '{"kind": "app", "location": "eastus", "sku": {"name": "P1", "tier": "Premium", + "size": "P1", "family": "P", "capacity": 1}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '123' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname","name":"myname","type":"Microsoft.Web/serverfarms","kind":"app","location":"East + US","properties":{"serverFarmId":40593,"name":"myname","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":20,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East + US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-051_40593","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"P1","tier":"Premium","size":"P1","family":"P","capacity":1}}' + headers: + cache-control: + - no-cache + content-length: + - '1473' + content-type: + - application/json + date: + - Thu, 10 Sep 2020 05:47:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname","name":"myname","type":"Microsoft.Web/serverfarms","kind":"app","location":"East + US","properties":{"serverFarmId":40593,"name":"myname","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":20,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East + US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-051_40593","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"P1","tier":"Premium","size":"P1","family":"P","capacity":1}}' + headers: + cache-control: + - no-cache + content-length: + - '1473' + content-type: + - application/json + date: + - Thu, 10 Sep 2020 05:47:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"kind": "app"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '15' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname","name":"myname","type":"Microsoft.Web/serverfarms","kind":"app","properties":{"serverFarmId":40593,"name":"myname","sku":{"name":"P1","tier":"Premium","size":"P1","capacity":1},"workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":20,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East + US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-051_40593","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":null,"webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"P1","tier":"Premium","size":"P1","capacity":1}}' + headers: + cache-control: + - no-cache + content-length: + - '1494' + content-type: + - application/json + date: + - Thu, 10 Sep 2020 05:47:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myname?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 10 Sep 2020 05:48:05 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_certificate.test_certificate.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_certificate.test_certificate.yaml new file mode 100644 index 000000000000..b894959dde2b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_certificate.test_certificate.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: '{"location": "eastus", "properties": {"hostNames": ["ServerCert"], "password": + "SWsSsd__233$Sdsds#%Sd!"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '105' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/certificates/myname?api-version=2019-08-01 + response: + body: + string: '{"Code":"NotFound","Message":"Cannot find Certificate with name myname.","Target":null,"Details":[{"Message":"Cannot + find Certificate with name myname."},{"Code":"NotFound"},{"ErrorEntity":{"ExtendedCode":"51004","MessageTemplate":"Cannot + find {0} with name {1}.","Parameters":["Certificate","myname"],"Code":"NotFound","Message":"Cannot + find Certificate with name myname."}}],"Innererror":null}' + headers: + cache-control: + - no-cache + content-length: + - '395' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 10 Sep 2020 06:38:05 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 404 + message: Not Found +version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml new file mode 100644 index 000000000000..8296f31553a5 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml @@ -0,0 +1,111 @@ +interactions: +- request: + body: '{"location": "eastus2", "sku": {"name": "Free"}, "properties": {"repositoryUrl": + "https://github.com/00Kai0/html-docs-hello-world", "branch": "master", "repositoryToken": + "3e88889f138a21e9c927b94a4dd59c35bdce7385", "buildProperties": {"appLocation": + "app", "apiLocation": "api", "appArtifactLocation": "build"}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '312' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname","name":"myname","type":"Microsoft.Web/staticSites","location":"East + US 2","properties":{"defaultHostname":"gray-water-02864940f.azurestaticapps.net","repositoryUrl":"https://github.com/00Kai0/html-docs-hello-world","branch":"master","customDomains":[],"privateEndpointConnections":[]},"sku":{"name":"Free","tier":"Free"}}' + headers: + cache-control: + - no-cache + content-length: + - '515' + content-type: + - application/json + date: + - Thu, 10 Sep 2020 07:19:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"setting1": "someval", "setting2": "someval2"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '63' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname/config/functionappsettings?api-version=2019-08-01 + response: + body: + string: '{"Code":"BadRequest","Message":"Operation not supported: A function + must first be deployed to use this method.","Target":null,"Details":[{"Message":"Operation + not supported: A function must first be deployed to use this method."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"51024","MessageTemplate":"Operation + not supported: {0}","Parameters":["A function must first be deployed to use + this method."],"Code":"BadRequest","Message":"Operation not supported: A function + must first be deployed to use this method."}}],"Innererror":null}' + headers: + cache-control: + - no-cache + content-length: + - '543' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 10 Sep 2020 07:19:29 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 400 + message: Bad Request +version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml new file mode 100644 index 000000000000..72a29e1c6046 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml @@ -0,0 +1,112 @@ +interactions: +- request: + body: '{"kind": "app", "location": "eastus", "sku": {"name": "P1", "tier": "Premium", + "size": "P1", "family": "P", "capacity": 1}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '123' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","name":"myappserviceplan","type":"Microsoft.Web/serverfarms","kind":"app","location":"East + US","properties":{"serverFarmId":30147,"name":"myappserviceplan","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":20,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East + US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-063_30147","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"P1","tier":"Premium","size":"P1","family":"P","capacity":1}}' + headers: + cache-control: + - no-cache + content-length: + - '1503' + content-type: + - application/json + date: + - Thu, 10 Sep 2020 07:57:30 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''{"location": "East US 2", "properties": {"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan", + "reserved": false, "isXenon": false, "hyperV": false, "siteConfig": {"netFrameworkVersion": + "v4.6", "linuxFxVersion": "node|10.16", "appSettings": [], "alwaysOn": true, + "localMySqlEnabled": false, "http20Enabled": true}, "scmSiteAlsoStopped": false, + "httpsOnly": false}}\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '526' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/myname?api-version=2019-08-01 + response: + body: + string: '{"Code":"NotFound","Message":"Cannot find ServerFarm with name myappserviceplan.","Target":null,"Details":[{"Message":"Cannot + find ServerFarm with name myappserviceplan."},{"Code":"NotFound"},{"ErrorEntity":{"ExtendedCode":"51004","MessageTemplate":"Cannot + find {0} with name {1}.","Parameters":["ServerFarm","myappserviceplan"],"Code":"NotFound","Message":"Cannot + find ServerFarm with name myappserviceplan."}}],"Innererror":null}' + headers: + cache-control: + - no-cache + content-length: + - '431' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 10 Sep 2020 07:57:36 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '499' + x-powered-by: + - ASP.NET + status: + code: 404 + message: Not Found +version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_app_service.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_app_service.py new file mode 100644 index 000000000000..10b0f24b0841 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_app_service.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +# Current Operation Coverage: +# AppServicePlans: 6/27 + +import unittest + +import azure.mgmt.web +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtWebSiteTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtWebSiteTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.web.WebSiteManagementClient + ) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + def test_app_service_plan(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + NAME = "myname" + +#-------------------------------------------------------------------------- + # /AppServicePlans/put/Create Or Update App Service plan[put] +#-------------------------------------------------------------------------- + BODY = { + "kind": "app", + "location": AZURE_LOCATION, + "sku": { + "name": "P1", + "tier": "Premium", + "size": "P1", + "family": "P", + "capacity": "1" + } + } + result = self.mgmt_client.app_service_plans.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, app_service_plan=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /AppServicePlans/get/Get App Service plan[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.app_service_plans.get(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /AppServicePlans/get/List App Service plans by resource group[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.app_service_plans.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + +#-------------------------------------------------------------------------- + # /AppServicePlans/get/List App Service plans[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.app_service_plans.list() + +#-------------------------------------------------------------------------- + # /AppServicePlans/patch/Patch Service plan[patch] +#-------------------------------------------------------------------------- + BODY = { + "kind": "app" + } + result = self.mgmt_client.app_service_plans.update(resource_group_name=RESOURCE_GROUP, name=NAME, app_service_plan=BODY) + +#-------------------------------------------------------------------------- + # /AppServicePlans/delete/Delete App Service plan[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.app_service_plans.delete(resource_group_name=RESOURCE_GROUP, name=NAME) diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_certificate.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_certificate.py new file mode 100644 index 000000000000..a93f9b85552b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_certificate.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +# Current Operation Coverage: +# Certificates: 0/6 +# CertificateRegistrationProvider: 0/1 + +import unittest + +import azure.mgmt.web +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtWebSiteTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtWebSiteTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.web.WebSiteManagementClient + ) + + @unittest.skip("Operation returned an invalid status 'Not Found' when create certificate") + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + def test_certificate(self, resource_group): + + RESOURCE_GROUP = resource_group.name + NAME = "myname" + +#-------------------------------------------------------------------------- + # /Certificates/put/Create Or Update Certificate[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "host_names": [ + "ServerCert" + ], + "password": "SWsSsd__233$Sdsds#%Sd!" + } + result = self.mgmt_client.certificates.create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, certificate_envelope=BODY) + +#-------------------------------------------------------------------------- + # /Certificates/get/Get Certificate[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.get(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /Certificates/get/List Certificates by resource group[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + +#-------------------------------------------------------------------------- + # /Certificates/get/List Certificates for subscription[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.list() + +#-------------------------------------------------------------------------- + # /CertificateRegistrationProvider/get/List operations[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificate_registration_provider.list_operations() + +#-------------------------------------------------------------------------- + # /Certificates/patch/Patch Certificate[patch] +#-------------------------------------------------------------------------- + BODY = { + "password": "SWsSsd__233$Sdsds#%Sd!" + } + result = self.mgmt_client.certificates.update(resource_group_name=RESOURCE_GROUP, name=NAME, certificate_envelope=BODY) + +#-------------------------------------------------------------------------- + # /Certificates/delete/Delete Certificate[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.delete(resource_group_name=RESOURCE_GROUP, name=NAME) diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py new file mode 100644 index 000000000000..075ee0fd3e79 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +# Current Operation Coverage: +# StaticSites: 26/26 + +import unittest + +import azure.mgmt.web +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer + +AZURE_LOCATION = 'eastus2' + +class MgmtWebSiteTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtWebSiteTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.web.WebSiteManagementClient + ) + + @unittest.skip("unavailable") + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + def test_static_site(self, resource_group): + + GITHUB_TOKEN = self.settings.GITHUB_TOKEN + TENANT_ID = self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + NAME = "myname" + PR_ID = "1" + DOMAIN_NAME = "mydomain" + +#-------------------------------------------------------------------------- + # /StaticSites/put/Create or update a static site[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "sku": { + "name": "Free", + # "tier": "Free" + }, + # "repository_url": "https://github.com/username/RepoName", + "repository_url": "https://github.com/00Kai0/html-docs-hello-world", + "branch": "master", + # "repository_token": "repoToken123", + "repository_token": GITHUB_TOKEN, + "build_properties": { + "app_location": "app", + "api_location": "api", + "app_artifact_location": "build" + } + } + result = self.mgmt_client.static_sites.create_or_update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/put/Creates or updates the function app settings of a static site.[put] +#-------------------------------------------------------------------------- + BODY = { + "properties": { + "setting1": "someval", + "setting2": "someval2" + } + } + result = self.mgmt_client.static_sites.create_or_update_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, app_settings=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/put/Create or update a custom domain for a static site[put] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.create_or_update_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/put/Creates or updates the function app settings of a static site build.[put] +#-------------------------------------------------------------------------- + BODY = { + "setting1": "someval", + "setting2": "someval2" + } + result = self.mgmt_client.static_sites.create_or_update_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID, app_settings=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Gets the functions of a particular static site build[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_build_functions(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Get a static site build[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + +#-------------------------------------------------------------------------- + # /StaticSites/get/List custom domains for a static site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_custom_domains(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Gets the functions of a static site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_functions(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Get all builds for a static site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_site_builds(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Get details for a static site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Get static sites for a resource group[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_sites_by_resource_group(resource_group_name=RESOURCE_GROUP) + +#-------------------------------------------------------------------------- + # /StaticSites/get/Get all static sites in a subscription[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list() + +#-------------------------------------------------------------------------- + # /StaticSites/patch/Create or update a user for a static site[patch] +#-------------------------------------------------------------------------- + BODY = { + "roles": "contributor" + } + # result = self.mgmt_client.static_sites.update_static_site_user(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER, userid=USERID, static_site_user_envelope=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/post/List users for a static site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.static_sites.list_static_site_users(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER) + +#-------------------------------------------------------------------------- + # /StaticSites/post/Get function app settings of a static site build[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + +#-------------------------------------------------------------------------- + # /StaticSites/post/Validate a custom domain for a static site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.validate_custom_domain_can_be_added_to_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/post/Get function app settings of a static site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/post/Create an invitation link for a user for a static site[post] +#-------------------------------------------------------------------------- + BODY = { + "domain": "happy-sea-15afae3e.azurestaticwebsites.net", + "provider": "aad", + "user_details": "username", + "roles": "admin,contributor", + "num_hours_to_expiration": "1" + } + result = self.mgmt_client.static_sites.create_user_roles_invitation_link(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_user_roles_invitation_envelope=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/post/List secrets for a static site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_secrets(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/post/Reset the api key for a static site[post] +#-------------------------------------------------------------------------- + BODY = { + "should_update_repository": True, + "repository_token": GITHUB_TOKEN + } + result = self.mgmt_client.static_sites.reset_static_site_api_key(resource_group_name=RESOURCE_GROUP, name=NAME, reset_properties_envelope=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/post/Detach a static site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.detach_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/patch/Patch a static site[patch] +#-------------------------------------------------------------------------- + BODY = {} + result = self.mgmt_client.static_sites.update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) + +#-------------------------------------------------------------------------- + # /StaticSites/delete/Delete a user for a static site[delete] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.static_sites.delete_static_site_user(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER, userid=USERID) + +#-------------------------------------------------------------------------- + # /StaticSites/delete/Delete a custom domain for a static site[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/delete/Delete a static site build[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + +#-------------------------------------------------------------------------- + # /StaticSites/delete/Delete a static site[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web.py index e899d9eb2219..ca599f365933 100644 --- a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web.py +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web.py @@ -9,17 +9,35 @@ # TEST SCENARIO COVERAGE # ---------------------- -# Methods Total : 567 -# Methods Covered : 106 -# Examples Total : 126 -# Examples Tested : 7 -# Coverage % : 1 +# Methods Total : 572 +# Methods Covered : 111 +# Examples Total : 131 +# Examples Tested : 131 +# Coverage % : 19 # ---------------------- +# Current Operation Coverage: +# AppServiceCertificateOrders: 0/20 +# CertificateRegistrationProvider: 1/1 +# Domains: 1/15 +# TopLevelDomains: 3/3 +# DomainRegistrationProvider: 1/1 +# Certificates: 6/6 +# DeletedWebApps: 2/3 +# Diagnostics: 22/22 +# Provider: 1/3 +# Recommendations: 0/15 +# : 1/16 +# WebApps: 33/372 +# StaticSites: 26/26 +# AppServiceEnvironments: 2/36 +# AppServicePlans: 6/27 +# ResourceHealthMetadata: 6/6 + import unittest import azure.mgmt.web -from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer AZURE_LOCATION = 'eastus' @@ -31,31 +49,54 @@ def setUp(self): azure.mgmt.web.WebSiteManagementClient ) - @ResourceGroupPreparer(location=AZURE_LOCATION) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) def test_web(self, resource_group): SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = self.settings.TENANT_ID RESOURCE_GROUP = resource_group.name DOMAIN_NAME = "myDomain" - NAME = "myappxyza" - LOCATION = "myLocation" + NAME = "my" DELETED_SITE_ID = "myDeletedSiteId" DETECTOR_NAME = "myDetector" SITE_NAME = "mySite" DIAGNOSTIC_CATEGORY = "myDiagnosticCategory" ANALYSIS_NAME = "myAnalysis" SLOT = "mySlot" + BASIC_PUBLISHING_CREDENTIALS_POLICY_NAME = "myBasicPublishingCredentialsPolicy" + CONFIG_NAME = "myConfig" APP_SETTING_KEY = "myAppSettingKey" INSTANCE_ID = "myInstanceId" + NETWORK_TRACE_NAME = "myNetworkTrace" OPERATION_ID = "myOperationId" PRIVATE_ENDPOINT_CONNECTION_NAME = "myPrivateEndpointConnection" AUTHPROVIDER = "myAuthprovider" USERID = "myUserid" PR_ID = "myPrId" + RESOURCE_HEALTH_METADATA_NAME = "myResourceHealthMetadata" + +#-------------------------------------------------------------------------- + # /AppServicePlans/put/Create Or Update App Service plan[put] +#-------------------------------------------------------------------------- + BODY = { + "kind": "app", + "location": AZURE_LOCATION, + "sku": { + "name": "P1", + "tier": "Premium", + "size": "P1", + "family": "P", + "capacity": "1" + } + } + result = self.mgmt_client.app_service_plans.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, app_service_plan=BODY) + result = result.result() +#-------------------------------------------------------------------------- # /StaticSites/put/Create or update a static site[put] +#-------------------------------------------------------------------------- BODY = { - "location": "West US 2", + "location": AZURE_LOCATION, "sku": { "name": "Basic", "tier": "Basic" @@ -69,349 +110,586 @@ def test_web(self, resource_group): "app_artifact_location": "build" } } - # result = self.mgmt_client.static_sites.create_or_update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) - - # /AppServicePlans/put/Create Or Update App Service plan[put] - BODY = { - "kind": "app", - "location": "westus2", - "sku": { - "name": "P1", - "tier": "Premium", - "size": "P1", - "family": "P", - "capacity": "1" - } - } - result = self.mgmt_client.app_service_plans.create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, app_service_plan=BODY) - result = result.result() + result = self.mgmt_client.static_sites.create_or_update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) +#-------------------------------------------------------------------------- # /Certificates/put/Create Or Update Certificate[put] +#-------------------------------------------------------------------------- BODY = { - "location": "East US", + "location": AZURE_LOCATION, "host_names": [ "ServerCert" ], "password": "SWsSsd__233$Sdsds#%Sd!" } - # result = self.mgmt_client.certificates.create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, certificate_envelope=BODY) + result = self.mgmt_client.certificates.create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, certificate_envelope=BODY) +#-------------------------------------------------------------------------- # /StaticSites/put/Creates or updates the function app settings of a static site.[put] - # result = self.mgmt_client.static_sites.create_or_update_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, setting1="someval", setting2="someval2") +#-------------------------------------------------------------------------- + BODY = { + "setting1": "someval", + "setting2": "someval2" + } + result = self.mgmt_client.static_sites.create_or_update_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, config_name=CONFIG_NAME, app_settings=BODY) +#-------------------------------------------------------------------------- # /StaticSites/put/Create or update a custom domain for a static site[put] - # result = self.mgmt_client.static_sites.create_or_update_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.create_or_update_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- # /StaticSites/put/Creates or updates the function app settings of a static site build.[put] - # result = self.mgmt_client.static_sites.create_or_update_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID, setting1="someval", setting2="someval2") +#-------------------------------------------------------------------------- + BODY = { + "setting1": "someval", + "setting2": "someval2" + } + result = self.mgmt_client.static_sites.create_or_update_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID, config_name=CONFIG_NAME, app_settings=BODY) +#-------------------------------------------------------------------------- # /WebApps/put/Approves or rejects a private endpoint connection for a site.[put] - PRIVATE_LINK_SERVICE_CONNECTION_STATE = { - "status": "Approved", - "description": "Approved by admin.", - "actions_required": "" +#-------------------------------------------------------------------------- + BODY = { + "private_link_service_connection_state": { + "status": "Approved", + "description": "Approved by admin.", + "actions_required": "" + } } - # result = self.mgmt_client.web_apps.approve_or_reject_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME, private_link_service_connection_state= PRIVATE_LINK_SERVICE_CONNECTION_STATE) - # result = result.result() + result = self.mgmt_client.web_apps.begin_approve_or_reject_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME, private_endpoint_wrapper=BODY) + result = result.result() +#-------------------------------------------------------------------------- + # /WebApps/put/Update SCM Allowed[put] +#-------------------------------------------------------------------------- + BODY = { + "allow": True + } + result = self.mgmt_client.web_apps.update_scm_allowed(resource_group_name=RESOURCE_GROUP, name=NAME, basic_publishing_credentials_policy_name=BASIC_PUBLISHING_CREDENTIALS_POLICY_NAME, csm_publishing_access_policies_entity=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/put/Update FTP Allowed[put] +#-------------------------------------------------------------------------- + BODY = { + "allow": True + } + result = self.mgmt_client.web_apps.update_ftp_allowed(resource_group_name=RESOURCE_GROUP, name=NAME, basic_publishing_credentials_policy_name=BASIC_PUBLISHING_CREDENTIALS_POLICY_NAME, csm_publishing_access_policies_entity=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Detector[get] - # result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Slot Detector[get] - # result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Analysis[get] - # result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Slot Analysis[get] - # result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) - # /WebApps/get/Get the current status of a network trace operation for a site[get] - # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /WebApps/get/Get FTP Allowed[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_ftp_allowed(resource_group_name=RESOURCE_GROUP, name=NAME, basic_publishing_credentials_policy_name=BASIC_PUBLISHING_CREDENTIALS_POLICY_NAME) - # /Diagnostics/get/Get App Slot Detector[get] - # result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + # /WebApps/get/Get SCM Allowed[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_scm_allowed(resource_group_name=RESOURCE_GROUP, name=NAME, basic_publishing_credentials_policy_name=BASIC_PUBLISHING_CREDENTIALS_POLICY_NAME) +#-------------------------------------------------------------------------- + # /ResourceHealthMetadata/get/Get ResourceHealthMetadata[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.resource_health_metadata.get_by_site(resource_group_name=RESOURCE_GROUP, name=NAME, resource_health_metadata_name=RESOURCE_HEALTH_METADATA_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Detector[get] - # result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) + +#-------------------------------------------------------------------------- + # /Diagnostics/get/Get App Slot Detector[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Analysis[get] - # result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Slot Analysis[get] - # result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) - - # /Diagnostics/get/List App Slot Detectors[get] - # result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/List App Detectors[get] - # result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) - # /Diagnostics/get/List App Slot Analyses[get] - # result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + # /Diagnostics/get/List App Slot Detectors[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- # /Diagnostics/get/List App Analyses[get] - # result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) - # /WebApps/get/Get a private endpoint connection for a site.[get] - # result = self.mgmt_client.web_apps.get_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) +#-------------------------------------------------------------------------- + # /Diagnostics/get/List App Slot Analyses[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- # /WebApps/get/Get the current status of a network trace operation for a site[get] - # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) - # /Diagnostics/get/Get App Slot Diagnostic Category[get] - # result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + # /WebApps/get/Get a private endpoint connection for a site.[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Diagnostic Category[get] - # result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) - # /WebApps/get/Get the current status of a network trace operation for a site[get] - # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /Diagnostics/get/Get App Slot Diagnostic Category[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- # /WebApps/get/Get Azure Key Vault app setting reference[get] - # result = self.mgmt_client.web_apps.get_app_setting_key_vault_reference(resource_group_name=RESOURCE_GROUP, name=NAME, app_setting_key=APP_SETTING_KEY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_app_setting_key_vault_reference(resource_group_name=RESOURCE_GROUP, name=NAME, config_name=CONFIG_NAME, app_setting_key=APP_SETTING_KEY) - # /Diagnostics/get/List App Slot Detectors[get] - # result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + # /ResourceHealthMetadata/get/Get ResourceHealthMetadata[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.resource_health_metadata.get_by_site(resource_group_name=RESOURCE_GROUP, name=NAME, resource_health_metadata_name=RESOURCE_HEALTH_METADATA_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/List App Detectors[get] - # result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) - # /Diagnostics/get/Get App Slot Detector Response[get] - # result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + # /Diagnostics/get/List App Slot Detectors[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detectors(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) + +#-------------------------------------------------------------------------- + # /Diagnostics/get/List App Analyses[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- # /Diagnostics/get/List App Slot Analyses[get] - # result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Detector Response[get] - # result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) - # /Diagnostics/get/List App Analyses[get] - # result = self.mgmt_client.diagnostics.list_site_analyses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + # /Diagnostics/get/Get App Slot Detector Response[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- # /AppServiceEnvironments/get/Get Outbound Network Dependencies Endpoints[get] - # result = self.mgmt_client.app_service_environments.get_outbound_network_dependencies_endpoints(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.app_service_environments.get_outbound_network_dependencies_endpoints(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/get/Get NetworkTraces for a site[get] - # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) +#-------------------------------------------------------------------------- # /AppServiceEnvironments/get/Get Inbound Network Dependencies Endpoints[get] - # result = self.mgmt_client.app_service_environments.get_inbound_network_dependencies_endpoints(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.app_service_environments.get_inbound_network_dependencies_endpoints(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/get/Get NetworkTraces for a site[get] - # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) - - # /ResourceHealthMetadata/get/Get ResourceHealthMetadata[get] - # result = self.mgmt_client.resource_health_metadata.get_by_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) +#-------------------------------------------------------------------------- # /WebApps/get/Get site instance info[get] - # result = self.mgmt_client.web_apps.get_instance_info(resource_group_name=RESOURCE_GROUP, name=NAME, instance_id=INSTANCE_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_instance_info(resource_group_name=RESOURCE_GROUP, name=NAME, instance_id=INSTANCE_ID) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Service Environment Detector Responses[get] - # result = self.mgmt_client.diagnostics.list_hosting_environment_detector_responses(resource_group_name=RESOURCE_GROUP, name=NAME) - - # /Diagnostics/get/Get App Slot Diagnostic Category[get] - # result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_hosting_environment_detector_responses(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Diagnostic Category[get] - # result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) - # /WebApps/get/Get the current status of a network trace operation for a site[get] - # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /Diagnostics/get/Get App Slot Diagnostic Category[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_diagnostic_category(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY) +#-------------------------------------------------------------------------- # /ResourceHealthMetadata/get/List ResourceHealthMetadata for a site[get] - # result = self.mgmt_client.resource_health_metadata.list_by_site(resource_group_name=RESOURCE_GROUP, name=NAME) - - # /StaticSites/get/Gets the functions of a particular static site build[get] - # result = self.mgmt_client.static_sites.list_static_site_build_functions(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.resource_health_metadata.list_by_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/get/Get Azure Key Vault references for app settings[get] - # result = self.mgmt_client.web_apps.get_app_settings_key_vault_references(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_app_settings_key_vault_references(resource_group_name=RESOURCE_GROUP, name=NAME, config_name=CONFIG_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Detector Response[get] - # result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Slot Detector Response[get] - # result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.get_site_detector_response(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, detector_name=DETECTOR_NAME) - # /Diagnostics/get/List App Slot Diagnostic Categories[get] - # result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + # /WebApps/get/List Publishing Credentials Policies[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_basic_publishing_credentials_policies(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /StaticSites/get/Gets the functions of a particular static site build[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_build_functions(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + +#-------------------------------------------------------------------------- # /Diagnostics/get/List App Diagnostic Categories[get] - # result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) + +#-------------------------------------------------------------------------- + # /Diagnostics/get/List App Slot Diagnostic Categories[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- # /WebApps/get/Get NetworkTraces for a site[get] - # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Detector Responses[get] - # result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Slot Detector Responses[get] - # result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- # /WebApps/get/Get NetworkTraces for a site[get] - # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) - - # /ResourceHealthMetadata/get/Get ResourceHealthMetadata[get] - # result = self.mgmt_client.resource_health_metadata.get_by_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) +#-------------------------------------------------------------------------- # /WebApps/get/Get site instance info[get] - # result = self.mgmt_client.web_apps.get_instance_info(resource_group_name=RESOURCE_GROUP, name=NAME, instance_id=INSTANCE_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_instance_info(resource_group_name=RESOURCE_GROUP, name=NAME, instance_id=INSTANCE_ID) +#-------------------------------------------------------------------------- # /StaticSites/get/Get a static site build[get] - # result = self.mgmt_client.static_sites.get_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Service Environment Detector Responses[get] - # result = self.mgmt_client.diagnostics.list_hosting_environment_detector_responses(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_hosting_environment_detector_responses(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /ResourceHealthMetadata/get/List ResourceHealthMetadata for a site[get] - # result = self.mgmt_client.resource_health_metadata.list_by_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.resource_health_metadata.list_by_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/get/Get private link resources of a site[get] - # result = self.mgmt_client.web_apps.get_private_link_resources(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_private_link_resources(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /StaticSites/get/List custom domains for a static site[get] - # result = self.mgmt_client.static_sites.list_static_site_custom_domains(resource_group_name=RESOURCE_GROUP, name=NAME) - - # /Diagnostics/get/List App Slot Diagnostic Categories[get] - # result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_custom_domains(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/List App Diagnostic Categories[get] - # result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) - # /StaticSites/get/Gets the functions of a static site[get] - # result = self.mgmt_client.static_sites.list_static_site_functions(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /Diagnostics/get/List App Slot Diagnostic Categories[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_diagnostic_categories(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) - # /Diagnostics/get/Get App Slot Detector Responses[get] - # result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + # /StaticSites/get/Gets the functions of a static site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_functions(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /Diagnostics/get/Get App Detector Responses[get] - # result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) - # /StaticSites/get/Get all builds for a static site[get] - # result = self.mgmt_client.static_sites.get_static_site_builds(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /Diagnostics/get/Get App Slot Detector Responses[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.list_site_detector_responses(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME) +#-------------------------------------------------------------------------- # /DeletedWebApps/get/Get Deleted Web App by Location[get] - # result = self.mgmt_client.deleted_web_apps.get_deleted_web_app_by_location(location=LOCATION, deleted_site_id=DELETED_SITE_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.deleted_web_apps.get_deleted_web_app_by_location(azure_location=AZURE_LOCATION, deleted_site_id=DELETED_SITE_ID) - # /Certificates/get/Get Certificate[get] - # result = self.mgmt_client.certificates.get(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /StaticSites/get/Get all builds for a static site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_site_builds(resource_group_name=RESOURCE_GROUP, name=NAME) - # /ResourceHealthMetadata/get/List ResourceHealthMetadata for a resource group[get] - # result = self.mgmt_client.resource_health_metadata.list_by_resource_group(resource_group_name=RESOURCE_GROUP) +#-------------------------------------------------------------------------- + # /Certificates/get/Get Certificate[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.get(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /StaticSites/get/Get details for a static site[get] - # result = self.mgmt_client.static_sites.get_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /AppServicePlans/get/Get App Service plan[get] +#-------------------------------------------------------------------------- result = self.mgmt_client.app_service_plans.get(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /ResourceHealthMetadata/get/List ResourceHealthMetadata for a resource group[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.resource_health_metadata.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + +#-------------------------------------------------------------------------- # /Certificates/get/List Certificates by resource group[get] - # result = self.mgmt_client.certificates.list_by_resource_group(resource_group_name=RESOURCE_GROUP) +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.list_by_resource_group(resource_group_name=RESOURCE_GROUP) +#-------------------------------------------------------------------------- # /StaticSites/get/Get static sites for a resource group[get] - # result = self.mgmt_client.static_sites.get_static_sites_by_resource_group(resource_group_name=RESOURCE_GROUP) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.get_static_sites_by_resource_group(resource_group_name=RESOURCE_GROUP) +#-------------------------------------------------------------------------- # /AppServicePlans/get/List App Service plans by resource group[get] +#-------------------------------------------------------------------------- result = self.mgmt_client.app_service_plans.list_by_resource_group(resource_group_name=RESOURCE_GROUP) - # /TopLevelDomains/get/Get Top Level Domain[get] - # result = self.mgmt_client.top_level_domains.get(name=NAME) - +#-------------------------------------------------------------------------- # /DeletedWebApps/get/List Deleted Web App by Location[get] - # result = self.mgmt_client.deleted_web_apps.list_by_location(location=LOCATION) +#-------------------------------------------------------------------------- + result = self.mgmt_client.deleted_web_apps.list_by_location(azure_location=AZURE_LOCATION) + +#-------------------------------------------------------------------------- + # /TopLevelDomains/get/Get Top Level Domain[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.top_level_domains.get(name=NAME) +#-------------------------------------------------------------------------- # /TopLevelDomains/get/List Top Level Domains[get] - # result = self.mgmt_client.top_level_domains.list() +#-------------------------------------------------------------------------- + result = self.mgmt_client.top_level_domains.list() +#-------------------------------------------------------------------------- # /ResourceHealthMetadata/get/List ResourceHealthMetadata for a subscription[get] - # result = self.mgmt_client.resource_health_metadata.list() +#-------------------------------------------------------------------------- + result = self.mgmt_client.resource_health_metadata.list() +#-------------------------------------------------------------------------- # /Certificates/get/List Certificates for subscription[get] - # result = self.mgmt_client.certificates.list() +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.list() +#-------------------------------------------------------------------------- # /StaticSites/get/Get all static sites in a subscription[get] - # result = self.mgmt_client.static_sites.list() +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list() +#-------------------------------------------------------------------------- # /AppServicePlans/get/List App Service plans[get] +#-------------------------------------------------------------------------- result = self.mgmt_client.app_service_plans.list() +#-------------------------------------------------------------------------- # /CertificateRegistrationProvider/get/List operations[get] +#-------------------------------------------------------------------------- result = self.mgmt_client.certificate_registration_provider.list_operations() +#-------------------------------------------------------------------------- # /DomainRegistrationProvider/get/List operations[get] +#-------------------------------------------------------------------------- result = self.mgmt_client.domain_registration_provider.list_operations() +#-------------------------------------------------------------------------- # /Provider/get/List operations[get] +#-------------------------------------------------------------------------- result = self.mgmt_client.provider.list_operations() +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site detector[post] - # result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site slot detector[post] - # result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site slot analysis[post] - # result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site analysis[post] - # result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site detector[post] - # result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site slot detector[post] - # result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_detector(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, detector_name=DETECTOR_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site slot analysis[post] - # result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /Diagnostics/post/Execute site analysis[post] - # result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.diagnostics.execute_site_analysis(resource_group_name=RESOURCE_GROUP, site_name=SITE_NAME, diagnostic_category=DIAGNOSTIC_CATEGORY, analysis_name=ANALYSIS_NAME) +#-------------------------------------------------------------------------- # /StaticSites/patch/Create or update a user for a static site[patch] +#-------------------------------------------------------------------------- BODY = { "roles": "contributor" } - # result = self.mgmt_client.static_sites.update_static_site_user(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER, userid=USERID, static_site_user_envelope=BODY) + result = self.mgmt_client.static_sites.update_static_site_user(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER, userid=USERID, static_site_user_envelope=BODY) - # /StaticSites/post/Get function app settings of a static site build[post] - # result = self.mgmt_client.static_sites.list_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) +#-------------------------------------------------------------------------- + # /WebApps/post/Start a new network trace operation for a site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop a currently running network trace operation for a site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) +#-------------------------------------------------------------------------- # /StaticSites/post/List users for a static site[post] - # result = self.mgmt_client.static_sites.list_static_site_users(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_users(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER) +#-------------------------------------------------------------------------- + # /StaticSites/post/Get function app settings of a static site build[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + +#-------------------------------------------------------------------------- # /StaticSites/post/Validate a custom domain for a static site[post] - # result = self.mgmt_client.static_sites.validate_custom_domain_can_be_added_to_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.validate_custom_domain_can_be_added_to_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- # /WebApps/post/Start a new network trace operation for a site[post] - # result = self.mgmt_client.web_apps.start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, duration_in_seconds="60") - # result = result.result() +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop a currently running network trace operation for a site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) +#-------------------------------------------------------------------------- # /WebApps/post/Start a new network trace operation for a site[post] - # result = self.mgmt_client.web_apps.start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, duration_in_seconds="60") - # result = result.result() +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + result = result.result() +#-------------------------------------------------------------------------- # /WebApps/post/Stop a currently running network trace operation for a site[post] - # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) - # /WebApps/post/Stop a currently running network trace operation for a site[post] - # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + # /Domains/post/Renew an existing domain[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.domains.renew(resource_group_name=RESOURCE_GROUP, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- # /StaticSites/post/Get function app settings of a static site[post] - # result = self.mgmt_client.static_sites.list_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME) - - # /Domains/post/Renew an existing domain[post] - # result = self.mgmt_client.domains.renew(resource_group_name=RESOURCE_GROUP, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/post/List backups[post] - # result = self.mgmt_client.web_apps.list_site_backups(resource_group_name=RESOURCE_GROUP, name=NAME) - - # /WebApps/post/Start a new network trace operation for a site[post] - # result = self.mgmt_client.web_apps.start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, duration_in_seconds="60") - # result = result.result() +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list_site_backups(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /StaticSites/post/Create an invitation link for a user for a static site[post] +#-------------------------------------------------------------------------- BODY = { "domain": "happy-sea-15afae3e.azurestaticwebsites.net", "provider": "aad", @@ -419,89 +697,146 @@ def test_web(self, resource_group): "roles": "admin,contributor", "num_hours_to_expiration": "1" } - # result = self.mgmt_client.static_sites.create_user_roles_invitation_link(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_user_roles_invitation_envelope=BODY) + result = self.mgmt_client.static_sites.create_user_roles_invitation_link(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_user_roles_invitation_envelope=BODY) +#-------------------------------------------------------------------------- # /WebApps/post/Copy slot[post] - SITE_CONFIG = { - "number_of_workers": "1", - "http_logging_enabled": True +#-------------------------------------------------------------------------- + BODY = { + "target_slot": "staging", + "site_config": { + "number_of_workers": "1", + "http_logging_enabled": True + } } - # result = self.mgmt_client.web_apps.copy_production_slot(resource_group_name=RESOURCE_GROUP, name=NAME, target_slot="staging", site_config= SITE_CONFIG) - # result = result.result() + result = self.mgmt_client.web_apps.begin_copy_production_slot(resource_group_name=RESOURCE_GROUP, name=NAME, copy_slot_entity=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Start a new network trace operation for a site[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + result = result.result() +#-------------------------------------------------------------------------- # /StaticSites/post/List secrets for a static site[post] - # result = self.mgmt_client.static_sites.list_static_site_secrets(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.list_static_site_secrets(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /StaticSites/post/Reset the api key for a static site[post] - # result = self.mgmt_client.static_sites.reset_static_site_api_key(resource_group_name=RESOURCE_GROUP, name=NAME, should_update_repository="true", repository_token="repoToken123") - - # /WebApps/post/Start a new network trace operation for a site[post] - # result = self.mgmt_client.web_apps.start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, duration_in_seconds="60") - # result = result.result() - - # /WebApps/post/Stop a currently running network trace operation for a site[post] - # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + BODY = { + "should_update_repository": True, + "repository_token": "repoToken123" + } + result = self.mgmt_client.static_sites.reset_static_site_api_key(resource_group_name=RESOURCE_GROUP, name=NAME, reset_properties_envelope=BODY) +#-------------------------------------------------------------------------- # /WebApps/post/Stop a currently running network trace operation for a site[post] - # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) +#-------------------------------------------------------------------------- # /StaticSites/post/Detach a static site[post] - # result = self.mgmt_client.static_sites.detach_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.detach_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/post/List backups[post] - # result = self.mgmt_client.web_apps.list_site_backups(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list_site_backups(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /WebApps/post/Copy slot[post] - SITE_CONFIG = { - "number_of_workers": "1", - "http_logging_enabled": True +#-------------------------------------------------------------------------- + BODY = { + "target_slot": "staging", + "site_config": { + "number_of_workers": "1", + "http_logging_enabled": True + } } - # result = self.mgmt_client.web_apps.copy_production_slot(resource_group_name=RESOURCE_GROUP, name=NAME, target_slot="staging", site_config= SITE_CONFIG) - # result = result.result() + result = self.mgmt_client.web_apps.begin_copy_production_slot(resource_group_name=RESOURCE_GROUP, name=NAME, copy_slot_entity=BODY) + result = result.result() - # /AppServicePlans/patch/Patch Service plan[patch] +#-------------------------------------------------------------------------- + # /Certificates/patch/Patch Certificate[patch] +#-------------------------------------------------------------------------- BODY = { - "kind": "app" + "password": "SWsSsd__233$Sdsds#%Sd!" } - # result = self.mgmt_client.app_service_plans.update(resource_group_name=RESOURCE_GROUP, name=NAME, app_service_plan=BODY) + result = self.mgmt_client.certificates.update(resource_group_name=RESOURCE_GROUP, name=NAME, certificate_envelope=BODY) +#-------------------------------------------------------------------------- # /StaticSites/patch/Patch a static site[patch] +#-------------------------------------------------------------------------- BODY = {} - # result = self.mgmt_client.static_sites.update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) + result = self.mgmt_client.static_sites.update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) + +#-------------------------------------------------------------------------- + # /AppServicePlans/patch/Patch Service plan[patch] +#-------------------------------------------------------------------------- + BODY = { + "kind": "app" + } + result = self.mgmt_client.app_service_plans.update(resource_group_name=RESOURCE_GROUP, name=NAME, app_service_plan=BODY) +#-------------------------------------------------------------------------- # /TopLevelDomains/post/List Top Level Domain Agreements[post] - # result = self.mgmt_client.top_level_domains.list_agreements(name=NAME, include_privacy="true", for_transfer="false") +#-------------------------------------------------------------------------- + BODY = { + "include_privacy": True, + "for_transfer": False + } + result = self.mgmt_client.top_level_domains.list_agreements(name=NAME, agreement_option=BODY) +#-------------------------------------------------------------------------- # //post/VerifyHostingEnvironmentVnet[post] +#-------------------------------------------------------------------------- BODY = { "vnet_resource_group": "vNet123rg", "vnet_name": "vNet123", "vnet_subnet_name": "vNet123SubNet" } - # result = self.mgmt_client.verify_hosting_environment_vnet(parameters=BODY) + result = self.mgmt_client.verify_hosting_environment_vnet(parameters=BODY) +#-------------------------------------------------------------------------- # /WebApps/delete/Delete a private endpoint connection for a site.[delete] - # result = self.mgmt_client.web_apps.delete_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) - # result = result.result() +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.begin_delete_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) + result = result.result() +#-------------------------------------------------------------------------- # /StaticSites/delete/Delete a user for a static site[delete] - # result = self.mgmt_client.static_sites.delete_static_site_user(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER, userid=USERID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site_user(resource_group_name=RESOURCE_GROUP, name=NAME, authprovider=AUTHPROVIDER, userid=USERID) +#-------------------------------------------------------------------------- # /StaticSites/delete/Delete a custom domain for a static site[delete] - # result = self.mgmt_client.static_sites.delete_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) +#-------------------------------------------------------------------------- # /StaticSites/delete/Delete a static site build[delete] - # result = self.mgmt_client.static_sites.delete_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) +#-------------------------------------------------------------------------- # /Certificates/delete/Delete Certificate[delete] - # result = self.mgmt_client.certificates.delete(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- + result = self.mgmt_client.certificates.delete(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /StaticSites/delete/Delete a static site[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.static_sites.delete_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) +#-------------------------------------------------------------------------- # /AppServicePlans/delete/Delete App Service plan[delete] +#-------------------------------------------------------------------------- result = self.mgmt_client.app_service_plans.delete(resource_group_name=RESOURCE_GROUP, name=NAME) - # /StaticSites/delete/Delete a static site[delete] - # result = self.mgmt_client.static_sites.delete_static_site(resource_group_name=RESOURCE_GROUP, name=NAME) - #------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py new file mode 100644 index 000000000000..a36aee9352a6 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py @@ -0,0 +1,276 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +# Current Operation Coverage: +# WebApps: 33/372 + +import unittest + +import azure.mgmt.web +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtWebSiteTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtWebSiteTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.web.WebSiteManagementClient + ) + + @unittest.skip("unavailable") + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + def test_web_app(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + NAME = "myname" + APP_SERVICE_PLAN_NAME = "myappserviceplan" + +#-------------------------------------------------------------------------- + # /AppServicePlans/put/Create Or Update App Service plan[put] +#-------------------------------------------------------------------------- + BODY = { + "kind": "app", + "location": AZURE_LOCATION, + "sku": { + "name": "P1", + "tier": "Premium", + "size": "P1", + "family": "P", + "capacity": "1" + } + } + result = self.mgmt_client.app_service_plans.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=APP_SERVICE_PLAN_NAME, app_service_plan=BODY) + service_farm = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/Create[put] +#-------------------------------------------------------------------------- + BODY = { + "location": "East US 2", + # "serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/webapp-linux-plan000002", + "server_farm_id": service_farm.id, + "reserved": False, + "is_xenon": False, + "hyper_v": False, + "site_config": { + "net_framework_version":"v4.6", + "linux_fx_version": "node|10.16", + "app_settings": [], + "always_on": True, + "local_my_sql_enabled": False, + "http20_enabled": True + }, + "scm_site_also_stopped": False, + "https_only": False + } + result = self.mgmt_client.web_apps.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, site_envelope=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/Approves or rejects a private endpoint connection for a site.[put] +#-------------------------------------------------------------------------- + BODY = { + "private_link_service_connection_state": { + "status": "Approved", + "description": "Approved by admin.", + "actions_required": "" + } + } + # result = self.mgmt_client.web_apps.begin_approve_or_reject_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME, private_endpoint_wrapper=BODY) + # result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/Update SCM Allowed[put] +#-------------------------------------------------------------------------- + BODY = { + "allow": True + } + result = self.mgmt_client.web_apps.update_scm_allowed(resource_group_name=RESOURCE_GROUP, name=NAME, csm_publishing_access_policies_entity=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/put/Update FTP Allowed[put] +#-------------------------------------------------------------------------- + BODY = { + "allow": True + } + result = self.mgmt_client.web_apps.update_ftp_allowed(resource_group_name=RESOURCE_GROUP, name=NAME, csm_publishing_access_policies_entity=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get FTP Allowed[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_ftp_allowed(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get SCM Allowed[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_scm_allowed(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get a private endpoint connection for a site.[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get Azure Key Vault app setting reference[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_app_setting_key_vault_reference(resource_group_name=RESOURCE_GROUP, name=NAME, config_name=CONFIG_NAME, app_setting_key=APP_SETTING_KEY) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get the current status of a network trace operation for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get NetworkTraces for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get NetworkTraces for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get site instance info[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_instance_info(resource_group_name=RESOURCE_GROUP, name=NAME, instance_id=INSTANCE_ID) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get Azure Key Vault references for app settings[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_app_settings_key_vault_references(resource_group_name=RESOURCE_GROUP, name=NAME, config_name=CONFIG_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/List Publishing Credentials Policies[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_basic_publishing_credentials_policies(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get NetworkTraces for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get NetworkTraces for a site[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_network_traces(resource_group_name=RESOURCE_GROUP, name=NAME, operation_id=OPERATION_ID) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get site instance info[get] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.get_instance_info(resource_group_name=RESOURCE_GROUP, name=NAME, instance_id=INSTANCE_ID) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get private link resources of a site[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_private_link_resources(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Start a new network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + # result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop a currently running network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Start a new network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + # result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop a currently running network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Start a new network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + # result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop a currently running network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/List backups[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list_site_backups(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Copy slot[post] +#-------------------------------------------------------------------------- + BODY = { + "target_slot": "staging", + "site_config": { + "number_of_workers": "1", + "http_logging_enabled": True + } + } + result = self.mgmt_client.web_apps.begin_copy_production_slot(resource_group_name=RESOURCE_GROUP, name=NAME, copy_slot_entity=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Start a new network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.begin_start_web_site_network_trace_operation(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME, duration_in_seconds="60") + # result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop a currently running network trace operation for a site[post] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.stop_web_site_network_trace(resource_group_name=RESOURCE_GROUP, name=NAME, network_trace_name=NETWORK_TRACE_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/List backups[post] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list_site_backups(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Copy slot[post] +#-------------------------------------------------------------------------- + BODY = { + "target_slot": "staging", + "site_config": { + "number_of_workers": "1", + "http_logging_enabled": True + } + } + result = self.mgmt_client.web_apps.begin_copy_production_slot(resource_group_name=RESOURCE_GROUP, name=NAME, copy_slot_entity=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/delete/Delete a private endpoint connection for a site.[delete] +#-------------------------------------------------------------------------- + # result = self.mgmt_client.web_apps.begin_delete_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) + # result = result.result() From 92910a27737a43c6ef96e48d5a56738d5a479bea Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 28 Sep 2020 14:29:16 +0800 Subject: [PATCH 2/3] update appservice test --- ...mt_web.py => disable_test_cli_mgmt_web.py} | 0 ...cli_mgmt_static_site.test_static_site.yaml | 228 +++- .../test_cli_mgmt_web_app.test_web_app.yaml | 800 ++++++++++++++- ...st_cli_mgmt_web_app.test_web_app_slot.yaml | 970 ++++++++++++++++++ .../tests/test_cli_mgmt_static_site.py | 27 +- .../tests/test_cli_mgmt_web_app.py | 643 +++++++++++- 6 files changed, 2602 insertions(+), 66 deletions(-) rename sdk/appservice/azure-mgmt-web/tests/{test_cli_mgmt_web.py => disable_test_cli_mgmt_web.py} (100%) create mode 100644 sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app_slot.yaml diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web.py b/sdk/appservice/azure-mgmt-web/tests/disable_test_cli_mgmt_web.py similarity index 100% rename from sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web.py rename to sdk/appservice/azure-mgmt-web/tests/disable_test_cli_mgmt_web.py diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml index 8296f31553a5..c2d900e78d43 100644 --- a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_static_site.test_static_site.yaml @@ -2,7 +2,7 @@ interactions: - request: body: '{"location": "eastus2", "sku": {"name": "Free"}, "properties": {"repositoryUrl": "https://github.com/00Kai0/html-docs-hello-world", "branch": "master", "repositoryToken": - "3e88889f138a21e9c927b94a4dd59c35bdce7385", "buildProperties": {"appLocation": + "1f2e369d56a6b4f3cfbb60a07a9ebf5f7bd8d7e9", "buildProperties": {"appLocation": "app", "apiLocation": "api", "appArtifactLocation": "build"}}}' headers: Accept: @@ -22,7 +22,7 @@ interactions: response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname","name":"myname","type":"Microsoft.Web/staticSites","location":"East - US 2","properties":{"defaultHostname":"gray-water-02864940f.azurestaticapps.net","repositoryUrl":"https://github.com/00Kai0/html-docs-hello-world","branch":"master","customDomains":[],"privateEndpointConnections":[]},"sku":{"name":"Free","tier":"Free"}}' + US 2","properties":{"defaultHostname":"red-flower-0c9fba40f.azurestaticapps.net","repositoryUrl":"https://github.com/00Kai0/html-docs-hello-world","branch":"master","customDomains":[],"privateEndpointConnections":[]},"sku":{"name":"Free","tier":"Free"}}' headers: cache-control: - no-cache @@ -31,7 +31,7 @@ interactions: content-type: - application/json date: - - Thu, 10 Sep 2020 07:19:28 GMT + - Mon, 28 Sep 2020 04:27:54 GMT expires: - '-1' pragma: @@ -49,14 +49,61 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname","name":"myname","type":"Microsoft.Web/staticSites","location":"East + US 2","properties":{"defaultHostname":"red-flower-0c9fba40f.azurestaticapps.net","repositoryUrl":"https://github.com/00Kai0/html-docs-hello-world","branch":"master","customDomains":[],"privateEndpointConnections":[]},"sku":{"name":"Free","tier":"Free"}}' + headers: + cache-control: + - no-cache + content-length: + - '515' + content-type: + - application/json + date: + - Mon, 28 Sep 2020 04:27:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff x-powered-by: - ASP.NET status: code: 200 message: OK - request: - body: '{"properties": {"setting1": "someval", "setting2": "someval2"}}' + body: null headers: Accept: - application/json @@ -65,32 +112,125 @@ interactions: Connection: - keep-alive Content-Length: - - '63' + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname/listSecrets?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname/secrets","name":"secrets","type":"Microsoft.Web/staticSites/secrets","location":"East + US 2","properties":{"apiKey":"f92e873d4c96ee107d89afd92c18504f6ae64cd3a3104dcc3be3c5bb97f9324f-267e9c0c-2823-481e-81b8-79c4be4797eb00f"}}' + headers: + cache-control: + - no-cache + content-length: + - '416' + content-type: + - application/json + date: + - Mon, 28 Sep 2020 04:27:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"repositoryToken": "1f2e369d56a6b4f3cfbb60a07a9ebf5f7bd8d7e9", + "shouldUpdateRepository": true}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '111' Content-Type: - application/json User-Agent: - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname/config/functionappsettings?api-version=2019-08-01 + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname/resetapikey?api-version=2019-08-01 response: body: - string: '{"Code":"BadRequest","Message":"Operation not supported: A function - must first be deployed to use this method.","Target":null,"Details":[{"Message":"Operation - not supported: A function must first be deployed to use this method."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"51024","MessageTemplate":"Operation - not supported: {0}","Parameters":["A function must first be deployed to use - this method."],"Code":"BadRequest","Message":"Operation not supported: A function - must first be deployed to use this method."}}],"Innererror":null}' + string: '' headers: cache-control: - no-cache content-length: - - '543' - content-type: - - application/json; charset=utf-8 + - '0' + date: + - Mon, 28 Sep 2020 04:27:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname/detach?api-version=2019-08-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/eastus2/operationResults/6e22a8dd-0629-443d-8f0a-87a6a419b776?api-version=2019-01-01 + cache-control: + - no-cache + content-length: + - '0' date: - - Thu, 10 Sep 2020 07:19:29 GMT + - Mon, 28 Sep 2020 04:27:56 GMT expires: - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/eastus2/operations/6e22a8dd-0629-443d-8f0a-87a6a419b776?api-version=2019-01-01 pragma: - no-cache server: @@ -106,6 +246,54 @@ interactions: x-powered-by: - ASP.NET status: - code: 400 - message: Bad Request + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/staticSites/myname?api-version=2019-08-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/eastus2/operationResults/69da1539-a32d-4227-bfdd-cd892a097e37?api-version=2019-01-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 28 Sep 2020 04:27:56 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/eastus2/operations/69da1539-a32d-4227-bfdd-cd892a097e37?api-version=2019-01-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml index 72a29e1c6046..c1a6b29993ed 100644 --- a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"kind": "app", "location": "eastus", "sku": {"name": "P1", "tier": "Premium", - "size": "P1", "family": "P", "capacity": 1}}' + body: '{"location": "eastus", "sku": {"name": "B1", "tier": "BASIC", "capacity": + 1}, "properties": {"perSiteScaling": false, "isXenon": false}}' headers: Accept: - application/json @@ -10,7 +10,7 @@ interactions: Connection: - keep-alive Content-Length: - - '123' + - '136' Content-Type: - application/json User-Agent: @@ -20,17 +20,17 @@ interactions: response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","name":"myappserviceplan","type":"Microsoft.Web/serverfarms","kind":"app","location":"East - US","properties":{"serverFarmId":30147,"name":"myappserviceplan","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":20,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East - US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-063_30147","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"P1","tier":"Premium","size":"P1","family":"P","capacity":1}}' + US","properties":{"serverFarmId":35125,"name":"myappserviceplan","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":3,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East + US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-119_35125","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"B1","tier":"Basic","size":"B1","family":"B","capacity":1}}' headers: cache-control: - no-cache content-length: - - '1503' + - '1500' content-type: - application/json date: - - Thu, 10 Sep 2020 07:57:30 GMT + - Sun, 27 Sep 2020 07:49:43 GMT expires: - '-1' pragma: @@ -55,9 +55,9 @@ interactions: code: 200 message: OK - request: - body: 'b''b\''{"location": "East US 2", "properties": {"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan", + body: 'b''b\''{"location": "eastus", "properties": {"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan", "reserved": false, "isXenon": false, "hyperV": false, "siteConfig": {"netFrameworkVersion": - "v4.6", "linuxFxVersion": "node|10.16", "appSettings": [], "alwaysOn": true, + "v4.6", "appSettings": [{"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"}], "localMySqlEnabled": false, "http20Enabled": true}, "scmSiteAlsoStopped": false, "httpsOnly": false}}\''''' headers: @@ -68,28 +68,29 @@ interactions: Connection: - keep-alive Content-Length: - - '526' + - '531' Content-Type: - application/json User-Agent: - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/myname?api-version=2019-08-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz?api-version=2019-08-01 response: body: - string: '{"Code":"NotFound","Message":"Cannot find ServerFarm with name myappserviceplan.","Target":null,"Details":[{"Message":"Cannot - find ServerFarm with name myappserviceplan."},{"Code":"NotFound"},{"ErrorEntity":{"ExtendedCode":"51004","MessageTemplate":"Cannot - find {0} with name {1}.","Parameters":["ServerFarm","myappserviceplan"],"Code":"NotFound","Message":"Cannot - find ServerFarm with name myappserviceplan."}}],"Innererror":null}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz","name":"mysitexxyzz","type":"Microsoft.Web/sites","kind":"app","location":"eastus","properties":{"name":"mysitexxyzz","state":"Running","hostNames":["mysitexxyzz.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-119.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz.azurewebsites.net","mysitexxyzz.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T07:49:49.59","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz","trafficManagerHostNames":null,"sku":"Basic","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"40.121.35.221","possibleInboundIpAddresses":"40.121.35.221","ftpUsername":"mysitexxyzz\\$mysitexxyzz","ftpsHostName":"ftps://waws-prod-blu-119.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14","possibleOutboundIpAddresses":"40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14,13.68.130.103,40.87.82.124,13.68.137.247","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-119","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":null,"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' headers: cache-control: - no-cache content-length: - - '431' + - '5666' content-type: - - application/json; charset=utf-8 + - application/json date: - - Thu, 10 Sep 2020 07:57:36 GMT + - Sun, 27 Sep 2020 07:50:06 GMT + etag: + - '"1D694A2C7783B8B"' expires: - '-1' pragma: @@ -98,6 +99,10 @@ interactions: - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-aspnet-version: - 4.0.30319 x-content-type-options: @@ -107,6 +112,761 @@ interactions: x-powered-by: - ASP.NET status: - code: 404 - message: Not Found + code: 200 + message: OK +- request: + body: '{"properties": {"webSocketsEnabled": true, "experiments": {"rampUpRules": + []}, "preWarmedInstanceCount": 0}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '108' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/config/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz","name":"mysitexxyzz","type":"Microsoft.Web/sites","location":"East + US","properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":null,"httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$mysitexxyzz","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"None","use32BitWorkerProcess":true,"webSocketsEnabled":true,"alwaysOn":false,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":false,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":true,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}' + headers: + cache-control: + - no-cache + content-length: + - '3586' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:50:08 GMT + etag: + - '"1D694A2C7783B8B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"repoUrl": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", "isManualIntegration": true, "isMercurial": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '144' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"InProgress"}}' + headers: + cache-control: + - no-cache + content-length: + - '523' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:50:13 GMT + etag: + - '"1D694A2D527A68B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"InProgress","provisioningDetails":"2020-09-27T07:50:42.3211102 + https://mysitexxyzz.scm.azurewebsites.net/api/deployments/latest?deployer=GitHub&time=2020-09-27_07-50-21Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '682' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:50:44 GMT + etag: + - '"1D694A2D527A68B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '522' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:14 GMT + etag: + - '"1D694A2D527A68B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/config/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/config/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/config","location":"East + US","properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":null,"httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$mysitexxyzz","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"ExternalGit","use32BitWorkerProcess":true,"webSocketsEnabled":true,"alwaysOn":false,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":false,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":true,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}' + headers: + cache-control: + - no-cache + content-length: + - '3611' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz","name":"mysitexxyzz","type":"Microsoft.Web/sites","kind":"app","location":"East + US","properties":{"name":"mysitexxyzz","state":"Running","hostNames":["mysitexxyzz.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-119.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz.azurewebsites.net","mysitexxyzz.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T07:50:13.5766667","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":null,"scmIpSecurityRestrictions":null,"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz","trafficManagerHostNames":null,"sku":"Basic","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"40.121.35.221","possibleInboundIpAddresses":"40.121.35.221","ftpUsername":"mysitexxyzz\\$mysitexxyzz","ftpsHostName":"ftps://waws-prod-blu-119.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14","possibleOutboundIpAddresses":"40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14,13.68.130.103,40.87.82.124,13.68.137.247","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-119","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":[],"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' + headers: + cache-control: + - no-cache + content-length: + - '5472' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:15 GMT + etag: + - '"1D694A2D527A68B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '522' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:15 GMT + etag: + - '"1D694A2D527A68B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''{"properties": {"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan", + "reserved": false, "isXenon": false, "hyperV": false, "siteConfig": {"netFrameworkVersion": + "v4.6", "appSettings": [{"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"}], + "localMySqlEnabled": false, "http20Enabled": true}, "scmSiteAlsoStopped": false, + "httpsOnly": false}}\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '509' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz","name":"mysitexxyzz","type":"Microsoft.Web/sites","kind":"app","location":"East + US","properties":{"name":"mysitexxyzz","state":"Running","hostNames":["mysitexxyzz.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-119.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz.azurewebsites.net","mysitexxyzz.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T07:51:19.56","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz","trafficManagerHostNames":null,"sku":"Basic","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"40.121.35.221","possibleInboundIpAddresses":"40.121.35.221","ftpUsername":"mysitexxyzz\\$mysitexxyzz","ftpsHostName":"ftps://waws-prod-blu-119.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14","possibleOutboundIpAddresses":"40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14,13.68.130.103,40.87.82.124,13.68.137.247","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-119","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":null,"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' + headers: + cache-control: + - no-cache + content-length: + - '5667' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:20 GMT + etag: + - '"1D694A2D527A68B"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '498' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"webSocketsEnabled": true, "experiments": {"rampUpRules": + []}, "preWarmedInstanceCount": 0}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '108' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/config/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz","name":"mysitexxyzz","type":"Microsoft.Web/sites","location":"East + US","properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":null,"httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$mysitexxyzz","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"ExternalGit","use32BitWorkerProcess":true,"webSocketsEnabled":true,"alwaysOn":false,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":false,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":true,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}' + headers: + cache-control: + - no-cache + content-length: + - '3593' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:21 GMT + etag: + - '"1D694A2FC7BE880"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"repoUrl": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", "isManualIntegration": true, "isMercurial": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '144' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '522' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 07:51:22 GMT + etag: + - '"1D694A2FDE27D60"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/start?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 07:51:23 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/restart?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 07:51:24 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/stop?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 07:51:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 07:51:37 GMT + etag: + - '"1D694A300FC7495"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 07:51:47 GMT + etag: + - '"1D694A300FC7495"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app_slot.yaml b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app_slot.yaml new file mode 100644 index 000000000000..f3ba458c40bd --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/recordings/test_cli_mgmt_web_app.test_web_app_slot.yaml @@ -0,0 +1,970 @@ +interactions: +- request: + body: '{"location": "eastus", "sku": {"name": "S1", "tier": "STANDARD", "capacity": + 1}, "properties": {"perSiteScaling": false, "isXenon": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '139' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","name":"myappserviceplan","type":"Microsoft.Web/serverfarms","kind":"app","location":"East + US","properties":{"serverFarmId":22855,"name":"myappserviceplan","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":1,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":1,"status":"Ready","webSpace":"rgname-EastUSwebspace","subscription":"00000000-0000-0000-0000-000000000000","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":10,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dedicated","siteMode":null,"geoRegion":"East + US","perSiteScaling":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"app","resourceGroup":"rgname","reserved":false,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-blu-177_22855","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null},"sku":{"name":"S1","tier":"Standard","size":"S1","family":"S","capacity":1}}' + headers: + cache-control: + - no-cache + content-length: + - '1504' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:44:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''{"location": "eastus", "properties": {"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan", + "reserved": false, "isXenon": false, "hyperV": false, "siteConfig": {"netFrameworkVersion": + "v4.6", "appSettings": [{"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"}], + "localMySqlEnabled": false, "http20Enabled": true}, "scmSiteAlsoStopped": false, + "httpsOnly": false}}\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '531' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz","name":"mysitexxyzz","type":"Microsoft.Web/sites","kind":"app","location":"eastus","properties":{"name":"mysitexxyzz","state":"Running","hostNames":["mysitexxyzz.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-177.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz.azurewebsites.net","mysitexxyzz.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T09:44:49.3833333","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz","trafficManagerHostNames":null,"sku":"Standard","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"20.49.104.0","possibleInboundIpAddresses":"20.49.104.0","ftpUsername":"mysitexxyzz\\$mysitexxyzz","ftpsHostName":"ftps://waws-prod-blu-177.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121","possibleOutboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121,52.191.87.112,52.191.87.113,52.191.87.114,52.191.87.115,52.191.87.116,52.191.87.118","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-177","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":null,"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' + headers: + cache-control: + - no-cache + content-length: + - '5827' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:45:06 GMT + etag: + - '"1D694B2D7DECA00"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '499' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus", "properties": {"reserved": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '57' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging","name":"mysitexxyzz/staging","type":"Microsoft.Web/sites/slots","kind":"app","location":"eastus","properties":{"name":"mysitexxyzz(staging)","state":"Running","hostNames":["mysitexxyzz-staging.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-177.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz-staging.azurewebsites.net","mysitexxyzz-staging.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz-staging.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz-staging.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T09:45:14.7866667","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz__d80b","trafficManagerHostNames":null,"sku":"Standard","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"20.49.104.0","possibleInboundIpAddresses":"20.49.104.0","ftpUsername":"mysitexxyzz__staging\\$mysitexxyzz__staging","ftpsHostName":"ftps://waws-prod-blu-177.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121","possibleOutboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121,52.191.87.112,52.191.87.113,52.191.87.114,52.191.87.115,52.191.87.116,52.191.87.118","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-177","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz-staging.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":null,"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' + headers: + cache-control: + - no-cache + content-length: + - '5936' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:45:33 GMT + etag: + - '"1D694B2D7DECA00"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '499' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"webSocketsEnabled": true, "experiments": {"rampUpRules": + []}, "preWarmedInstanceCount": 0}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '108' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/config/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging","name":"mysitexxyzz/staging","type":"Microsoft.Web/sites/slots","location":"East + US","properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":"VS2019","httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$mysitexxyzz__staging","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"None","use32BitWorkerProcess":true,"webSocketsEnabled":true,"alwaysOn":false,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":false,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":true,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}' + headers: + cache-control: + - no-cache + content-length: + - '3627' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:45:36 GMT + etag: + - '"1D694B2E74526CB"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"repoUrl": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", "isManualIntegration": true, "isMercurial": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '144' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"InProgress"}}' + headers: + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:45:49 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"InProgress","provisioningDetails":"2020-09-27T09:46:10.1251413 + https://mysitexxyzz-staging.scm.azurewebsites.net/api/deployments/latest?deployer=GitHub&time=2020-09-27_09-45-59Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '704' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:20 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '536' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:51 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging","name":"mysitexxyzz/staging","type":"Microsoft.Web/sites/slots","kind":"app","location":"East + US","properties":{"name":"mysitexxyzz(staging)","state":"Running","hostNames":["mysitexxyzz-staging.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-177.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz-staging.azurewebsites.net","mysitexxyzz-staging.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz-staging.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz-staging.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T09:45:49.6233333","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":null,"scmIpSecurityRestrictions":null,"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz__d80b","trafficManagerHostNames":null,"sku":"Standard","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"20.49.104.0","possibleInboundIpAddresses":"20.49.104.0","ftpUsername":"mysitexxyzz__staging\\$mysitexxyzz__staging","ftpsHostName":"ftps://waws-prod-blu-177.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121","possibleOutboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121,52.191.87.112,52.191.87.113,52.191.87.114,52.191.87.115,52.191.87.116,52.191.87.118","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-177","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz-staging.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":[],"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' + headers: + cache-control: + - no-cache + content-length: + - '5737' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:51 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/config/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/config/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/config","location":"East + US","properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":"VS2019","httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$mysitexxyzz__staging","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"ExternalGit","use32BitWorkerProcess":true,"webSocketsEnabled":true,"alwaysOn":false,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":false,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":true,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}' + headers: + cache-control: + - no-cache + content-length: + - '3638' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '536' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:53 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"reserved": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging","name":"mysitexxyzz/staging","type":"Microsoft.Web/sites/slots","kind":"app","location":"East + US","properties":{"name":"mysitexxyzz(staging)","state":"Running","hostNames":["mysitexxyzz-staging.azurewebsites.net"],"webSpace":"rgname-EastUSwebspace","selfLink":"https://waws-prod-blu-177.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rgname-EastUSwebspace/sites/mysitexxyzz","repositorySiteName":"mysitexxyzz","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"enabledHostNames":["mysitexxyzz-staging.azurewebsites.net","mysitexxyzz-staging.scm.azurewebsites.net"],"siteProperties":{"metadata":null,"properties":[{"name":"LinuxFxVersion","value":""},{"name":"WindowsFxVersion","value":null}],"appSettings":null},"availabilityState":"Normal","sslCertificates":null,"csrs":[],"cers":null,"siteMode":null,"hostNameSslStates":[{"name":"mysitexxyzz-staging.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Standard"},{"name":"mysitexxyzz-staging.scm.azurewebsites.net","sslState":"Disabled","ipBasedSslResult":null,"virtualIP":null,"thumbprint":null,"toUpdate":null,"toUpdateIpBasedSsl":null,"ipBasedSslState":"NotConfigured","hostType":"Repository"}],"computeMode":null,"serverFarm":null,"serverFarmId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/serverfarms/myappserviceplan","reserved":false,"isXenon":false,"hyperV":false,"lastModifiedTimeUtc":"2020-09-27T09:45:49.6233333","storageRecoveryDefaultState":"Running","contentAvailabilityState":"Normal","runtimeAvailabilityState":"Normal","siteConfig":{"numberOfWorkers":null,"defaultDocuments":null,"netFrameworkVersion":null,"phpVersion":null,"pythonVersion":null,"nodeVersion":null,"powerShellVersion":null,"linuxFxVersion":null,"windowsFxVersion":null,"requestTracingEnabled":null,"remoteDebuggingEnabled":null,"remoteDebuggingVersion":null,"httpLoggingEnabled":null,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":null,"detailedErrorLoggingEnabled":null,"publishingUsername":null,"publishingPassword":null,"appSettings":null,"azureStorageAccounts":null,"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":null,"use32BitWorkerProcess":null,"webSocketsEnabled":null,"alwaysOn":null,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":null,"managedPipelineMode":null,"virtualApplications":null,"winAuthAdminState":null,"winAuthTenantState":null,"customAppPoolIdentityAdminState":null,"customAppPoolIdentityTenantState":null,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":null,"routingRules":null,"experiments":null,"limits":null,"autoHealEnabled":null,"autoHealRules":null,"tracingOptions":null,"vnetName":null,"vnetRouteAllEnabled":null,"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":null,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":null,"http20Enabled":null,"minTlsVersion":null,"scmMinTlsVersion":null,"ftpsState":null,"preWarmedInstanceCount":null,"functionAppScaleLimit":null,"healthCheckPath":null,"fileChangeAuditEnabled":null,"functionsRuntimeScaleMonitoringEnabled":null,"websiteTimeZone":null,"minimumElasticInstanceCount":0},"deploymentId":"mysitexxyzz__d80b","trafficManagerHostNames":null,"sku":"Standard","scmSiteAlsoStopped":false,"targetSwapSlot":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"clientAffinityEnabled":true,"clientCertEnabled":false,"clientCertMode":"Required","clientCertExclusionPaths":null,"hostNamesDisabled":false,"domainVerificationIdentifiers":null,"customDomainVerificationId":"55F2E4435A6748F0C3A4666505B3672446A9A9AEFDDC20F98EFEE4B5DCC7807E","kind":"app","inboundIpAddress":"20.49.104.0","possibleInboundIpAddresses":"20.49.104.0","ftpUsername":"mysitexxyzz__staging\\$mysitexxyzz__staging","ftpsHostName":"ftps://waws-prod-blu-177.ftp.azurewebsites.windows.net/site/wwwroot","outboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121","possibleOutboundIpAddresses":"52.191.87.106,52.191.87.107,52.191.87.108,52.191.87.109,52.191.87.110,52.191.87.111,52.191.87.119,52.191.87.120,52.191.87.121,52.191.87.112,52.191.87.113,52.191.87.114,52.191.87.115,52.191.87.116,52.191.87.118","containerSize":0,"dailyMemoryTimeQuota":0,"suspendedTill":null,"siteDisabledReason":0,"functionExecutionUnitsCache":null,"maxNumberOfWorkers":null,"homeStamp":"waws-prod-blu-177","cloningInfo":null,"hostingEnvironmentId":null,"tags":null,"resourceGroup":"rgname","defaultHostName":"mysitexxyzz-staging.azurewebsites.net","slotSwapStatus":null,"httpsOnly":false,"redundancyMode":"None","inProgressOperationId":null,"geoDistributions":null,"privateEndpointConnections":null,"buildVersion":null,"targetBuildVersion":null,"migrationState":null}}' + headers: + cache-control: + - no-cache + content-length: + - '5937' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:55 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '498' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"webSocketsEnabled": true, "experiments": {"rampUpRules": + []}, "preWarmedInstanceCount": 0}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '108' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/config/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging","name":"mysitexxyzz/staging","type":"Microsoft.Web/sites/slots","location":"East + US","properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":"VS2019","httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$mysitexxyzz__staging","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"ExternalGit","use32BitWorkerProcess":true,"webSocketsEnabled":true,"alwaysOn":false,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":false,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":null,"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":null,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow + all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":true,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}' + headers: + cache-control: + - no-cache + content-length: + - '3634' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:56 GMT + etag: + - '"1D694B2FB5C6175"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"repoUrl": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", "isManualIntegration": true, "isMercurial": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '144' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web","name":"mysitexxyzz","type":"Microsoft.Web/sites/sourcecontrols","location":"East + US","properties":{"repoUrl":"https://github.com/00Kai0/azure-site-test","branch":"staging","isManualIntegration":true,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '536' + content-type: + - application/json + date: + - Sun, 27 Sep 2020 09:46:57 GMT + etag: + - '"1D694B32368C2D5"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/start?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 09:46:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/restart?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 09:46:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/stop?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 09:46:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging/sourcecontrols/web?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 09:47:10 GMT + etag: + - '"1D694B325C48020"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz/slots/staging?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 09:47:19 GMT + etag: + - '"1D694B325C48020"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-web/0.46.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Web/sites/mysitexxyzz?api-version=2019-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 27 Sep 2020 09:47:26 GMT + etag: + - '"1D694B2D7DECA00"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14997' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py index 075ee0fd3e79..6ddf7f827a87 100644 --- a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_static_site.py @@ -7,7 +7,7 @@ #-------------------------------------------------------------------------- # Current Operation Coverage: -# StaticSites: 26/26 +# StaticSites: 12/26 import unittest @@ -24,11 +24,10 @@ def setUp(self): azure.mgmt.web.WebSiteManagementClient ) - @unittest.skip("unavailable") @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) def test_static_site(self, resource_group): - GITHUB_TOKEN = self.settings.GITHUB_TOKEN + GITHUB_TOKEN = self.settings.GITHUB_TOKEN if self.is_live else "xxx" TENANT_ID = self.settings.TENANT_ID RESOURCE_GROUP = resource_group.name NAME = "myname" @@ -66,12 +65,12 @@ def test_static_site(self, resource_group): "setting2": "someval2" } } - result = self.mgmt_client.static_sites.create_or_update_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, app_settings=BODY) + # result = self.mgmt_client.static_sites.create_or_update_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, app_settings=BODY) #-------------------------------------------------------------------------- # /StaticSites/put/Create or update a custom domain for a static site[put] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.create_or_update_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) + # result = self.mgmt_client.static_sites.create_or_update_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) #-------------------------------------------------------------------------- # /StaticSites/put/Creates or updates the function app settings of a static site build.[put] @@ -80,7 +79,7 @@ def test_static_site(self, resource_group): "setting1": "someval", "setting2": "someval2" } - result = self.mgmt_client.static_sites.create_or_update_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID, app_settings=BODY) + # result = self.mgmt_client.static_sites.create_or_update_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID, app_settings=BODY) #-------------------------------------------------------------------------- # /StaticSites/get/Gets the functions of a particular static site build[get] @@ -90,7 +89,7 @@ def test_static_site(self, resource_group): #-------------------------------------------------------------------------- # /StaticSites/get/Get a static site build[get] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.get_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + # result = self.mgmt_client.static_sites.get_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) #-------------------------------------------------------------------------- # /StaticSites/get/List custom domains for a static site[get] @@ -138,17 +137,17 @@ def test_static_site(self, resource_group): #-------------------------------------------------------------------------- # /StaticSites/post/Get function app settings of a static site build[post] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.list_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + # result = self.mgmt_client.static_sites.list_static_site_build_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) #-------------------------------------------------------------------------- # /StaticSites/post/Validate a custom domain for a static site[post] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.validate_custom_domain_can_be_added_to_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) + # result = self.mgmt_client.static_sites.validate_custom_domain_can_be_added_to_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) #-------------------------------------------------------------------------- # /StaticSites/post/Get function app settings of a static site[post] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.list_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME) + # result = self.mgmt_client.static_sites.list_static_site_function_app_settings(resource_group_name=RESOURCE_GROUP, name=NAME) #-------------------------------------------------------------------------- # /StaticSites/post/Create an invitation link for a user for a static site[post] @@ -160,7 +159,7 @@ def test_static_site(self, resource_group): "roles": "admin,contributor", "num_hours_to_expiration": "1" } - result = self.mgmt_client.static_sites.create_user_roles_invitation_link(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_user_roles_invitation_envelope=BODY) + # result = self.mgmt_client.static_sites.create_user_roles_invitation_link(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_user_roles_invitation_envelope=BODY) #-------------------------------------------------------------------------- # /StaticSites/post/List secrets for a static site[post] @@ -185,7 +184,7 @@ def test_static_site(self, resource_group): # /StaticSites/patch/Patch a static site[patch] #-------------------------------------------------------------------------- BODY = {} - result = self.mgmt_client.static_sites.update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) + # result = self.mgmt_client.static_sites.update_static_site(resource_group_name=RESOURCE_GROUP, name=NAME, static_site_envelope=BODY) #-------------------------------------------------------------------------- # /StaticSites/delete/Delete a user for a static site[delete] @@ -195,12 +194,12 @@ def test_static_site(self, resource_group): #-------------------------------------------------------------------------- # /StaticSites/delete/Delete a custom domain for a static site[delete] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.delete_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) + # result = self.mgmt_client.static_sites.delete_static_site_custom_domain(resource_group_name=RESOURCE_GROUP, name=NAME, domain_name=DOMAIN_NAME) #-------------------------------------------------------------------------- # /StaticSites/delete/Delete a static site build[delete] #-------------------------------------------------------------------------- - result = self.mgmt_client.static_sites.delete_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) + # result = self.mgmt_client.static_sites.delete_static_site_build(resource_group_name=RESOURCE_GROUP, name=NAME, pr_id=PR_ID) #-------------------------------------------------------------------------- # /StaticSites/delete/Delete a static site[delete] diff --git a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py index a36aee9352a6..a46ff639223b 100644 --- a/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py +++ b/sdk/appservice/azure-mgmt-web/tests/test_cli_mgmt_web_app.py @@ -7,7 +7,7 @@ #-------------------------------------------------------------------------- # Current Operation Coverage: -# WebApps: 33/372 +# WebApps: 31/372 import unittest @@ -24,30 +24,346 @@ def setUp(self): azure.mgmt.web.WebSiteManagementClient ) - @unittest.skip("unavailable") @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - def test_web_app(self, resource_group): + def test_web_app_slot(self, resource_group): + # covered: 15 SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID TENANT_ID = self.settings.TENANT_ID RESOURCE_GROUP = resource_group.name - NAME = "myname" + NAME = "mysitexxyzz" + SLOT_NAME = "staging" APP_SERVICE_PLAN_NAME = "myappserviceplan" + SITE_SOURCE_CONTROL = "web" #-------------------------------------------------------------------------- # /AppServicePlans/put/Create Or Update App Service plan[put] #-------------------------------------------------------------------------- BODY = { - "kind": "app", "location": AZURE_LOCATION, "sku": { - "name": "P1", - "tier": "Premium", - "size": "P1", - "family": "P", + "name": "S1", + "tier": "STANDARD", "capacity": "1" + }, + "per_site_scaling": False, + "is_xenon": False + } + result = self.mgmt_client.app_service_plans.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=APP_SERVICE_PLAN_NAME, app_service_plan=BODY) + service_farm = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/Create[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "server_farm_id": service_farm.id, + "reserved": False, + "is_xenon": False, + "hyper_v": False, + "site_config": { + "net_framework_version":"v4.6", + "app_settings": [ + {"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"} + ], + "local_my_sql_enabled": False, + "http20_enabled": True + }, + "scm_site_also_stopped": False, + "https_only": False + } + result = self.mgmt_client.web_apps.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, site_envelope=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/CreateSlot[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "properties": { + "server_farm_id": service_farm.id, + "reserved": False, + "is_xenon": False, + "hyper_v": False, + "site_config": { + "net_framework_version": "v4.6", + "local_my_sql_enabled": False, + "http20_enabled": True + }, + "scm_site_also_stopped": False + } + } + result = self.mgmt_client.web_apps.begin_create_or_update_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME, site_envelope=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/CreateConfigurationSlot[put] +#-------------------------------------------------------------------------- + BODY = { + "properties": { + "number_of_workers": 1, + "default_documents": [ + "Default.htm", + "Default.html", + "Default.asp", + "index.htm", + "index.html", + "iisstart.htm", + "default.aspx", + "index.php", + "hostingstart.html" + ], + "net_framework_version": "v3.5", + "php_version": "7.2", + "python_version": "3.4", + "node_version": "", + "power_shell_version": "", + "linux_fx_version": "", + "request_tracing_enabled": False, + "remote_debugging_enabled": False, + "http_logging_enabled": False, + "logs_directory_size_limit": 35, + "detailed_error_logging_enabled": False, + "publishing_username": "$webapp-config-test000002", + "scm_type": "None", + "use32_bit_worker_process": False, + "webSocketsEnabled": True, + "always_on": True, + "app_command_line": "", + "managed_pipeline_mode": "Integrated", + "virtual_applications": [ + { + "virtual_path": "/", + "physical_path": "site\\wwwroot", + "preload_enabled": True + } + ], + "load_balancing": "LeastRequests", + "experiments": { + "ramp_up_rules": [] + }, + "auto_heal_enabled": True, + "vnet_name": "", + "local_my_sql_enabled": False, + "ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions_use_main": False, + "http20_enabled": True, + "min_tls_version": "1.0", + "ftps_state": "Disabled", + "preWarmedInstanceCount": 0 + } + } + result = self.mgmt_client.web_apps.create_or_update_configuration_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME, site_config=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/put/CreateSourceControlSlot[put] +#-------------------------------------------------------------------------- + BODY = { + "repo_url": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", + "is_manual_integration": True, + "is_mercurial": False + } + result = self.mgmt_client.web_apps.begin_create_or_update_source_control_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME, site_source_control=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/get/GetSlot[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/GetConfigurationSlot[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_configuration_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/GetSlot[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list_slots(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/GetSourceControlSlot[get] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_source_control_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/patch/UpdateSlot[patch] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "properties": { + "server_farm_id": service_farm.id, + "reserved": False, + "is_xenon": False, + "hyper_v": False, + "site_config": { + "net_framework_version": "v4.6", + "local_my_sql_enabled": False, + "http20_enabled": True + }, + "scm_site_also_stopped": False + } + } + result = self.mgmt_client.web_apps.update_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME, site_envelope=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/patch/UpdateConfigurationSlot +#-------------------------------------------------------------------------- + BODY = { + "properties": { + "number_of_workers": 1, + "default_documents": [ + "Default.htm", + "Default.html", + "Default.asp", + "index.htm", + "index.html", + "iisstart.htm", + "default.aspx", + "index.php", + "hostingstart.html" + ], + "net_framework_version": "v3.5", + "php_version": "7.2", + "python_version": "3.4", + "node_version": "", + "power_shell_version": "", + "linux_fx_version": "", + "request_tracing_enabled": False, + "remote_debugging_enabled": False, + "http_logging_enabled": False, + "logs_directory_size_limit": 35, + "detailed_error_logging_enabled": False, + "publishing_username": "$webapp-config-test000002", + "scm_type": "None", + "use32_bit_worker_process": False, + "webSocketsEnabled": True, + "always_on": True, + "app_command_line": "", + "managed_pipeline_mode": "Integrated", + "virtual_applications": [ + { + "virtual_path": "/", + "physical_path": "site\\wwwroot", + "preload_enabled": True + } + ], + "load_balancing": "LeastRequests", + "experiments": { + "ramp_up_rules": [] + }, + "auto_heal_enabled": True, + "vnet_name": "", + "local_my_sql_enabled": False, + "ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions_use_main": False, + "http20_enabled": True, + "min_tls_version": "1.0", + "ftps_state": "Disabled", + "preWarmedInstanceCount": 0 } } + result = self.mgmt_client.web_apps.update_configuration_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME, site_config=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/patch/UpdateSourceControlSlot[patch] +#-------------------------------------------------------------------------- + BODY ={ + "repo_url": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", + "is_manual_integration": True, + "is_mercurial": False + } + result = self.mgmt_client.web_apps.update_source_control_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME, site_source_control=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/post/StartSlot +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.start_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/RestartSlot +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.restart_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/StopSlot +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.stop_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/delete/DeleteSourceControlSlot[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.delete_source_control_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/delete/DeleteSlot[delete] +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.delete_slot(resource_group_name=RESOURCE_GROUP, name=NAME, slot=SLOT_NAME) + +#-------------------------------------------------------------------------- + # /WebApps/delete/Delete +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.delete(resource_group_name=RESOURCE_GROUP, name=NAME) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + def test_web_app(self, resource_group): + # coverd: 16 + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + NAME = "mysitexxyzz" + APP_SERVICE_PLAN_NAME = "myappserviceplan" + +#-------------------------------------------------------------------------- + # /AppServicePlans/put/Create Or Update App Service plan[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "sku": { + "name": "B1", + "tier": "BASIC", + "capacity": "1" + }, + "per_site_scaling": False, + "is_xenon": False + } result = self.mgmt_client.app_service_plans.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=APP_SERVICE_PLAN_NAME, app_service_plan=BODY) service_farm = result.result() @@ -55,7 +371,143 @@ def test_web_app(self, resource_group): # /WebApps/put/Create[put] #-------------------------------------------------------------------------- BODY = { - "location": "East US 2", + "location": AZURE_LOCATION, + "server_farm_id": service_farm.id, + "reserved": False, + "is_xenon": False, + "hyper_v": False, + "site_config": { + "net_framework_version":"v4.6", + "app_settings": [ + {"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"} + ], + "local_my_sql_enabled": False, + "http20_enabled": True + }, + "scm_site_also_stopped": False, + "https_only": False + } + result = self.mgmt_client.web_apps.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=NAME, site_envelope=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/CreateConfig[put] +#-------------------------------------------------------------------------- + BODY = { + "properties": { + "number_of_workers": 1, + "default_documents": [ + "Default.htm", + "Default.html", + "Default.asp", + "index.htm", + "index.html", + "iisstart.htm", + "default.aspx", + "index.php", + "hostingstart.html" + ], + "net_framework_version": "v3.5", + "php_version": "7.2", + "python_version": "3.4", + "node_version": "", + "power_shell_version": "", + "linux_fx_version": "", + "request_tracing_enabled": False, + "remote_debugging_enabled": False, + "http_logging_enabled": False, + "logs_directory_size_limit": 35, + "detailed_error_logging_enabled": False, + "publishing_username": "$webapp-config-test000002", + "scm_type": "None", + "use32_bit_worker_process": False, + "webSocketsEnabled": True, + "always_on": True, + "app_command_line": "", + "managed_pipeline_mode": "Integrated", + "virtual_applications": [ + { + "virtual_path": "/", + "physical_path": "site\\wwwroot", + "preload_enabled": True + } + ], + "load_balancing": "LeastRequests", + "experiments": { + "ramp_up_rules": [] + }, + "auto_heal_enabled": True, + "vnet_name": "", + "local_my_sql_enabled": False, + "ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions_use_main": False, + "http20_enabled": True, + "min_tls_version": "1.0", + "ftps_state": "Disabled", + "preWarmedInstanceCount": 0 + } + } + result = self.mgmt_client.web_apps.create_or_update_configuration(resource_group_name=RESOURCE_GROUP, name=NAME, site_config=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/put/CreateSourceControl[put] +#-------------------------------------------------------------------------- + BODY = { + "repo_url": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", + "is_manual_integration": True, + "is_mercurial": False + } + result = self.mgmt_client.web_apps.begin_create_or_update_source_control(resource_group_name=RESOURCE_GROUP, name=NAME, site_source_control=BODY) + result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/get/GetConfig +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_configuration(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/Get +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/GetSourceControl +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.get_source_control(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/get/List +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list() + +#-------------------------------------------------------------------------- + # /WebApps/get/ListConfig +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.list_configurations(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/patch/Update[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, # "serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/webapp-linux-plan000002", "server_farm_id": service_farm.id, "reserved": False, @@ -63,9 +515,170 @@ def test_web_app(self, resource_group): "hyper_v": False, "site_config": { "net_framework_version":"v4.6", - "linux_fx_version": "node|10.16", - "app_settings": [], + "app_settings": [ + {"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"} + ], + "local_my_sql_enabled": False, + "http20_enabled": True + }, + "scm_site_also_stopped": False, + "https_only": False + } + result = self.mgmt_client.web_apps.update(resource_group_name=RESOURCE_GROUP, name=NAME, site_envelope=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/patch/UpdateConfig[put] +#-------------------------------------------------------------------------- + BODY = { + "properties": { + "number_of_workers": 1, + "default_documents": [ + "Default.htm", + "Default.html", + "Default.asp", + "index.htm", + "index.html", + "iisstart.htm", + "default.aspx", + "index.php", + "hostingstart.html" + ], + "net_framework_version": "v3.5", + "php_version": "7.2", + "python_version": "3.4", + "node_version": "", + "power_shell_version": "", + "linux_fx_version": "", + "request_tracing_enabled": False, + "remote_debugging_enabled": False, + "http_logging_enabled": False, + "logs_directory_size_limit": 35, + "detailed_error_logging_enabled": False, + "publishing_username": "$webapp-config-test000002", + "scm_type": "None", + "use32_bit_worker_process": False, + "webSocketsEnabled": True, "always_on": True, + "app_command_line": "", + "managed_pipeline_mode": "Integrated", + "virtual_applications": [ + { + "virtual_path": "/", + "physical_path": "site\\wwwroot", + "preload_enabled": True + } + ], + "load_balancing": "LeastRequests", + "experiments": { + "ramp_up_rules": [] + }, + "auto_heal_enabled": True, + "vnet_name": "", + "local_my_sql_enabled": False, + "ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions": [ + { + "ip_address": "Any", + "action": "Allow", + "priority": 1, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scm_ip_security_restrictions_use_main": False, + "http20_enabled": True, + "min_tls_version": "1.0", + "ftps_state": "Disabled", + "preWarmedInstanceCount": 0 + } + } + result = self.mgmt_client.web_apps.update_configuration(resource_group_name=RESOURCE_GROUP, name=NAME, site_config=BODY) + + #-------------------------------------------------------------------------- + # /WebApps/patch/UpdateSourceControl[put] +#-------------------------------------------------------------------------- + BODY = { + "repo_url": "https://github.com/00Kai0/azure-site-test", + "branch": "staging", + "is_manual_integration": True, + "is_mercurial": False + } + result = self.mgmt_client.web_apps.update_source_control(resource_group_name=RESOURCE_GROUP, name=NAME, site_source_control=BODY) + +#-------------------------------------------------------------------------- + # /WebApps/post/Start +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.start(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Restart +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.restart(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/post/Stop +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.stop(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/delete/DeleteSourceControl +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.delete_source_control(resource_group_name=RESOURCE_GROUP, name=NAME) + +#-------------------------------------------------------------------------- + # /WebApps/delete/Delete +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.delete(resource_group_name=RESOURCE_GROUP, name=NAME) + + @unittest.skip("unavailable") + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + def test_web_app_backup(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + NAME = "mysitexxyzz" + APP_SERVICE_PLAN_NAME = "myappserviceplan" + +#-------------------------------------------------------------------------- + # /AppServicePlans/put/Create Or Update App Service plan[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + "sku": { + "name": "B1", + "tier": "BASIC", + "capacity": "1" + }, + "per_site_scaling": False, + "is_xenon": False + } + result = self.mgmt_client.app_service_plans.begin_create_or_update(resource_group_name=RESOURCE_GROUP, name=APP_SERVICE_PLAN_NAME, app_service_plan=BODY) + service_farm = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/put/Create[put] +#-------------------------------------------------------------------------- + BODY = { + "location": AZURE_LOCATION, + # "serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/webapp-linux-plan000002", + "server_farm_id": service_farm.id, + "reserved": False, + "is_xenon": False, + "hyper_v": False, + "site_config": { + "net_framework_version":"v4.6", + "app_settings": [ + {"name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "10.14"} + ], "local_my_sql_enabled": False, "http20_enabled": True }, @@ -274,3 +887,9 @@ def test_web_app(self, resource_group): #-------------------------------------------------------------------------- # result = self.mgmt_client.web_apps.begin_delete_private_endpoint_connection(resource_group_name=RESOURCE_GROUP, name=NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) # result = result.result() + +#-------------------------------------------------------------------------- + # /WebApps/delete/Delete +#-------------------------------------------------------------------------- + result = self.mgmt_client.web_apps.begin_delete(resource_group_name=RESOURCE_GROUP, name=NAME) + result = result.result() From 17d7753fd622a24df465ef078b100f00dac2a2c0 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Tue, 13 Oct 2020 14:15:34 +0800 Subject: [PATCH 3/3] regen sdk --- sdk/appservice/azure-mgmt-web/CHANGELOG.md | 49 + .../azure/mgmt/web/_configuration.py | 3 +- .../azure/mgmt/web/_operations_mixin.py | 36 +- .../azure-mgmt-web/azure/mgmt/web/_version.py | 2 +- .../mgmt/web/_web_site_management_client.py | 34 +- .../azure/mgmt/web/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 4 +- ...ns_mixin_async.py => _operations_mixin.py} | 132 +- ...sync.py => _web_site_management_client.py} | 218 +- .../mgmt/web/v2015_04_01/_configuration.py | 3 +- .../azure/mgmt/web/v2015_04_01/_metadata.json | 6 +- .../_web_site_management_client.py | 1 + .../mgmt/web/v2015_04_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 15 +- .../__init__.py | 6 +- ...omain_registration_provider_operations.py} | 9 +- .../_domains_operations.py} | 107 +- .../_top_level_domains_operations.py} | 25 +- .../web/v2015_04_01/models/_paged_models.py | 92 - ...domain_registration_provider_operations.py | 9 +- .../operations/_domains_operations.py | 107 +- .../_top_level_domains_operations.py | 25 +- .../azure/mgmt/web/v2015_04_01/version.py | 13 - .../mgmt/web/v2015_08_01/_configuration.py | 3 +- .../azure/mgmt/web/v2015_08_01/_metadata.json | 6 +- .../_web_site_management_client.py | 1 + .../mgmt/web/v2015_08_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 11 +- .../__init__.py | 4 +- ..._service_certificate_orders_operations.py} | 127 +- ...icate_registration_provider_operations.py} | 9 +- .../web/v2015_08_01/models/_paged_models.py | 53 - ...p_service_certificate_orders_operations.py | 127 +- ...ficate_registration_provider_operations.py | 9 +- .../azure/mgmt/web/v2015_08_01/version.py | 13 - .../mgmt/web/v2016_03_01/_configuration.py | 3 +- .../azure/mgmt/web/v2016_03_01/_metadata.json | 10 +- .../_web_site_management_client.py | 2 +- .../mgmt/web/v2016_03_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 34 +- .../__init__.py | 16 +- .../_billing_meters_operations.py} | 9 +- .../_certificates_operations.py} | 43 +- .../_deleted_web_apps_operations.py} | 9 +- .../_diagnostics_operations.py} | 156 +- .../_provider_operations.py} | 23 +- .../_recommendations_operations.py} | 50 +- .../_resource_health_metadata_operations.py} | 44 +- ..._web_site_management_client_operations.py} | 110 +- .../web/v2016_03_01/models/_paged_models.py | 209 -- .../operations/_billing_meters_operations.py | 9 +- .../operations/_certificates_operations.py | 43 +- .../_deleted_web_apps_operations.py | 9 +- .../operations/_diagnostics_operations.py | 156 +- .../operations/_provider_operations.py | 23 +- .../operations/_recommendations_operations.py | 50 +- .../_resource_health_metadata_operations.py | 44 +- .../_web_site_management_client_operations.py | 110 +- .../azure/mgmt/web/v2016_03_01/version.py | 13 - .../mgmt/web/v2016_08_01/_configuration.py | 3 +- .../azure/mgmt/web/v2016_08_01/_metadata.json | 6 +- .../_web_site_management_client.py | 1 + .../mgmt/web/v2016_08_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 7 +- .../__init__.py | 2 +- .../_web_apps_operations.py} | 2070 +++++++++---- .../web/v2016_08_01/models/_paged_models.py | 326 -- .../operations/_web_apps_operations.py | 2070 +++++++++---- .../azure/mgmt/web/v2016_08_01/version.py | 13 - .../mgmt/web/v2016_09_01/_configuration.py | 3 +- .../azure/mgmt/web/v2016_09_01/_metadata.json | 6 +- .../_web_site_management_client.py | 1 + .../mgmt/web/v2016_09_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 11 +- .../__init__.py | 4 +- .../_app_service_environments_operations.py} | 289 +- .../_app_service_plans_operations.py} | 195 +- .../web/v2016_09_01/models/_paged_models.py | 170 -- .../_app_service_environments_operations.py | 289 +- .../_app_service_plans_operations.py | 195 +- .../azure/mgmt/web/v2016_09_01/version.py | 13 - .../mgmt/web/v2018_02_01/_configuration.py | 3 +- .../azure/mgmt/web/v2018_02_01/_metadata.json | 10 +- .../_web_site_management_client.py | 1 + .../mgmt/web/v2018_02_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 61 +- .../v2018_02_01/aio/operations/__init__.py | 41 + ..._service_certificate_orders_operations.py} | 127 +- .../_app_service_environments_operations.py} | 320 +- .../_app_service_plans_operations.py} | 195 +- ...icate_registration_provider_operations.py} | 9 +- .../_certificates_operations.py} | 43 +- .../_deleted_web_apps_operations.py} | 23 +- .../_diagnostics_operations.py} | 156 +- ...omain_registration_provider_operations.py} | 9 +- .../_domains_operations.py} | 105 +- .../_provider_operations.py} | 23 +- .../_recommendations_operations.py} | 83 +- .../_resource_health_metadata_operations.py} | 44 +- .../_top_level_domains_operations.py} | 25 +- .../_web_apps_operations.py} | 2416 ++++++++++----- ..._web_site_management_client_operations.py} | 125 +- .../aio/operations_async/__init__.py | 41 - .../web/v2018_02_01/models/_paged_models.py | 729 ----- ...p_service_certificate_orders_operations.py | 127 +- .../_app_service_environments_operations.py | 320 +- .../_app_service_plans_operations.py | 195 +- ...ficate_registration_provider_operations.py | 9 +- .../operations/_certificates_operations.py | 43 +- .../_deleted_web_apps_operations.py | 23 +- .../operations/_diagnostics_operations.py | 156 +- ...domain_registration_provider_operations.py | 9 +- .../operations/_domains_operations.py | 105 +- .../operations/_provider_operations.py | 23 +- .../operations/_recommendations_operations.py | 83 +- .../_resource_health_metadata_operations.py | 44 +- .../_top_level_domains_operations.py | 25 +- .../operations/_web_apps_operations.py | 2416 ++++++++++----- .../_web_site_management_client_operations.py | 125 +- .../azure/mgmt/web/v2018_02_01/version.py | 13 - .../mgmt/web/v2018_11_01/_configuration.py | 3 +- .../azure/mgmt/web/v2018_11_01/_metadata.json | 6 +- .../_web_site_management_client.py | 2 +- .../mgmt/web/v2018_11_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 8 +- .../__init__.py | 2 +- .../_certificates_operations.py} | 43 +- .../web/v2018_11_01/models/_paged_models.py | 27 - .../operations/_certificates_operations.py | 43 +- .../azure/mgmt/web/v2018_11_01/version.py | 13 - .../mgmt/web/v2019_08_01/_configuration.py | 3 +- .../azure/mgmt/web/v2019_08_01/_metadata.json | 10 +- .../_web_site_management_client.py | 1 + .../mgmt/web/v2019_08_01/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 3 +- ...sync.py => _web_site_management_client.py} | 65 +- .../v2019_08_01/aio/operations/__init__.py | 43 + ..._service_certificate_orders_operations.py} | 143 +- .../_app_service_environments_operations.py} | 282 +- .../_app_service_plans_operations.py} | 191 +- ...icate_registration_provider_operations.py} | 9 +- .../_certificates_operations.py} | 45 +- .../_deleted_web_apps_operations.py} | 23 +- .../_diagnostics_operations.py} | 156 +- ...omain_registration_provider_operations.py} | 9 +- .../_domains_operations.py} | 111 +- .../_provider_operations.py} | 23 +- .../_recommendations_operations.py} | 99 +- .../_resource_health_metadata_operations.py} | 44 +- .../_static_sites_operations.py} | 184 +- .../_top_level_domains_operations.py} | 25 +- .../_web_apps_operations.py} | 2626 ++++++++++++----- ..._web_site_management_client_operations.py} | 121 +- .../aio/operations_async/__init__.py | 43 - .../web/v2019_08_01/models/_paged_models.py | 781 ----- ...p_service_certificate_orders_operations.py | 143 +- .../_app_service_environments_operations.py | 282 +- .../_app_service_plans_operations.py | 191 +- ...ficate_registration_provider_operations.py | 9 +- .../operations/_certificates_operations.py | 45 +- .../_deleted_web_apps_operations.py | 23 +- .../operations/_diagnostics_operations.py | 156 +- ...domain_registration_provider_operations.py | 9 +- .../operations/_domains_operations.py | 111 +- .../operations/_provider_operations.py | 23 +- .../operations/_recommendations_operations.py | 99 +- .../_resource_health_metadata_operations.py | 44 +- .../operations/_static_sites_operations.py | 184 +- .../_top_level_domains_operations.py | 25 +- .../operations/_web_apps_operations.py | 2626 ++++++++++++----- .../_web_site_management_client_operations.py | 121 +- .../azure/mgmt/web/v2019_08_01/version.py | 13 - .../azure-mgmt-web/azure/mgmt/web/version.py | 13 - sdk/appservice/azure-mgmt-web/setup.py | 2 +- 181 files changed, 16008 insertions(+), 9750 deletions(-) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/{_configuration_async.py => _configuration.py} (94%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/{_operations_mixin_async.py => _operations_mixin.py} (76%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (61%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (87%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/{operations_async => operations}/__init__.py (71%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/{operations_async/_domain_registration_provider_operations_async.py => operations/_domain_registration_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/{operations_async/_domains_operations_async.py => operations/_domains_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/{operations_async/_top_level_domains_operations_async.py => operations/_top_level_domains_operations.py} (92%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (88%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/{operations_async => operations}/__init__.py (73%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/{operations_async/_app_service_certificate_orders_operations_async.py => operations/_app_service_certificate_orders_operations.py} (94%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/{operations_async/_certificate_registration_provider_operations_async.py => operations/_certificate_registration_provider_operations.py} (92%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (81%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async => operations}/__init__.py (56%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_billing_meters_operations_async.py => operations/_billing_meters_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_certificates_operations_async.py => operations/_certificates_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_deleted_web_apps_operations_async.py => operations/_deleted_web_apps_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_diagnostics_operations_async.py => operations/_diagnostics_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_provider_operations_async.py => operations/_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_recommendations_operations_async.py => operations/_recommendations_operations.py} (94%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_resource_health_metadata_operations_async.py => operations/_resource_health_metadata_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/{operations_async/_web_site_management_client_operations_async.py => operations/_web_site_management_client_operations.py} (91%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/{operations_async => operations}/__init__.py (89%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/{operations_async/_web_apps_operations_async.py => operations/_web_apps_operations.py} (93%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (90%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/{operations_async => operations}/__init__.py (77%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/{operations_async/_app_service_environments_operations_async.py => operations/_app_service_environments_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/{operations_async/_app_service_plans_operations_async.py => operations/_app_service_plans_operations.py} (93%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (78%) create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/__init__.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_app_service_certificate_orders_operations_async.py => operations/_app_service_certificate_orders_operations.py} (94%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_app_service_environments_operations_async.py => operations/_app_service_environments_operations.py} (94%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_app_service_plans_operations_async.py => operations/_app_service_plans_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_certificate_registration_provider_operations_async.py => operations/_certificate_registration_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_certificates_operations_async.py => operations/_certificates_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_deleted_web_apps_operations_async.py => operations/_deleted_web_apps_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_diagnostics_operations_async.py => operations/_diagnostics_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_domain_registration_provider_operations_async.py => operations/_domain_registration_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_domains_operations_async.py => operations/_domains_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_provider_operations_async.py => operations/_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_recommendations_operations_async.py => operations/_recommendations_operations.py} (94%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_resource_health_metadata_operations_async.py => operations/_resource_health_metadata_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_top_level_domains_operations_async.py => operations/_top_level_domains_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_web_apps_operations_async.py => operations/_web_apps_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/{operations_async/_web_site_management_client_operations_async.py => operations/_web_site_management_client_operations.py} (92%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (89%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/{operations_async => operations}/__init__.py (88%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/{operations_async/_certificates_operations_async.py => operations/_certificates_operations.py} (92%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/version.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{_configuration_async.py => _configuration.py} (95%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{_web_site_management_client_async.py => _web_site_management_client.py} (78%) create mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/__init__.py rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_app_service_certificate_orders_operations_async.py => operations/_app_service_certificate_orders_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_app_service_environments_operations_async.py => operations/_app_service_environments_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_app_service_plans_operations_async.py => operations/_app_service_plans_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_certificate_registration_provider_operations_async.py => operations/_certificate_registration_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_certificates_operations_async.py => operations/_certificates_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_deleted_web_apps_operations_async.py => operations/_deleted_web_apps_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_diagnostics_operations_async.py => operations/_diagnostics_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_domain_registration_provider_operations_async.py => operations/_domain_registration_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_domains_operations_async.py => operations/_domains_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_provider_operations_async.py => operations/_provider_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_recommendations_operations_async.py => operations/_recommendations_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_resource_health_metadata_operations_async.py => operations/_resource_health_metadata_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_static_sites_operations_async.py => operations/_static_sites_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_top_level_domains_operations_async.py => operations/_top_level_domains_operations.py} (92%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_web_apps_operations_async.py => operations/_web_apps_operations.py} (93%) rename sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/{operations_async/_web_site_management_client_operations_async.py => operations/_web_site_management_client_operations.py} (91%) delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_paged_models.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/version.py delete mode 100644 sdk/appservice/azure-mgmt-web/azure/mgmt/web/version.py diff --git a/sdk/appservice/azure-mgmt-web/CHANGELOG.md b/sdk/appservice/azure-mgmt-web/CHANGELOG.md index 2f43796ebc5a..4783ddbe945d 100644 --- a/sdk/appservice/azure-mgmt-web/CHANGELOG.md +++ b/sdk/appservice/azure-mgmt-web/CHANGELOG.md @@ -1,5 +1,54 @@ # Release History +## 1.0.0b1 (2020-10-13) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + +## 0.48.0 (2020-09-22) + +**Features** + + - Model SiteConfig has a new parameter acr_use_managed_identity_creds + - Model SiteConfig has a new parameter acr_user_managed_identity_id + - Model SiteConfigResource has a new parameter acr_use_managed_identity_creds + - Model SiteConfigResource has a new parameter acr_user_managed_identity_id + +## 0.47.0 (2020-06-03) + +**Features** + + - Added operation WebAppsOperations.get_basic_publishing_credentials_policies + - Added operation WebAppsOperations.update_scm_allowed + - Added operation WebAppsOperations.update_ftp_allowed + - Added operation WebAppsOperations.get_scm_allowed + - Added operation WebAppsOperations.get_ftp_allowed + ## 0.46.0 (2020-04-10) **Features** diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py index 61d7be50b7bf..f341e491d5ca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_configuration.py @@ -44,8 +44,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py index 5a1d28fb3c85..459bb2389bc4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py @@ -12,7 +12,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -55,7 +55,7 @@ def check_name_availability( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'check_name_availability'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -84,7 +84,7 @@ def get_publishing_user( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'get_publishing_user'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -116,7 +116,7 @@ def get_source_control( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'get_source_control'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -145,7 +145,7 @@ def get_subscription_deployment_locations( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'get_subscription_deployment_locations'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -178,7 +178,7 @@ def list_billing_meters( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_billing_meters'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -222,7 +222,7 @@ def list_geo_regions( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_geo_regions'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -251,7 +251,7 @@ def list_premier_add_on_offers( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_premier_add_on_offers'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -283,7 +283,7 @@ def list_site_identifiers_assigned_to_host_name( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_site_identifiers_assigned_to_host_name'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -312,7 +312,7 @@ def list_skus( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_skus'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -341,7 +341,7 @@ def list_source_controls( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_source_controls'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -376,7 +376,7 @@ def move( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'move'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -408,7 +408,7 @@ def update_publishing_user( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'update_publishing_user'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -443,7 +443,7 @@ def update_source_control( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'update_source_control'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -478,7 +478,7 @@ def validate( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'validate'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -509,7 +509,7 @@ def validate_container_settings( if api_version == '2018-02-01': from .v2018_02_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'validate_container_settings'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -544,7 +544,7 @@ def validate_move( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'validate_move'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -577,7 +577,7 @@ def verify_hosting_environment_vnet( elif api_version == '2019-08-01': from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'verify_hosting_environment_vnet'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py index 29fe9b397723..affaef0c987e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.46.0" +VERSION = "1.0.0b1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py index cc33df37af4d..a0c8927b2b7f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py @@ -116,7 +116,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-08-01': from .v2019_08_01 import models return models - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} is not available".format(api_version)) @property def app_service_certificate_orders(self): @@ -134,7 +134,7 @@ def app_service_certificate_orders(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import AppServiceCertificateOrdersOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'app_service_certificate_orders'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -153,7 +153,7 @@ def app_service_environments(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import AppServiceEnvironmentsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'app_service_environments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -172,7 +172,7 @@ def app_service_plans(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import AppServicePlansOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'app_service_plans'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -185,7 +185,7 @@ def billing_meters(self): if api_version == '2016-03-01': from .v2016_03_01.operations import BillingMetersOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'billing_meters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -204,7 +204,7 @@ def certificate_registration_provider(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import CertificateRegistrationProviderOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'certificate_registration_provider'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -226,7 +226,7 @@ def certificates(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import CertificatesOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + 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))) @property @@ -245,7 +245,7 @@ def deleted_web_apps(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import DeletedWebAppsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'deleted_web_apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -264,7 +264,7 @@ def diagnostics(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import DiagnosticsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'diagnostics'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -283,7 +283,7 @@ def domain_registration_provider(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import DomainRegistrationProviderOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'domain_registration_provider'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -302,7 +302,7 @@ def domains(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import DomainsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -321,7 +321,7 @@ def provider(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import ProviderOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'provider'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -340,7 +340,7 @@ def recommendations(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import RecommendationsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'recommendations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -359,7 +359,7 @@ def resource_health_metadata(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import ResourceHealthMetadataOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'resource_health_metadata'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -372,7 +372,7 @@ def static_sites(self): if api_version == '2019-08-01': from .v2019_08_01.operations import StaticSitesOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'static_sites'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -391,7 +391,7 @@ def top_level_domains(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import TopLevelDomainsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'top_level_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -410,7 +410,7 @@ def web_apps(self): elif api_version == '2019-08-01': from .v2019_08_01.operations import WebAppsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'web_apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) def close(self): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration.py similarity index 94% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration.py index 5d40887e742f..f97f7652b879 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_configuration.py @@ -35,7 +35,6 @@ def __init__( subscription_id, # type: str **kwargs # type: Any ) -> None: - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,8 +43,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin.py similarity index 76% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin.py index 5f23bcf087fd..d04ec8205aaa 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_operations_mixin.py @@ -13,7 +13,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -45,13 +45,13 @@ async def check_name_availability( """ api_version = self._get_api_version('check_name_availability') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'check_name_availability'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -74,13 +74,13 @@ async def get_publishing_user( """ api_version = self._get_api_version('get_publishing_user') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'get_publishing_user'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -106,13 +106,13 @@ async def get_source_control( """ api_version = self._get_api_version('get_source_control') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'get_source_control'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -135,13 +135,13 @@ async def get_subscription_deployment_locations( """ api_version = self._get_api_version('get_subscription_deployment_locations') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'get_subscription_deployment_locations'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -170,11 +170,11 @@ def list_billing_meters( """ api_version = self._get_api_version('list_billing_meters') if api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_billing_meters'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -212,13 +212,13 @@ def list_geo_regions( """ api_version = self._get_api_version('list_geo_regions') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_geo_regions'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -241,13 +241,13 @@ def list_premier_add_on_offers( """ api_version = self._get_api_version('list_premier_add_on_offers') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_premier_add_on_offers'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -273,13 +273,13 @@ def list_site_identifiers_assigned_to_host_name( """ api_version = self._get_api_version('list_site_identifiers_assigned_to_host_name') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_site_identifiers_assigned_to_host_name'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -302,13 +302,13 @@ async def list_skus( """ api_version = self._get_api_version('list_skus') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_skus'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -331,13 +331,13 @@ def list_source_controls( """ api_version = self._get_api_version('list_source_controls') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'list_source_controls'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -366,13 +366,13 @@ async def move( """ api_version = self._get_api_version('move') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'move'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -398,13 +398,13 @@ async def update_publishing_user( """ api_version = self._get_api_version('update_publishing_user') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'update_publishing_user'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -433,13 +433,13 @@ async def update_source_control( """ api_version = self._get_api_version('update_source_control') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'update_source_control'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -468,13 +468,13 @@ async def validate( """ api_version = self._get_api_version('validate') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'validate'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -503,9 +503,9 @@ async def validate_container_settings( """ api_version = self._get_api_version('validate_container_settings') if api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'validate_container_settings'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -534,13 +534,13 @@ async def validate_move( """ api_version = self._get_api_version('validate_move') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'validate_move'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config @@ -567,13 +567,13 @@ async def verify_hosting_environment_vnet( """ api_version = self._get_api_version('verify_hosting_environment_vnet') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2016_03_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2018_02_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebSiteManagementClientOperationsMixin as OperationClass + from ..v2019_08_01.aio.operations import WebSiteManagementClientOperationsMixin as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation 'verify_hosting_environment_vnet'".format(api_version)) mixin_instance = OperationClass() mixin_instance._client = self._client mixin_instance._config = self._config diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py similarity index 61% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py index d30508ea9041..888fdd9272f0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py @@ -14,8 +14,8 @@ from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from ._configuration_async import WebSiteManagementClientConfiguration -from ._operations_mixin_async import WebSiteManagementClientOperationsMixin +from ._configuration import WebSiteManagementClientConfiguration +from ._operations_mixin import WebSiteManagementClientOperationsMixin class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -116,301 +116,301 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-08-01': from ..v2019_08_01 import models return models - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} is not available".format(api_version)) @property def app_service_certificate_orders(self): """Instance depends on the API version: - * 2015-08-01: :class:`AppServiceCertificateOrdersOperations` - * 2018-02-01: :class:`AppServiceCertificateOrdersOperations` - * 2019-08-01: :class:`AppServiceCertificateOrdersOperations` + * 2015-08-01: :class:`AppServiceCertificateOrdersOperations` + * 2018-02-01: :class:`AppServiceCertificateOrdersOperations` + * 2019-08-01: :class:`AppServiceCertificateOrdersOperations` """ api_version = self._get_api_version('app_service_certificate_orders') if api_version == '2015-08-01': - from ..v2015_08_01.aio.operations_async import AppServiceCertificateOrdersOperations as OperationClass + from ..v2015_08_01.aio.operations import AppServiceCertificateOrdersOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import AppServiceCertificateOrdersOperations as OperationClass + from ..v2018_02_01.aio.operations import AppServiceCertificateOrdersOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import AppServiceCertificateOrdersOperations as OperationClass + from ..v2019_08_01.aio.operations import AppServiceCertificateOrdersOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'app_service_certificate_orders'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def app_service_environments(self): """Instance depends on the API version: - * 2016-09-01: :class:`AppServiceEnvironmentsOperations` - * 2018-02-01: :class:`AppServiceEnvironmentsOperations` - * 2019-08-01: :class:`AppServiceEnvironmentsOperations` + * 2016-09-01: :class:`AppServiceEnvironmentsOperations` + * 2018-02-01: :class:`AppServiceEnvironmentsOperations` + * 2019-08-01: :class:`AppServiceEnvironmentsOperations` """ api_version = self._get_api_version('app_service_environments') if api_version == '2016-09-01': - from ..v2016_09_01.aio.operations_async import AppServiceEnvironmentsOperations as OperationClass + from ..v2016_09_01.aio.operations import AppServiceEnvironmentsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import AppServiceEnvironmentsOperations as OperationClass + from ..v2018_02_01.aio.operations import AppServiceEnvironmentsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import AppServiceEnvironmentsOperations as OperationClass + from ..v2019_08_01.aio.operations import AppServiceEnvironmentsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'app_service_environments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def app_service_plans(self): """Instance depends on the API version: - * 2016-09-01: :class:`AppServicePlansOperations` - * 2018-02-01: :class:`AppServicePlansOperations` - * 2019-08-01: :class:`AppServicePlansOperations` + * 2016-09-01: :class:`AppServicePlansOperations` + * 2018-02-01: :class:`AppServicePlansOperations` + * 2019-08-01: :class:`AppServicePlansOperations` """ api_version = self._get_api_version('app_service_plans') if api_version == '2016-09-01': - from ..v2016_09_01.aio.operations_async import AppServicePlansOperations as OperationClass + from ..v2016_09_01.aio.operations import AppServicePlansOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import AppServicePlansOperations as OperationClass + from ..v2018_02_01.aio.operations import AppServicePlansOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import AppServicePlansOperations as OperationClass + from ..v2019_08_01.aio.operations import AppServicePlansOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'app_service_plans'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def billing_meters(self): """Instance depends on the API version: - * 2016-03-01: :class:`BillingMetersOperations` + * 2016-03-01: :class:`BillingMetersOperations` """ api_version = self._get_api_version('billing_meters') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import BillingMetersOperations as OperationClass + from ..v2016_03_01.aio.operations import BillingMetersOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'billing_meters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def certificate_registration_provider(self): """Instance depends on the API version: - * 2015-08-01: :class:`CertificateRegistrationProviderOperations` - * 2018-02-01: :class:`CertificateRegistrationProviderOperations` - * 2019-08-01: :class:`CertificateRegistrationProviderOperations` + * 2015-08-01: :class:`CertificateRegistrationProviderOperations` + * 2018-02-01: :class:`CertificateRegistrationProviderOperations` + * 2019-08-01: :class:`CertificateRegistrationProviderOperations` """ api_version = self._get_api_version('certificate_registration_provider') if api_version == '2015-08-01': - from ..v2015_08_01.aio.operations_async import CertificateRegistrationProviderOperations as OperationClass + from ..v2015_08_01.aio.operations import CertificateRegistrationProviderOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import CertificateRegistrationProviderOperations as OperationClass + from ..v2018_02_01.aio.operations import CertificateRegistrationProviderOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import CertificateRegistrationProviderOperations as OperationClass + from ..v2019_08_01.aio.operations import CertificateRegistrationProviderOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'certificate_registration_provider'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def certificates(self): """Instance depends on the API version: - * 2016-03-01: :class:`CertificatesOperations` - * 2018-02-01: :class:`CertificatesOperations` - * 2018-11-01: :class:`CertificatesOperations` - * 2019-08-01: :class:`CertificatesOperations` + * 2016-03-01: :class:`CertificatesOperations` + * 2018-02-01: :class:`CertificatesOperations` + * 2018-11-01: :class:`CertificatesOperations` + * 2019-08-01: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import CertificatesOperations as OperationClass + from ..v2016_03_01.aio.operations import CertificatesOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import CertificatesOperations as OperationClass + from ..v2018_02_01.aio.operations import CertificatesOperations as OperationClass elif api_version == '2018-11-01': - from ..v2018_11_01.aio.operations_async import CertificatesOperations as OperationClass + from ..v2018_11_01.aio.operations import CertificatesOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import CertificatesOperations as OperationClass + from ..v2019_08_01.aio.operations import CertificatesOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + 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))) @property def deleted_web_apps(self): """Instance depends on the API version: - * 2016-03-01: :class:`DeletedWebAppsOperations` - * 2018-02-01: :class:`DeletedWebAppsOperations` - * 2019-08-01: :class:`DeletedWebAppsOperations` + * 2016-03-01: :class:`DeletedWebAppsOperations` + * 2018-02-01: :class:`DeletedWebAppsOperations` + * 2019-08-01: :class:`DeletedWebAppsOperations` """ api_version = self._get_api_version('deleted_web_apps') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import DeletedWebAppsOperations as OperationClass + from ..v2016_03_01.aio.operations import DeletedWebAppsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import DeletedWebAppsOperations as OperationClass + from ..v2018_02_01.aio.operations import DeletedWebAppsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import DeletedWebAppsOperations as OperationClass + from ..v2019_08_01.aio.operations import DeletedWebAppsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'deleted_web_apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def diagnostics(self): """Instance depends on the API version: - * 2016-03-01: :class:`DiagnosticsOperations` - * 2018-02-01: :class:`DiagnosticsOperations` - * 2019-08-01: :class:`DiagnosticsOperations` + * 2016-03-01: :class:`DiagnosticsOperations` + * 2018-02-01: :class:`DiagnosticsOperations` + * 2019-08-01: :class:`DiagnosticsOperations` """ api_version = self._get_api_version('diagnostics') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import DiagnosticsOperations as OperationClass + from ..v2016_03_01.aio.operations import DiagnosticsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import DiagnosticsOperations as OperationClass + from ..v2018_02_01.aio.operations import DiagnosticsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import DiagnosticsOperations as OperationClass + from ..v2019_08_01.aio.operations import DiagnosticsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'diagnostics'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def domain_registration_provider(self): """Instance depends on the API version: - * 2015-04-01: :class:`DomainRegistrationProviderOperations` - * 2018-02-01: :class:`DomainRegistrationProviderOperations` - * 2019-08-01: :class:`DomainRegistrationProviderOperations` + * 2015-04-01: :class:`DomainRegistrationProviderOperations` + * 2018-02-01: :class:`DomainRegistrationProviderOperations` + * 2019-08-01: :class:`DomainRegistrationProviderOperations` """ api_version = self._get_api_version('domain_registration_provider') if api_version == '2015-04-01': - from ..v2015_04_01.aio.operations_async import DomainRegistrationProviderOperations as OperationClass + from ..v2015_04_01.aio.operations import DomainRegistrationProviderOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import DomainRegistrationProviderOperations as OperationClass + from ..v2018_02_01.aio.operations import DomainRegistrationProviderOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import DomainRegistrationProviderOperations as OperationClass + from ..v2019_08_01.aio.operations import DomainRegistrationProviderOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'domain_registration_provider'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def domains(self): """Instance depends on the API version: - * 2015-04-01: :class:`DomainsOperations` - * 2018-02-01: :class:`DomainsOperations` - * 2019-08-01: :class:`DomainsOperations` + * 2015-04-01: :class:`DomainsOperations` + * 2018-02-01: :class:`DomainsOperations` + * 2019-08-01: :class:`DomainsOperations` """ api_version = self._get_api_version('domains') if api_version == '2015-04-01': - from ..v2015_04_01.aio.operations_async import DomainsOperations as OperationClass + from ..v2015_04_01.aio.operations import DomainsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import DomainsOperations as OperationClass + from ..v2018_02_01.aio.operations import DomainsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import DomainsOperations as OperationClass + from ..v2019_08_01.aio.operations import DomainsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def provider(self): """Instance depends on the API version: - * 2016-03-01: :class:`ProviderOperations` - * 2018-02-01: :class:`ProviderOperations` - * 2019-08-01: :class:`ProviderOperations` + * 2016-03-01: :class:`ProviderOperations` + * 2018-02-01: :class:`ProviderOperations` + * 2019-08-01: :class:`ProviderOperations` """ api_version = self._get_api_version('provider') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import ProviderOperations as OperationClass + from ..v2016_03_01.aio.operations import ProviderOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import ProviderOperations as OperationClass + from ..v2018_02_01.aio.operations import ProviderOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import ProviderOperations as OperationClass + from ..v2019_08_01.aio.operations import ProviderOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'provider'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def recommendations(self): """Instance depends on the API version: - * 2016-03-01: :class:`RecommendationsOperations` - * 2018-02-01: :class:`RecommendationsOperations` - * 2019-08-01: :class:`RecommendationsOperations` + * 2016-03-01: :class:`RecommendationsOperations` + * 2018-02-01: :class:`RecommendationsOperations` + * 2019-08-01: :class:`RecommendationsOperations` """ api_version = self._get_api_version('recommendations') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import RecommendationsOperations as OperationClass + from ..v2016_03_01.aio.operations import RecommendationsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import RecommendationsOperations as OperationClass + from ..v2018_02_01.aio.operations import RecommendationsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import RecommendationsOperations as OperationClass + from ..v2019_08_01.aio.operations import RecommendationsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'recommendations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def resource_health_metadata(self): """Instance depends on the API version: - * 2016-03-01: :class:`ResourceHealthMetadataOperations` - * 2018-02-01: :class:`ResourceHealthMetadataOperations` - * 2019-08-01: :class:`ResourceHealthMetadataOperations` + * 2016-03-01: :class:`ResourceHealthMetadataOperations` + * 2018-02-01: :class:`ResourceHealthMetadataOperations` + * 2019-08-01: :class:`ResourceHealthMetadataOperations` """ api_version = self._get_api_version('resource_health_metadata') if api_version == '2016-03-01': - from ..v2016_03_01.aio.operations_async import ResourceHealthMetadataOperations as OperationClass + from ..v2016_03_01.aio.operations import ResourceHealthMetadataOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import ResourceHealthMetadataOperations as OperationClass + from ..v2018_02_01.aio.operations import ResourceHealthMetadataOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import ResourceHealthMetadataOperations as OperationClass + from ..v2019_08_01.aio.operations import ResourceHealthMetadataOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'resource_health_metadata'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def static_sites(self): """Instance depends on the API version: - * 2019-08-01: :class:`StaticSitesOperations` + * 2019-08-01: :class:`StaticSitesOperations` """ api_version = self._get_api_version('static_sites') if api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import StaticSitesOperations as OperationClass + from ..v2019_08_01.aio.operations import StaticSitesOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'static_sites'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def top_level_domains(self): """Instance depends on the API version: - * 2015-04-01: :class:`TopLevelDomainsOperations` - * 2018-02-01: :class:`TopLevelDomainsOperations` - * 2019-08-01: :class:`TopLevelDomainsOperations` + * 2015-04-01: :class:`TopLevelDomainsOperations` + * 2018-02-01: :class:`TopLevelDomainsOperations` + * 2019-08-01: :class:`TopLevelDomainsOperations` """ api_version = self._get_api_version('top_level_domains') if api_version == '2015-04-01': - from ..v2015_04_01.aio.operations_async import TopLevelDomainsOperations as OperationClass + from ..v2015_04_01.aio.operations import TopLevelDomainsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import TopLevelDomainsOperations as OperationClass + from ..v2018_02_01.aio.operations import TopLevelDomainsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import TopLevelDomainsOperations as OperationClass + from ..v2019_08_01.aio.operations import TopLevelDomainsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'top_level_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def web_apps(self): """Instance depends on the API version: - * 2016-08-01: :class:`WebAppsOperations` - * 2018-02-01: :class:`WebAppsOperations` - * 2019-08-01: :class:`WebAppsOperations` + * 2016-08-01: :class:`WebAppsOperations` + * 2018-02-01: :class:`WebAppsOperations` + * 2019-08-01: :class:`WebAppsOperations` """ api_version = self._get_api_version('web_apps') if api_version == '2016-08-01': - from ..v2016_08_01.aio.operations_async import WebAppsOperations as OperationClass + from ..v2016_08_01.aio.operations import WebAppsOperations as OperationClass elif api_version == '2018-02-01': - from ..v2018_02_01.aio.operations_async import WebAppsOperations as OperationClass + from ..v2018_02_01.aio.operations import WebAppsOperations as OperationClass elif api_version == '2019-08-01': - from ..v2019_08_01.aio.operations_async import WebAppsOperations as OperationClass + from ..v2019_08_01.aio.operations import WebAppsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} does not have operation group 'web_apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) async def close(self): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py index c6bbb427afa6..0c813892959a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2015-04-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json index 5c1ff30004ed..657938cb4d56 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": true }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "domains": "DomainsOperations", diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py index 3263c3a15c69..7cefb42cf100 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py @@ -56,6 +56,7 @@ def __init__( 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.domains = DomainsOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration.py index 43dfb09376f5..4ef3d8640866 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2015-04-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py similarity index 87% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py index 749e590c018b..37713a67e53c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py @@ -15,10 +15,10 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import DomainsOperations -from .operations_async import TopLevelDomainsOperations -from .operations_async import DomainRegistrationProviderOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import DomainsOperations +from .operations import TopLevelDomainsOperations +from .operations import DomainRegistrationProviderOperations from .. import models @@ -26,11 +26,11 @@ class WebSiteManagementClient(object): """WebSite Management Client. :ivar domains: DomainsOperations operations - :vartype domains: azure.mgmt.web.v2015_04_01.aio.operations_async.DomainsOperations + :vartype domains: azure.mgmt.web.v2015_04_01.aio.operations.DomainsOperations :ivar top_level_domains: TopLevelDomainsOperations operations - :vartype top_level_domains: azure.mgmt.web.v2015_04_01.aio.operations_async.TopLevelDomainsOperations + :vartype top_level_domains: azure.mgmt.web.v2015_04_01.aio.operations.TopLevelDomainsOperations :ivar domain_registration_provider: DomainRegistrationProviderOperations operations - :vartype domain_registration_provider: azure.mgmt.web.v2015_04_01.aio.operations_async.DomainRegistrationProviderOperations + :vartype domain_registration_provider: azure.mgmt.web.v2015_04_01.aio.operations.DomainRegistrationProviderOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). @@ -53,6 +53,7 @@ def __init__( 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.domains = DomainsOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/__init__.py similarity index 71% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/__init__.py index 50bf5a700aa7..ab719ee73294 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/__init__.py @@ -6,9 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._domains_operations_async import DomainsOperations -from ._top_level_domains_operations_async import TopLevelDomainsOperations -from ._domain_registration_provider_operations_async import DomainRegistrationProviderOperations +from ._domains_operations import DomainsOperations +from ._top_level_domains_operations import TopLevelDomainsOperations +from ._domain_registration_provider_operations import DomainRegistrationProviderOperations __all__ = [ 'DomainsOperations', diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py index 4e73d2f88444..4b5663fefe9b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domain_registration_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -56,14 +56,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py index 926da2d9e699..220945509049 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_domains_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -60,10 +60,13 @@ async def check_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_availability.metadata['url'] # type: ignore @@ -79,13 +82,12 @@ async def check_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') 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 @@ -115,14 +117,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -180,9 +185,12 @@ async def get_control_center_sso_request( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get_control_center_sso_request.metadata['url'] # type: ignore @@ -197,7 +205,7 @@ async def get_control_center_sso_request( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -232,16 +240,19 @@ def list_recommendations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -258,7 +269,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -266,7 +276,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -310,14 +319,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -382,9 +394,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -401,7 +416,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -427,10 +442,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Domain": cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -448,13 +466,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') 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 @@ -565,7 +582,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" @@ -623,10 +642,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -644,13 +666,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') 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 @@ -690,14 +711,17 @@ def list_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -766,9 +790,12 @@ async def get_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get_ownership_identifier.metadata['url'] # type: ignore @@ -786,7 +813,7 @@ async def get_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -831,10 +858,13 @@ async def create_or_update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore @@ -853,13 +883,12 @@ async def create_or_update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -898,7 +927,9 @@ async def delete_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" @@ -959,10 +990,13 @@ async def update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ownership_identifier.metadata['url'] # type: ignore @@ -981,13 +1015,12 @@ async def update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -1023,9 +1056,12 @@ async def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.renew.metadata['url'] # type: ignore @@ -1042,6 +1078,7 @@ async def renew( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py index b19e900abd6c..90091c400ecb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations_async/_top_level_domains_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -123,9 +126,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -141,7 +147,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -179,16 +185,19 @@ def list_agreements( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,7 +215,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -214,7 +222,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_paged_models.py deleted file mode 100644 index 8a4a1bd39281..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_paged_models.py +++ /dev/null @@ -1,92 +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 msrest.paging import Paged - - -class DomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`Domain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Domain]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainPaged, self).__init__(*args, **kwargs) -class NameIdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`NameIdentifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[NameIdentifier]'} - } - - def __init__(self, *args, **kwargs): - - super(NameIdentifierPaged, self).__init__(*args, **kwargs) -class DomainOwnershipIdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`DomainOwnershipIdentifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainOwnershipIdentifierPaged, self).__init__(*args, **kwargs) -class TopLevelDomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`TopLevelDomain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TopLevelDomain]'} - } - - def __init__(self, *args, **kwargs): - - super(TopLevelDomainPaged, self).__init__(*args, **kwargs) -class TldLegalAgreementPaged(Paged): - """ - A paging container for iterating over a list of :class:`TldLegalAgreement ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TldLegalAgreement]'} - } - - def __init__(self, *args, **kwargs): - - super(TldLegalAgreementPaged, self).__init__(*args, **kwargs) -class CsmOperationDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmOperationDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmOperationDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmOperationDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py index d471245e4f0b..713272730b2c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -61,14 +61,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py index 2ba62ddcfb86..22448951f604 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -65,10 +65,13 @@ def check_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_availability.metadata['url'] # type: ignore @@ -84,13 +87,12 @@ def check_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') 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 @@ -121,14 +123,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -187,9 +192,12 @@ def get_control_center_sso_request( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get_control_center_sso_request.metadata['url'] # type: ignore @@ -204,7 +212,7 @@ def get_control_center_sso_request( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -240,16 +248,19 @@ def list_recommendations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -266,7 +277,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -274,7 +284,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -319,14 +328,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -392,9 +404,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -411,7 +426,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -438,10 +453,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Domain" cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -459,13 +477,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') 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 @@ -578,7 +595,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" @@ -637,10 +656,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -658,13 +680,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') 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 @@ -705,14 +726,17 @@ def list_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -782,9 +806,12 @@ def get_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get_ownership_identifier.metadata['url'] # type: ignore @@ -802,7 +829,7 @@ def get_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -848,10 +875,13 @@ def create_or_update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore @@ -870,13 +900,12 @@ def create_or_update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -916,7 +945,9 @@ def delete_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" @@ -978,10 +1009,13 @@ def update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ownership_identifier.metadata['url'] # type: ignore @@ -1000,13 +1034,12 @@ def update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -1043,9 +1076,12 @@ def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.renew.metadata['url'] # type: ignore @@ -1062,6 +1098,7 @@ def renew( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py index 850452f62c5a..3cb9ee1556ef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -129,9 +132,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -147,7 +153,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -186,16 +192,19 @@ def list_agreements( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-04-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -213,7 +222,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -221,7 +229,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py index b90edb7045d6..ee2eeb612b3a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2015-08-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json index ef0a01ba2d38..9dd972debace 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": true }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "app_service_certificate_orders": "AppServiceCertificateOrdersOperations", diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py index 9716d61f52a9..1ee5b598adce 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py @@ -53,6 +53,7 @@ def __init__( 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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration.py index 3c95c55bc9bb..f7000d37df1b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2015-08-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py similarity index 88% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py index aa153b08b90f..ebae2b89ec2c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py @@ -15,9 +15,9 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import AppServiceCertificateOrdersOperations -from .operations_async import CertificateRegistrationProviderOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import AppServiceCertificateOrdersOperations +from .operations import CertificateRegistrationProviderOperations from .. import models @@ -25,9 +25,9 @@ class WebSiteManagementClient(object): """WebSite Management Client. :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations - :vartype app_service_certificate_orders: azure.mgmt.web.v2015_08_01.aio.operations_async.AppServiceCertificateOrdersOperations + :vartype app_service_certificate_orders: azure.mgmt.web.v2015_08_01.aio.operations.AppServiceCertificateOrdersOperations :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations - :vartype certificate_registration_provider: azure.mgmt.web.v2015_08_01.aio.operations_async.CertificateRegistrationProviderOperations + :vartype certificate_registration_provider: azure.mgmt.web.v2015_08_01.aio.operations.CertificateRegistrationProviderOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). @@ -50,6 +50,7 @@ def __init__( 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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/__init__.py similarity index 73% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__init__.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/__init__.py index 721731261c24..e2bcdf59c15b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/__init__.py @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._app_service_certificate_orders_operations_async import AppServiceCertificateOrdersOperations -from ._certificate_registration_provider_operations_async import CertificateRegistrationProviderOperations +from ._app_service_certificate_orders_operations import AppServiceCertificateOrdersOperations +from ._certificate_registration_provider_operations import CertificateRegistrationProviderOperations __all__ = [ 'AppServiceCertificateOrdersOperations', diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py similarity index 94% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py index de0a51c2f8df..a0ebf6d3d578 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -125,7 +128,9 @@ async def validate_purchase_information( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -149,7 +154,6 @@ async def validate_purchase_information( body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') 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 @@ -179,14 +183,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -251,9 +258,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -270,7 +280,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -296,10 +306,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServiceCertificateOrder": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -317,13 +330,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') 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 @@ -430,7 +442,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -486,10 +500,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -507,13 +524,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') 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 @@ -553,14 +569,17 @@ def list_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -629,9 +648,12 @@ async def get_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.get_certificate.metadata['url'] # type: ignore @@ -649,7 +671,7 @@ async def get_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -676,10 +698,13 @@ async def _create_or_update_certificate_initial( **kwargs ) -> "models.AppServiceCertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore @@ -698,13 +723,12 @@ async def _create_or_update_certificate_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') 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 @@ -818,7 +842,9 @@ async def delete_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -878,10 +904,13 @@ async def update_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_certificate.metadata['url'] # type: ignore @@ -900,13 +929,12 @@ async def update_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') 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 @@ -949,7 +977,9 @@ async def reissue( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -975,7 +1005,6 @@ async def reissue( body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') 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 @@ -1011,7 +1040,9 @@ async def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -1037,7 +1068,6 @@ async def renew( body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') 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 @@ -1070,7 +1100,9 @@ async def resend_email( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -1126,7 +1158,9 @@ async def resend_request_emails( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -1152,7 +1186,6 @@ async def resend_request_emails( body_content = self._serialize.body(name_identifier, 'NameIdentifier') 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 @@ -1188,10 +1221,13 @@ async def retrieve_site_seal( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.retrieve_site_seal.metadata['url'] # type: ignore @@ -1209,13 +1245,12 @@ async def retrieve_site_seal( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') 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 @@ -1251,7 +1286,9 @@ async def verify_domain_ownership( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -1304,9 +1341,12 @@ async def retrieve_certificate_actions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_actions.metadata['url'] # type: ignore @@ -1323,7 +1363,7 @@ async def retrieve_certificate_actions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1361,9 +1401,12 @@ async def retrieve_certificate_email_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore @@ -1380,7 +1423,7 @@ async def retrieve_certificate_email_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py index f863a5b700c6..0632c5d3976f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -56,14 +56,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_paged_models.py deleted file mode 100644 index b3350494ff67..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/models/_paged_models.py +++ /dev/null @@ -1,53 +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 msrest.paging import Paged - - -class AppServiceCertificateOrderPaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceCertificateOrder ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceCertificateOrder]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceCertificateOrderPaged, self).__init__(*args, **kwargs) -class AppServiceCertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceCertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceCertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceCertificateResourcePaged, self).__init__(*args, **kwargs) -class CsmOperationDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmOperationDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmOperationDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmOperationDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py index 25edf6ae7bf9..9777b47b8e2a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -131,7 +134,9 @@ def validate_purchase_information( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -155,7 +160,6 @@ def validate_purchase_information( body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') 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 @@ -186,14 +190,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -259,9 +266,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -278,7 +288,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -305,10 +315,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServiceCertificateOrder" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -326,13 +339,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') 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 @@ -441,7 +453,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -498,10 +512,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -519,13 +536,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') 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 @@ -566,14 +582,17 @@ def list_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -643,9 +662,12 @@ def get_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.get_certificate.metadata['url'] # type: ignore @@ -663,7 +685,7 @@ def get_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -691,10 +713,13 @@ def _create_or_update_certificate_initial( ): # type: (...) -> "models.AppServiceCertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore @@ -713,13 +738,12 @@ def _create_or_update_certificate_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') 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 @@ -835,7 +859,9 @@ def delete_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -896,10 +922,13 @@ def update_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_certificate.metadata['url'] # type: ignore @@ -918,13 +947,12 @@ def update_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') 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 @@ -968,7 +996,9 @@ def reissue( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -994,7 +1024,6 @@ def reissue( body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') 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 @@ -1031,7 +1060,9 @@ def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -1057,7 +1088,6 @@ def renew( body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') 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 @@ -1091,7 +1121,9 @@ def resend_email( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -1148,7 +1180,9 @@ def resend_request_emails( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -1174,7 +1208,6 @@ def resend_request_emails( body_content = self._serialize.body(name_identifier, 'NameIdentifier') 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 @@ -1211,10 +1244,13 @@ def retrieve_site_seal( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.retrieve_site_seal.metadata['url'] # type: ignore @@ -1232,13 +1268,12 @@ def retrieve_site_seal( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') 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 @@ -1275,7 +1310,9 @@ def verify_domain_ownership( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" @@ -1329,9 +1366,12 @@ def retrieve_certificate_actions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_actions.metadata['url'] # type: ignore @@ -1348,7 +1388,7 @@ def retrieve_certificate_actions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1387,9 +1427,12 @@ def retrieve_certificate_email_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore @@ -1406,7 +1449,7 @@ def retrieve_certificate_email_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py index 46417c5d85dc..533067013abf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -61,14 +61,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2015-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py index 07123d6a065d..7c90c5f7b8fc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2016-03-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json index af6b14917c95..e56219c29e00 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": false }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "certificates": "CertificatesOperations", @@ -239,6 +241,6 @@ "call": "resource_group_name, move_resource_envelope" } }, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py index 1c09432d5467..6e021e301fae 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py @@ -51,7 +51,6 @@ class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( @@ -69,6 +68,7 @@ def __init__( 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.certificates = CertificatesOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration.py index 09db47eb5785..80c223878906 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2016-03-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py similarity index 81% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py index f9e020d49719..a4d6e17a67db 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py @@ -15,15 +15,15 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import CertificatesOperations -from .operations_async import DeletedWebAppsOperations -from .operations_async import DiagnosticsOperations -from .operations_async import ProviderOperations -from .operations_async import RecommendationsOperations -from .operations_async import ResourceHealthMetadataOperations -from .operations_async import WebSiteManagementClientOperationsMixin -from .operations_async import BillingMetersOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import CertificatesOperations +from .operations import DeletedWebAppsOperations +from .operations import DiagnosticsOperations +from .operations import ProviderOperations +from .operations import RecommendationsOperations +from .operations import ResourceHealthMetadataOperations +from .operations import WebSiteManagementClientOperationsMixin +from .operations import BillingMetersOperations from .. import models @@ -31,25 +31,24 @@ class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): """WebSite Management Client. :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.web.v2016_03_01.aio.operations_async.CertificatesOperations + :vartype certificates: azure.mgmt.web.v2016_03_01.aio.operations.CertificatesOperations :ivar deleted_web_apps: DeletedWebAppsOperations operations - :vartype deleted_web_apps: azure.mgmt.web.v2016_03_01.aio.operations_async.DeletedWebAppsOperations + :vartype deleted_web_apps: azure.mgmt.web.v2016_03_01.aio.operations.DeletedWebAppsOperations :ivar diagnostics: DiagnosticsOperations operations - :vartype diagnostics: azure.mgmt.web.v2016_03_01.aio.operations_async.DiagnosticsOperations + :vartype diagnostics: azure.mgmt.web.v2016_03_01.aio.operations.DiagnosticsOperations :ivar provider: ProviderOperations operations - :vartype provider: azure.mgmt.web.v2016_03_01.aio.operations_async.ProviderOperations + :vartype provider: azure.mgmt.web.v2016_03_01.aio.operations.ProviderOperations :ivar recommendations: RecommendationsOperations operations - :vartype recommendations: azure.mgmt.web.v2016_03_01.aio.operations_async.RecommendationsOperations + :vartype recommendations: azure.mgmt.web.v2016_03_01.aio.operations.RecommendationsOperations :ivar resource_health_metadata: ResourceHealthMetadataOperations operations - :vartype resource_health_metadata: azure.mgmt.web.v2016_03_01.aio.operations_async.ResourceHealthMetadataOperations + :vartype resource_health_metadata: azure.mgmt.web.v2016_03_01.aio.operations.ResourceHealthMetadataOperations :ivar billing_meters: BillingMetersOperations operations - :vartype billing_meters: azure.mgmt.web.v2016_03_01.aio.operations_async.BillingMetersOperations + :vartype billing_meters: azure.mgmt.web.v2016_03_01.aio.operations.BillingMetersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( @@ -66,6 +65,7 @@ def __init__( 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.certificates = CertificatesOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/__init__.py similarity index 56% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/__init__.py index 89f3db21535c..48bbadb98d0b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/__init__.py @@ -6,14 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._certificates_operations_async import CertificatesOperations -from ._deleted_web_apps_operations_async import DeletedWebAppsOperations -from ._diagnostics_operations_async import DiagnosticsOperations -from ._provider_operations_async import ProviderOperations -from ._recommendations_operations_async import RecommendationsOperations -from ._resource_health_metadata_operations_async import ResourceHealthMetadataOperations -from ._web_site_management_client_operations_async import WebSiteManagementClientOperationsMixin -from ._billing_meters_operations_async import BillingMetersOperations +from ._certificates_operations import CertificatesOperations +from ._deleted_web_apps_operations import DeletedWebAppsOperations +from ._diagnostics_operations import DiagnosticsOperations +from ._provider_operations import ProviderOperations +from ._recommendations_operations import RecommendationsOperations +from ._resource_health_metadata_operations import ResourceHealthMetadataOperations +from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin +from ._billing_meters_operations import BillingMetersOperations __all__ = [ 'CertificatesOperations', diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py index 7596ee8db723..623369b13e28 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_billing_meters_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -58,14 +58,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py index cba0d93325c7..c6c6e8f0925d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_certificates_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -123,14 +126,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -195,9 +201,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -214,7 +223,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -255,10 +264,13 @@ async def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -276,13 +288,12 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -318,7 +329,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -374,10 +387,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -395,13 +411,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py index 3017d6dd5027..3bc27561a094 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_deleted_web_apps_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py index 6da046b8e32e..4ab28098702e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_diagnostics_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py @@ -10,7 +10,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -62,14 +62,17 @@ def list_hosting_environment_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -147,9 +150,12 @@ async def get_hosting_environment_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore @@ -173,7 +179,7 @@ async def get_hosting_environment_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -211,14 +217,17 @@ def list_site_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -296,9 +305,12 @@ async def get_site_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response.metadata['url'] # type: ignore @@ -322,7 +334,7 @@ async def get_site_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -360,14 +372,17 @@ def list_site_diagnostic_categories( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -436,9 +451,12 @@ async def get_site_diagnostic_category( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category.metadata['url'] # type: ignore @@ -456,7 +474,7 @@ async def get_site_diagnostic_category( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -497,14 +515,17 @@ def list_site_analyses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -577,9 +598,12 @@ async def get_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_analysis.metadata['url'] # type: ignore @@ -598,7 +622,7 @@ async def get_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -651,9 +675,12 @@ async def execute_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis.metadata['url'] # type: ignore @@ -678,7 +705,7 @@ async def execute_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -719,14 +746,17 @@ def list_site_detectors( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -799,14 +829,17 @@ def get_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -889,9 +922,12 @@ async def execute_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_detector.metadata['url'] # type: ignore @@ -916,7 +952,7 @@ async def execute_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -957,14 +993,17 @@ def list_site_detector_responses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1046,9 +1085,12 @@ async def get_site_detector_response_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response_slot.metadata['url'] # type: ignore @@ -1073,7 +1115,7 @@ async def get_site_detector_response_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1114,14 +1156,17 @@ def list_site_diagnostic_categories_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1194,9 +1239,12 @@ async def get_site_diagnostic_category_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore @@ -1215,7 +1263,7 @@ async def get_site_diagnostic_category_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1259,14 +1307,17 @@ def list_site_analyses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1343,9 +1394,12 @@ async def get_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_analysis_slot.metadata['url'] # type: ignore @@ -1365,7 +1419,7 @@ async def get_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1421,9 +1475,12 @@ async def execute_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis_slot.metadata['url'] # type: ignore @@ -1449,7 +1506,7 @@ async def execute_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1493,14 +1550,17 @@ def list_site_detectors_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1577,14 +1637,17 @@ def get_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1671,9 +1734,12 @@ async def execute_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_detector_slot.metadata['url'] # type: ignore @@ -1699,7 +1765,7 @@ async def execute_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py index fd786c8a95d0..c00a4a7b9655 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -58,14 +58,17 @@ def get_available_stacks( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -122,14 +125,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -186,14 +192,17 @@ def get_available_stacks_on_prem( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py similarity index 94% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py index a2d50d1d83cd..9fd63d5e3ff4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_recommendations_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -64,14 +64,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -133,7 +136,9 @@ async def reset_all_filters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -181,7 +186,9 @@ async def disable_recommendation_for_subscription( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -238,14 +245,17 @@ def list_history_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -321,14 +331,17 @@ def list_recommended_rules_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -398,7 +411,9 @@ async def disable_all_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -451,7 +466,9 @@ async def reset_all_filters_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -515,9 +532,12 @@ async def get_rule_details_by_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore @@ -539,7 +559,7 @@ async def get_rule_details_by_web_app( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -580,7 +600,9 @@ async def disable_recommendation_for_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py index 7f6bdb379c40..5c56a73f96df 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_resource_health_metadata_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,14 +203,17 @@ def list_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -271,9 +280,12 @@ async def get_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_by_site.metadata['url'] # type: ignore @@ -290,7 +302,7 @@ async def get_by_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -332,14 +344,17 @@ def list_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -410,9 +425,12 @@ async def get_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_by_site_slot.metadata['url'] # type: ignore @@ -430,7 +448,7 @@ async def get_by_site_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py similarity index 91% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py index 5226c0052afe..192d5e31bdca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations_async/_web_site_management_client_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -35,9 +35,12 @@ async def get_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_publishing_user.metadata['url'] # type: ignore @@ -48,7 +51,7 @@ async def get_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -83,10 +86,13 @@ async def update_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_publishing_user.metadata['url'] # type: ignore @@ -98,13 +104,12 @@ async def update_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') 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 @@ -134,14 +139,17 @@ def list_source_controls( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -198,9 +206,12 @@ async def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -215,7 +226,7 @@ async def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -253,10 +264,13 @@ async def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -272,13 +286,12 @@ async def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') 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 @@ -317,12 +330,15 @@ async def check_name_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_name_availability.metadata['url'] # type: ignore @@ -338,13 +354,12 @@ async def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') 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 @@ -374,9 +389,12 @@ async def get_subscription_deployment_locations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore @@ -391,7 +409,7 @@ async def get_subscription_deployment_locations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -430,14 +448,17 @@ def list_geo_regions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -502,16 +523,19 @@ def list_site_identifiers_assigned_to_host_name( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -528,7 +552,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -536,7 +559,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -577,14 +599,17 @@ def list_premier_add_on_offers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -642,9 +667,12 @@ async def list_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.list_skus.metadata['url'] # type: ignore @@ -659,7 +687,7 @@ async def list_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -695,10 +723,13 @@ async def verify_hosting_environment_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore @@ -714,13 +745,12 @@ async def verify_hosting_environment_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') 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 @@ -756,7 +786,9 @@ async def move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") @@ -781,7 +813,6 @@ async def move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 @@ -814,10 +845,13 @@ async def validate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate.metadata['url'] # type: ignore @@ -834,13 +868,12 @@ async def validate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') 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 @@ -876,7 +909,9 @@ async def validate_move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") @@ -901,7 +936,6 @@ async def validate_move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_paged_models.py deleted file mode 100644 index 9b44d6574fcc..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/models/_paged_models.py +++ /dev/null @@ -1,209 +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 msrest.paging import Paged - - -class CertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`Certificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Certificate]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificatePaged, self).__init__(*args, **kwargs) -class DeletedSitePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSite ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSite]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSitePaged, self).__init__(*args, **kwargs) -class DetectorResponsePaged(Paged): - """ - A paging container for iterating over a list of :class:`DetectorResponse ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DetectorResponse]'} - } - - def __init__(self, *args, **kwargs): - - super(DetectorResponsePaged, self).__init__(*args, **kwargs) -class DiagnosticCategoryPaged(Paged): - """ - A paging container for iterating over a list of :class:`DiagnosticCategory ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DiagnosticCategory]'} - } - - def __init__(self, *args, **kwargs): - - super(DiagnosticCategoryPaged, self).__init__(*args, **kwargs) -class AnalysisDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`AnalysisDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AnalysisDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(AnalysisDefinitionPaged, self).__init__(*args, **kwargs) -class DetectorDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`DetectorDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DetectorDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(DetectorDefinitionPaged, self).__init__(*args, **kwargs) -class ApplicationStackPaged(Paged): - """ - A paging container for iterating over a list of :class:`ApplicationStack ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ApplicationStack]'} - } - - def __init__(self, *args, **kwargs): - - super(ApplicationStackPaged, self).__init__(*args, **kwargs) -class CsmOperationDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmOperationDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmOperationDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmOperationDescriptionPaged, self).__init__(*args, **kwargs) -class RecommendationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Recommendation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Recommendation]'} - } - - def __init__(self, *args, **kwargs): - - super(RecommendationPaged, self).__init__(*args, **kwargs) -class ResourceHealthMetadataPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceHealthMetadata ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceHealthMetadata]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceHealthMetadataPaged, self).__init__(*args, **kwargs) -class SourceControlPaged(Paged): - """ - A paging container for iterating over a list of :class:`SourceControl ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SourceControl]'} - } - - def __init__(self, *args, **kwargs): - - super(SourceControlPaged, self).__init__(*args, **kwargs) -class GeoRegionPaged(Paged): - """ - A paging container for iterating over a list of :class:`GeoRegion ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[GeoRegion]'} - } - - def __init__(self, *args, **kwargs): - - super(GeoRegionPaged, self).__init__(*args, **kwargs) -class IdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`Identifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Identifier]'} - } - - def __init__(self, *args, **kwargs): - - super(IdentifierPaged, self).__init__(*args, **kwargs) -class PremierAddOnOfferPaged(Paged): - """ - A paging container for iterating over a list of :class:`PremierAddOnOffer ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PremierAddOnOffer]'} - } - - def __init__(self, *args, **kwargs): - - super(PremierAddOnOfferPaged, self).__init__(*args, **kwargs) -class BillingMeterPaged(Paged): - """ - A paging container for iterating over a list of :class:`BillingMeter ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BillingMeter]'} - } - - def __init__(self, *args, **kwargs): - - super(BillingMeterPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py index 61bef816adf8..3e1bb5ceec29 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -63,14 +63,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py index c7224a89d592..62a473333e37 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -129,14 +132,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -202,9 +208,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -221,7 +230,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -263,10 +272,13 @@ def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -284,13 +296,12 @@ def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -327,7 +338,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -384,10 +397,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -405,13 +421,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py index aaf573be8c25..3d909dd3eb43 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py index df093fb21397..773da0a9a598 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -67,14 +67,17 @@ def list_hosting_environment_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -153,9 +156,12 @@ def get_hosting_environment_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore @@ -179,7 +185,7 @@ def get_hosting_environment_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -218,14 +224,17 @@ def list_site_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -304,9 +313,12 @@ def get_site_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response.metadata['url'] # type: ignore @@ -330,7 +342,7 @@ def get_site_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -369,14 +381,17 @@ def list_site_diagnostic_categories( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -446,9 +461,12 @@ def get_site_diagnostic_category( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category.metadata['url'] # type: ignore @@ -466,7 +484,7 @@ def get_site_diagnostic_category( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -508,14 +526,17 @@ def list_site_analyses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -589,9 +610,12 @@ def get_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_analysis.metadata['url'] # type: ignore @@ -610,7 +634,7 @@ def get_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -664,9 +688,12 @@ def execute_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis.metadata['url'] # type: ignore @@ -691,7 +718,7 @@ def execute_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -733,14 +760,17 @@ def list_site_detectors( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -814,14 +844,17 @@ def get_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -905,9 +938,12 @@ def execute_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_detector.metadata['url'] # type: ignore @@ -932,7 +968,7 @@ def execute_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -974,14 +1010,17 @@ def list_site_detector_responses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1064,9 +1103,12 @@ def get_site_detector_response_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response_slot.metadata['url'] # type: ignore @@ -1091,7 +1133,7 @@ def get_site_detector_response_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1133,14 +1175,17 @@ def list_site_diagnostic_categories_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1214,9 +1259,12 @@ def get_site_diagnostic_category_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore @@ -1235,7 +1283,7 @@ def get_site_diagnostic_category_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1280,14 +1328,17 @@ def list_site_analyses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1365,9 +1416,12 @@ def get_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_site_analysis_slot.metadata['url'] # type: ignore @@ -1387,7 +1441,7 @@ def get_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1444,9 +1498,12 @@ def execute_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis_slot.metadata['url'] # type: ignore @@ -1472,7 +1529,7 @@ def execute_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1517,14 +1574,17 @@ def list_site_detectors_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1602,14 +1662,17 @@ def get_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1697,9 +1760,12 @@ def execute_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.execute_site_detector_slot.metadata['url'] # type: ignore @@ -1725,7 +1791,7 @@ def execute_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py index 94e82f0c364f..8fb8f415be13 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -63,14 +63,17 @@ def get_available_stacks( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -128,14 +131,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -193,14 +199,17 @@ def get_available_stacks_on_prem( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py index c483e0c56473..4fde56015421 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -69,14 +69,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -139,7 +142,9 @@ def reset_all_filters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -188,7 +193,9 @@ def disable_recommendation_for_subscription( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -246,14 +253,17 @@ def list_history_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -330,14 +340,17 @@ def list_recommended_rules_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -408,7 +421,9 @@ def disable_all_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -462,7 +477,9 @@ def reset_all_filters_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" @@ -527,9 +544,12 @@ def get_rule_details_by_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore @@ -551,7 +571,7 @@ def get_rule_details_by_web_app( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -593,7 +613,9 @@ def disable_recommendation_for_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py index 3043c773cb37..4f1ac3d1bd23 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,14 +210,17 @@ def list_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -279,9 +288,12 @@ def get_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_by_site.metadata['url'] # type: ignore @@ -298,7 +310,7 @@ def get_by_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -341,14 +353,17 @@ def list_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -420,9 +435,12 @@ def get_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_by_site_slot.metadata['url'] # type: ignore @@ -440,7 +458,7 @@ def get_by_site_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py index 3986fd0ed3ad..b3aafc206876 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -40,9 +40,12 @@ def get_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_publishing_user.metadata['url'] # type: ignore @@ -53,7 +56,7 @@ def get_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -89,10 +92,13 @@ def update_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_publishing_user.metadata['url'] # type: ignore @@ -104,13 +110,12 @@ def update_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') 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 @@ -141,14 +146,17 @@ def list_source_controls( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,9 +214,12 @@ def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -223,7 +234,7 @@ def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -262,10 +273,13 @@ def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -281,13 +295,12 @@ def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') 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 @@ -327,12 +340,15 @@ def check_name_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_name_availability.metadata['url'] # type: ignore @@ -348,13 +364,12 @@ def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') 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 @@ -385,9 +400,12 @@ def get_subscription_deployment_locations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore @@ -402,7 +420,7 @@ def get_subscription_deployment_locations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -442,14 +460,17 @@ def list_geo_regions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -515,16 +536,19 @@ def list_site_identifiers_assigned_to_host_name( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -541,7 +565,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -549,7 +572,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -591,14 +613,17 @@ def list_premier_add_on_offers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -657,9 +682,12 @@ def list_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.list_skus.metadata['url'] # type: ignore @@ -674,7 +702,7 @@ def list_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -711,10 +739,13 @@ def verify_hosting_environment_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore @@ -730,13 +761,12 @@ def verify_hosting_environment_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') 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 @@ -773,7 +803,9 @@ def move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") @@ -798,7 +830,6 @@ def move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 @@ -832,10 +863,13 @@ def validate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate.metadata['url'] # type: ignore @@ -852,13 +886,12 @@ def validate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') 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 @@ -895,7 +928,9 @@ def validate_move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" content_type = kwargs.pop("content_type", "application/json") @@ -920,7 +955,6 @@ def validate_move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py index 6bb47e26649f..34859d13f251 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2016-08-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json index e6da136924e2..7750822cc7be 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": true }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "web_apps": "WebAppsOperations" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py index ac0df08e7cb7..025c3a938760 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py @@ -50,6 +50,7 @@ def __init__( 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.web_apps = WebAppsOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration.py index a268aa73d52f..86a3e099a91f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2016-08-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py index e4a4f3702f85..0abdf804568b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py @@ -15,8 +15,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import WebAppsOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import WebAppsOperations from .. import models @@ -24,7 +24,7 @@ class WebSiteManagementClient(object): """WebSite Management Client. :ivar web_apps: WebAppsOperations operations - :vartype web_apps: azure.mgmt.web.v2016_08_01.aio.operations_async.WebAppsOperations + :vartype web_apps: azure.mgmt.web.v2016_08_01.aio.operations.WebAppsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). @@ -47,6 +47,7 @@ def __init__( 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.web_apps = WebAppsOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/__init__.py similarity index 89% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/__init__.py index cd4c84b8c270..fd3b4d38e9ea 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_apps_operations_async import WebAppsOperations +from ._web_apps_operations import WebAppsOperations __all__ = [ 'WebAppsOperations', diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py index e8c462f9816b..47c53e30a371 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations_async/_web_apps_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -129,14 +132,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -203,9 +209,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -222,7 +231,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -250,10 +259,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Site": cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -271,13 +283,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -393,7 +404,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -455,10 +468,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -476,13 +492,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -525,9 +540,12 @@ async def analyze_custom_hostname( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname.metadata['url'] # type: ignore @@ -546,7 +564,7 @@ async def analyze_custom_hostname( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -587,7 +605,9 @@ async def apply_slot_config_to_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -613,7 +633,6 @@ async def apply_slot_config_to_production( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -650,10 +669,13 @@ async def backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup.metadata['url'] # type: ignore @@ -671,13 +693,12 @@ async def backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -713,14 +734,17 @@ def list_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -790,10 +814,13 @@ async def discover_restore( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_restore.metadata['url'] # type: ignore @@ -811,13 +838,12 @@ async def discover_restore( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -856,9 +882,12 @@ async def get_backup_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status.metadata['url'] # type: ignore @@ -876,7 +905,7 @@ async def get_backup_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -917,7 +946,9 @@ async def delete_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -979,10 +1010,13 @@ async def list_backup_status_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets.metadata['url'] # type: ignore @@ -1001,13 +1035,12 @@ async def list_backup_status_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1032,10 +1065,13 @@ async def _restore_initial( **kwargs ) -> "models.RestoreResponse": cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_initial.metadata['url'] # type: ignore @@ -1054,13 +1090,12 @@ async def _restore_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -1167,14 +1202,17 @@ def list_configurations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1243,10 +1281,13 @@ async def update_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings.metadata['url'] # type: ignore @@ -1264,13 +1305,12 @@ async def update_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1306,9 +1346,12 @@ async def list_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings.metadata['url'] # type: ignore @@ -1325,7 +1368,7 @@ async def list_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1366,10 +1409,13 @@ async def update_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings.metadata['url'] # type: ignore @@ -1387,13 +1433,12 @@ async def update_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -1429,9 +1474,12 @@ async def get_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings.metadata['url'] # type: ignore @@ -1448,7 +1496,7 @@ async def get_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1489,10 +1537,13 @@ async def update_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration.metadata['url'] # type: ignore @@ -1510,13 +1561,12 @@ async def update_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1552,7 +1602,9 @@ async def delete_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -1605,9 +1657,12 @@ async def get_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration.metadata['url'] # type: ignore @@ -1624,7 +1679,7 @@ async def get_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1665,10 +1720,13 @@ async def update_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings.metadata['url'] # type: ignore @@ -1686,13 +1744,12 @@ async def update_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -1728,9 +1785,12 @@ async def list_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings.metadata['url'] # type: ignore @@ -1747,7 +1807,7 @@ async def list_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1785,9 +1845,12 @@ async def get_diagnostic_logs_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore @@ -1804,7 +1867,7 @@ async def get_diagnostic_logs_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1846,10 +1909,13 @@ async def update_diagnostic_logs_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore @@ -1867,13 +1933,12 @@ async def update_diagnostic_logs_config( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -1912,10 +1977,13 @@ async def update_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata.metadata['url'] # type: ignore @@ -1933,13 +2001,12 @@ async def update_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -1975,9 +2042,12 @@ async def list_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_metadata.metadata['url'] # type: ignore @@ -1994,7 +2064,7 @@ async def list_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2019,9 +2089,12 @@ async def _list_publishing_credentials_initial( **kwargs ) -> "models.User": cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore @@ -2038,7 +2111,7 @@ async def _list_publishing_credentials_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2142,10 +2215,13 @@ async def update_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings.metadata['url'] # type: ignore @@ -2163,13 +2239,12 @@ async def update_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -2205,9 +2280,12 @@ async def list_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings.metadata['url'] # type: ignore @@ -2224,7 +2302,7 @@ async def list_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2262,9 +2340,12 @@ async def list_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_slot_configuration_names.metadata['url'] # type: ignore @@ -2281,7 +2362,7 @@ async def list_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2323,10 +2404,13 @@ async def update_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot_configuration_names.metadata['url'] # type: ignore @@ -2344,13 +2428,12 @@ async def update_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') 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 @@ -2387,9 +2470,12 @@ async def get_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration.metadata['url'] # type: ignore @@ -2406,7 +2492,7 @@ async def get_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2447,10 +2533,13 @@ async def create_or_update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration.metadata['url'] # type: ignore @@ -2468,13 +2557,12 @@ async def create_or_update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2513,10 +2601,13 @@ async def update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration.metadata['url'] # type: ignore @@ -2534,13 +2625,12 @@ async def update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2577,14 +2667,17 @@ def list_configuration_snapshot_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2653,9 +2746,12 @@ async def get_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot.metadata['url'] # type: ignore @@ -2673,7 +2769,7 @@ async def get_configuration_snapshot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2714,7 +2810,9 @@ async def recover_site_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -2768,9 +2866,12 @@ async def get_web_site_container_logs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs.metadata['url'] # type: ignore @@ -2787,7 +2888,7 @@ async def get_web_site_container_logs( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -2827,9 +2928,12 @@ async def get_web_site_container_logs_zip( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/zip" # Construct URL url = self.get_web_site_container_logs_zip.metadata['url'] # type: ignore @@ -2846,7 +2950,7 @@ async def get_web_site_container_logs_zip( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -2886,14 +2990,17 @@ def list_continuous_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2962,9 +3069,12 @@ async def get_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job.metadata['url'] # type: ignore @@ -2982,7 +3092,7 @@ async def get_continuous_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3025,7 +3135,9 @@ async def delete_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3082,7 +3194,9 @@ async def start_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3139,7 +3253,9 @@ async def stop_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3193,14 +3309,17 @@ def list_deployments( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3269,9 +3388,12 @@ async def get_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_deployment.metadata['url'] # type: ignore @@ -3289,7 +3411,7 @@ async def get_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3333,10 +3455,13 @@ async def create_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment.metadata['url'] # type: ignore @@ -3355,13 +3480,12 @@ async def create_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -3400,7 +3524,9 @@ async def delete_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3458,9 +3584,12 @@ async def list_deployment_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log.metadata['url'] # type: ignore @@ -3478,7 +3607,7 @@ async def list_deployment_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3516,14 +3645,17 @@ def list_domain_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3592,9 +3724,12 @@ async def get_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3612,7 +3747,7 @@ async def get_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3656,10 +3791,13 @@ async def create_or_update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3678,13 +3816,12 @@ async def create_or_update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -3723,7 +3860,9 @@ async def delete_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3783,10 +3922,13 @@ async def update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3805,13 +3947,12 @@ async def update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -3847,9 +3988,12 @@ async def get_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status.metadata['url'] # type: ignore @@ -3866,7 +4010,7 @@ async def get_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3892,10 +4036,13 @@ async def _create_ms_deploy_operation_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -3913,13 +4060,12 @@ async def _create_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -4024,9 +4170,12 @@ async def get_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log.metadata['url'] # type: ignore @@ -4043,7 +4192,7 @@ async def get_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4083,14 +4232,17 @@ def list_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4156,9 +4308,12 @@ async def get_functions_admin_token( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token.metadata['url'] # type: ignore @@ -4175,7 +4330,7 @@ async def get_functions_admin_token( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4216,9 +4371,12 @@ async def get_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_function.metadata['url'] # type: ignore @@ -4236,7 +4394,7 @@ async def get_function( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4265,10 +4423,13 @@ async def _create_function_initial( **kwargs ) -> "models.FunctionEnvelope": cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_function_initial.metadata['url'] # type: ignore @@ -4287,13 +4448,12 @@ async def _create_function_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -4403,7 +4563,9 @@ async def delete_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -4460,9 +4622,12 @@ async def list_function_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets.metadata['url'] # type: ignore @@ -4480,7 +4645,7 @@ async def list_function_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4518,14 +4683,17 @@ def list_host_name_bindings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4594,9 +4762,12 @@ async def get_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding.metadata['url'] # type: ignore @@ -4614,7 +4785,7 @@ async def get_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4659,10 +4830,13 @@ async def create_or_update_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore @@ -4681,13 +4855,12 @@ async def create_or_update_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -4726,7 +4899,9 @@ async def delete_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -4786,9 +4961,12 @@ async def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -4807,7 +4985,7 @@ async def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4854,10 +5032,13 @@ async def create_or_update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore @@ -4877,13 +5058,12 @@ async def create_or_update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -4925,7 +5105,9 @@ async def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -4989,10 +5171,13 @@ async def update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection.metadata['url'] # type: ignore @@ -5012,13 +5197,12 @@ async def update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5060,9 +5244,12 @@ async def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -5081,7 +5268,7 @@ async def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5119,9 +5306,12 @@ async def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections.metadata['url'] # type: ignore @@ -5138,7 +5328,7 @@ async def list_hybrid_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5176,9 +5366,12 @@ async def list_relay_service_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections.metadata['url'] # type: ignore @@ -5195,7 +5388,7 @@ async def list_relay_service_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5236,9 +5429,12 @@ async def get_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection.metadata['url'] # type: ignore @@ -5256,7 +5452,7 @@ async def get_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5300,10 +5496,13 @@ async def create_or_update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore @@ -5322,13 +5521,12 @@ async def create_or_update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -5367,7 +5565,9 @@ async def delete_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -5427,10 +5627,13 @@ async def update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection.metadata['url'] # type: ignore @@ -5449,13 +5652,12 @@ async def update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -5491,14 +5693,17 @@ def list_instance_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5567,9 +5772,12 @@ async def get_instance_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore @@ -5587,7 +5795,7 @@ async def get_instance_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5614,10 +5822,13 @@ async def _create_instance_ms_deploy_operation_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -5636,13 +5847,12 @@ async def _create_instance_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -5754,9 +5964,12 @@ async def get_instance_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore @@ -5774,7 +5987,7 @@ async def get_instance_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5819,14 +6032,17 @@ def list_instance_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5900,9 +6116,12 @@ async def get_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process.metadata['url'] # type: ignore @@ -5921,7 +6140,7 @@ async def get_instance_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5969,7 +6188,9 @@ async def delete_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -6031,9 +6252,12 @@ async def get_instance_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump.metadata['url'] # type: ignore @@ -6052,7 +6276,7 @@ async def get_instance_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -6100,14 +6324,17 @@ def list_instance_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6185,9 +6412,12 @@ async def get_instance_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module.metadata['url'] # type: ignore @@ -6207,7 +6437,7 @@ async def get_instance_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6254,14 +6484,17 @@ def list_instance_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6340,9 +6573,12 @@ async def get_instance_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread.metadata['url'] # type: ignore @@ -6362,7 +6598,7 @@ async def get_instance_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6402,9 +6638,12 @@ async def is_cloneable( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable.metadata['url'] # type: ignore @@ -6421,7 +6660,7 @@ async def is_cloneable( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6459,9 +6698,12 @@ async def list_sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers.metadata['url'] # type: ignore @@ -6478,7 +6720,7 @@ async def list_sync_function_triggers( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6516,14 +6758,17 @@ def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6599,14 +6844,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6665,10 +6913,13 @@ async def _migrate_storage_initial( **kwargs ) -> "models.StorageMigrationResponse": cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_storage_initial.metadata['url'] # type: ignore @@ -6687,13 +6938,12 @@ async def _migrate_storage_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') 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 @@ -6788,10 +7038,13 @@ async def _migrate_my_sql_initial( **kwargs ) -> "models.Operation": cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_my_sql_initial.metadata['url'] # type: ignore @@ -6809,13 +7062,12 @@ async def _migrate_my_sql_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') 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 @@ -6919,9 +7171,12 @@ async def get_migrate_my_sql_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore @@ -6938,7 +7193,7 @@ async def get_migrate_my_sql_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6979,9 +7234,12 @@ async def list_network_features( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_network_features.metadata['url'] # type: ignore @@ -6999,7 +7257,7 @@ async def list_network_features( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7048,9 +7306,12 @@ async def start_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace.metadata['url'] # type: ignore @@ -7073,7 +7334,7 @@ async def start_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7111,9 +7372,12 @@ async def stop_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace.metadata['url'] # type: ignore @@ -7130,7 +7394,7 @@ async def stop_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7168,7 +7432,9 @@ async def generate_new_site_publishing_password( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -7226,14 +7492,17 @@ def list_perf_mon_counters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7301,9 +7570,12 @@ async def get_site_php_error_log_flag( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore @@ -7320,7 +7592,7 @@ async def get_site_php_error_log_flag( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7358,9 +7630,12 @@ async def list_premier_add_ons( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons.metadata['url'] # type: ignore @@ -7377,7 +7652,7 @@ async def list_premier_add_ons( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7418,9 +7693,12 @@ async def get_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on.metadata['url'] # type: ignore @@ -7438,7 +7716,7 @@ async def get_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7482,10 +7760,13 @@ async def add_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on.metadata['url'] # type: ignore @@ -7504,13 +7785,12 @@ async def add_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -7549,7 +7829,9 @@ async def delete_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -7604,14 +7886,17 @@ def list_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7680,9 +7965,12 @@ async def get_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process.metadata['url'] # type: ignore @@ -7700,7 +7988,7 @@ async def get_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7744,7 +8032,9 @@ async def delete_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -7801,9 +8091,12 @@ async def get_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump.metadata['url'] # type: ignore @@ -7821,7 +8114,7 @@ async def get_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -7865,14 +8158,17 @@ def list_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7945,9 +8241,12 @@ async def get_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_module.metadata['url'] # type: ignore @@ -7966,7 +8265,7 @@ async def get_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8009,14 +8308,17 @@ def list_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8090,9 +8392,12 @@ async def get_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_thread.metadata['url'] # type: ignore @@ -8111,7 +8416,7 @@ async def get_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8151,14 +8456,17 @@ def list_public_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8227,9 +8535,12 @@ async def get_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate.metadata['url'] # type: ignore @@ -8247,7 +8558,7 @@ async def get_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8292,10 +8603,13 @@ async def create_or_update_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate.metadata['url'] # type: ignore @@ -8314,13 +8628,12 @@ async def create_or_update_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -8359,7 +8672,9 @@ async def delete_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -8417,10 +8732,13 @@ async def list_publishing_profile_xml_with_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore @@ -8438,13 +8756,12 @@ async def list_publishing_profile_xml_with_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -8468,7 +8785,9 @@ async def _recover_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -8494,7 +8813,6 @@ async def _recover_initial( body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') 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 @@ -8593,7 +8911,9 @@ async def reset_production_slot_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -8654,7 +8974,9 @@ async def restart( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -8711,14 +9033,17 @@ def list_site_extensions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8787,9 +9112,12 @@ async def get_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension.metadata['url'] # type: ignore @@ -8807,7 +9135,7 @@ async def get_site_extension( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8835,9 +9163,12 @@ async def _install_site_extension_initial( **kwargs ) -> Optional["models.SiteExtensionInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_initial.metadata['url'] # type: ignore @@ -8855,7 +9186,7 @@ async def _install_site_extension_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -8968,7 +9299,9 @@ async def delete_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -9022,14 +9355,17 @@ def list_slots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9098,9 +9434,12 @@ async def get_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_slot.metadata['url'] # type: ignore @@ -9118,7 +9457,7 @@ async def get_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9151,10 +9490,13 @@ async def _create_or_update_slot_initial( **kwargs ) -> "models.Site": cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_slot_initial.metadata['url'] # type: ignore @@ -9181,13 +9523,12 @@ async def _create_or_update_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -9335,7 +9676,9 @@ async def delete_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -9419,10 +9762,13 @@ async def update_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot.metadata['url'] # type: ignore @@ -9449,13 +9795,12 @@ async def update_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -9501,9 +9846,12 @@ async def analyze_custom_hostname_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore @@ -9523,7 +9871,7 @@ async def analyze_custom_hostname_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9568,7 +9916,9 @@ async def apply_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -9595,7 +9945,6 @@ async def apply_slot_configuration_slot( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -9636,10 +9985,13 @@ async def backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup_slot.metadata['url'] # type: ignore @@ -9658,13 +10010,12 @@ async def backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -9704,14 +10055,17 @@ def list_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9786,10 +10140,13 @@ async def discover_restore_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_restore_slot.metadata['url'] # type: ignore @@ -9808,13 +10165,12 @@ async def discover_restore_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -9857,9 +10213,12 @@ async def get_backup_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status_slot.metadata['url'] # type: ignore @@ -9878,7 +10237,7 @@ async def get_backup_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9923,7 +10282,9 @@ async def delete_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -9989,10 +10350,13 @@ async def list_backup_status_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore @@ -10012,13 +10376,12 @@ async def list_backup_status_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -10044,10 +10407,13 @@ async def _restore_slot_initial( **kwargs ) -> "models.RestoreResponse": cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_slot_initial.metadata['url'] # type: ignore @@ -10067,13 +10433,12 @@ async def _restore_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10189,14 +10554,17 @@ def list_configurations_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10270,10 +10638,13 @@ async def update_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings_slot.metadata['url'] # type: ignore @@ -10292,13 +10663,12 @@ async def update_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -10338,9 +10708,12 @@ async def list_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings_slot.metadata['url'] # type: ignore @@ -10358,7 +10731,7 @@ async def list_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10402,10 +10775,13 @@ async def update_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings_slot.metadata['url'] # type: ignore @@ -10424,13 +10800,12 @@ async def update_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -10470,9 +10845,12 @@ async def get_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings_slot.metadata['url'] # type: ignore @@ -10490,7 +10868,7 @@ async def get_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10535,10 +10913,13 @@ async def update_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration_slot.metadata['url'] # type: ignore @@ -10557,13 +10938,12 @@ async def update_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -10603,7 +10983,9 @@ async def delete_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -10661,9 +11043,12 @@ async def get_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration_slot.metadata['url'] # type: ignore @@ -10681,7 +11066,7 @@ async def get_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10726,10 +11111,13 @@ async def update_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings_slot.metadata['url'] # type: ignore @@ -10748,13 +11136,12 @@ async def update_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -10794,9 +11181,12 @@ async def list_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings_slot.metadata['url'] # type: ignore @@ -10814,7 +11204,7 @@ async def list_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10856,9 +11246,12 @@ async def get_diagnostic_logs_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore @@ -10876,7 +11269,7 @@ async def get_diagnostic_logs_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10922,10 +11315,13 @@ async def update_diagnostic_logs_config_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore @@ -10944,13 +11340,12 @@ async def update_diagnostic_logs_config_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -10993,10 +11388,13 @@ async def update_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata_slot.metadata['url'] # type: ignore @@ -11015,13 +11413,12 @@ async def update_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -11061,9 +11458,12 @@ async def list_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_metadata_slot.metadata['url'] # type: ignore @@ -11081,7 +11481,7 @@ async def list_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11107,9 +11507,12 @@ async def _list_publishing_credentials_slot_initial( **kwargs ) -> "models.User": cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore @@ -11127,7 +11530,7 @@ async def _list_publishing_credentials_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11239,10 +11642,13 @@ async def update_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings_slot.metadata['url'] # type: ignore @@ -11261,13 +11667,12 @@ async def update_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -11306,9 +11711,12 @@ async def list_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings_slot.metadata['url'] # type: ignore @@ -11326,7 +11734,7 @@ async def list_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11369,9 +11777,12 @@ async def get_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_slot.metadata['url'] # type: ignore @@ -11389,7 +11800,7 @@ async def get_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11434,10 +11845,13 @@ async def create_or_update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore @@ -11456,13 +11870,12 @@ async def create_or_update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -11505,10 +11918,13 @@ async def update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration_slot.metadata['url'] # type: ignore @@ -11527,13 +11943,12 @@ async def update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -11574,14 +11989,17 @@ def list_configuration_snapshot_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11655,9 +12073,12 @@ async def get_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -11676,7 +12097,7 @@ async def get_configuration_snapshot_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11721,7 +12142,9 @@ async def recover_site_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -11779,9 +12202,12 @@ async def get_web_site_container_logs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore @@ -11799,7 +12225,7 @@ async def get_web_site_container_logs_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -11842,9 +12268,12 @@ async def get_web_site_container_logs_zip_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/zip" # Construct URL url = self.get_web_site_container_logs_zip_slot.metadata['url'] # type: ignore @@ -11862,7 +12291,7 @@ async def get_web_site_container_logs_zip_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -11906,14 +12335,17 @@ def list_continuous_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11987,9 +12419,12 @@ async def get_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore @@ -12008,7 +12443,7 @@ async def get_continuous_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12055,7 +12490,9 @@ async def delete_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12117,7 +12554,9 @@ async def start_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12179,7 +12618,9 @@ async def stop_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12238,14 +12679,17 @@ def list_deployments_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12319,9 +12763,12 @@ async def get_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_deployment_slot.metadata['url'] # type: ignore @@ -12340,7 +12787,7 @@ async def get_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12388,10 +12835,13 @@ async def create_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment_slot.metadata['url'] # type: ignore @@ -12411,13 +12861,12 @@ async def create_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -12460,7 +12909,9 @@ async def delete_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12523,9 +12974,12 @@ async def list_deployment_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log_slot.metadata['url'] # type: ignore @@ -12544,7 +12998,7 @@ async def list_deployment_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12586,14 +13040,17 @@ def list_domain_ownership_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12667,9 +13124,12 @@ async def get_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -12688,7 +13148,7 @@ async def get_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12736,10 +13196,13 @@ async def create_or_update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -12759,13 +13222,12 @@ async def create_or_update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -12808,7 +13270,9 @@ async def delete_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12873,10 +13337,13 @@ async def update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -12896,13 +13363,12 @@ async def update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -12941,9 +13407,12 @@ async def get_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -12961,7 +13430,7 @@ async def get_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12988,10 +13457,13 @@ async def _create_ms_deploy_operation_slot_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -13010,13 +13482,12 @@ async def _create_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -13128,9 +13599,12 @@ async def get_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -13148,7 +13622,7 @@ async def get_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13192,14 +13666,17 @@ def list_instance_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13269,9 +13746,12 @@ async def get_functions_admin_token_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore @@ -13289,7 +13769,7 @@ async def get_functions_admin_token_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13334,9 +13814,12 @@ async def get_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_function_slot.metadata['url'] # type: ignore @@ -13355,7 +13838,7 @@ async def get_instance_function_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13385,10 +13868,13 @@ async def _create_instance_function_slot_initial( **kwargs ) -> "models.FunctionEnvelope": cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore @@ -13408,13 +13894,12 @@ async def _create_instance_function_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -13533,7 +14018,9 @@ async def delete_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -13595,9 +14082,12 @@ async def list_function_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets_slot.metadata['url'] # type: ignore @@ -13616,7 +14106,7 @@ async def list_function_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13658,14 +14148,17 @@ def list_host_name_bindings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13739,9 +14232,12 @@ async def get_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding_slot.metadata['url'] # type: ignore @@ -13760,7 +14256,7 @@ async def get_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13809,10 +14305,13 @@ async def create_or_update_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore @@ -13832,13 +14331,12 @@ async def create_or_update_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -13881,7 +14379,9 @@ async def delete_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -13945,9 +14445,12 @@ async def get_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore @@ -13967,7 +14470,7 @@ async def get_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14017,10 +14520,13 @@ async def create_or_update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -14041,13 +14547,12 @@ async def create_or_update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -14092,7 +14597,9 @@ async def delete_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -14160,10 +14667,13 @@ async def update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -14184,13 +14694,12 @@ async def update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -14235,9 +14744,12 @@ async def list_hybrid_connection_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore @@ -14257,7 +14769,7 @@ async def list_hybrid_connection_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14298,9 +14810,12 @@ async def list_hybrid_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore @@ -14318,7 +14833,7 @@ async def list_hybrid_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14360,9 +14875,12 @@ async def list_relay_service_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore @@ -14380,7 +14898,7 @@ async def list_relay_service_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14425,9 +14943,12 @@ async def get_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore @@ -14446,7 +14967,7 @@ async def get_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14494,10 +15015,13 @@ async def create_or_update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -14517,13 +15041,12 @@ async def create_or_update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -14566,7 +15089,9 @@ async def delete_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -14631,10 +15156,13 @@ async def update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -14654,13 +15182,12 @@ async def update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -14700,14 +15227,17 @@ def list_instance_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14780,9 +15310,12 @@ async def get_instance_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -14801,7 +15334,7 @@ async def get_instance_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14829,10 +15362,13 @@ async def _create_instance_ms_deploy_operation_slot_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -14852,13 +15388,12 @@ async def _create_instance_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -14977,9 +15512,12 @@ async def get_instance_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -14998,7 +15536,7 @@ async def get_instance_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15047,14 +15585,17 @@ def list_instance_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15133,9 +15674,12 @@ async def get_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_slot.metadata['url'] # type: ignore @@ -15155,7 +15699,7 @@ async def get_instance_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15207,7 +15751,9 @@ async def delete_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -15274,9 +15820,12 @@ async def get_instance_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore @@ -15296,7 +15845,7 @@ async def get_instance_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -15348,14 +15897,17 @@ def list_instance_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15438,9 +15990,12 @@ async def get_instance_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module_slot.metadata['url'] # type: ignore @@ -15461,7 +16016,7 @@ async def get_instance_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15512,14 +16067,17 @@ def list_instance_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15603,9 +16161,12 @@ async def get_instance_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore @@ -15626,7 +16187,7 @@ async def get_instance_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15670,9 +16231,12 @@ async def is_cloneable_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable_slot.metadata['url'] # type: ignore @@ -15690,7 +16254,7 @@ async def is_cloneable_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15732,9 +16296,12 @@ async def list_sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore @@ -15752,7 +16319,7 @@ async def list_sync_function_triggers_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15794,14 +16361,17 @@ def list_metric_definitions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15882,14 +16452,17 @@ def list_metrics_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15964,9 +16537,12 @@ async def get_migrate_my_sql_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore @@ -15984,7 +16560,7 @@ async def get_migrate_my_sql_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16029,9 +16605,12 @@ async def list_network_features_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_network_features_slot.metadata['url'] # type: ignore @@ -16050,7 +16629,7 @@ async def list_network_features_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16102,9 +16681,12 @@ async def start_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -16128,7 +16710,7 @@ async def start_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16169,9 +16751,12 @@ async def stop_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -16189,7 +16774,7 @@ async def stop_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16231,7 +16816,9 @@ async def generate_new_site_publishing_password_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -16293,14 +16880,17 @@ def list_perf_mon_counters_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16372,9 +16962,12 @@ async def get_site_php_error_log_flag_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore @@ -16392,7 +16985,7 @@ async def get_site_php_error_log_flag_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16434,9 +17027,12 @@ async def list_premier_add_ons_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore @@ -16454,7 +17050,7 @@ async def list_premier_add_ons_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16499,9 +17095,12 @@ async def get_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on_slot.metadata['url'] # type: ignore @@ -16520,7 +17119,7 @@ async def get_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16568,10 +17167,13 @@ async def add_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on_slot.metadata['url'] # type: ignore @@ -16591,13 +17193,12 @@ async def add_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -16640,7 +17241,9 @@ async def delete_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -16700,14 +17303,17 @@ def list_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16781,9 +17387,12 @@ async def get_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_slot.metadata['url'] # type: ignore @@ -16802,7 +17411,7 @@ async def get_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16850,7 +17459,9 @@ async def delete_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -16912,9 +17523,12 @@ async def get_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump_slot.metadata['url'] # type: ignore @@ -16933,7 +17547,7 @@ async def get_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -16981,14 +17595,17 @@ def list_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17066,9 +17683,12 @@ async def get_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_module_slot.metadata['url'] # type: ignore @@ -17088,7 +17708,7 @@ async def get_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17135,14 +17755,17 @@ def list_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17221,9 +17844,12 @@ async def get_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_thread_slot.metadata['url'] # type: ignore @@ -17243,7 +17869,7 @@ async def get_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17287,14 +17913,17 @@ def list_public_certificates_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17368,9 +17997,12 @@ async def get_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate_slot.metadata['url'] # type: ignore @@ -17389,7 +18021,7 @@ async def get_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17438,10 +18070,13 @@ async def create_or_update_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore @@ -17461,13 +18096,12 @@ async def create_or_update_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -17510,7 +18144,9 @@ async def delete_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -17573,10 +18209,13 @@ async def list_publishing_profile_xml_with_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore @@ -17595,13 +18234,12 @@ async def list_publishing_profile_xml_with_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -17626,7 +18264,9 @@ async def _recover_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -17653,7 +18293,6 @@ async def _recover_slot_initial( body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') 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 @@ -17760,7 +18399,9 @@ async def reset_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -17826,7 +18467,9 @@ async def restart_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -17888,14 +18531,17 @@ def list_site_extensions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17969,9 +18615,12 @@ async def get_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension_slot.metadata['url'] # type: ignore @@ -17990,7 +18639,7 @@ async def get_site_extension_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18019,9 +18668,12 @@ async def _install_site_extension_slot_initial( **kwargs ) -> Optional["models.SiteExtensionInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore @@ -18040,7 +18692,7 @@ async def _install_site_extension_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -18162,7 +18814,9 @@ async def delete_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18224,16 +18878,19 @@ def list_slot_differences_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18253,7 +18910,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -18261,7 +18917,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -18297,7 +18952,9 @@ async def _swap_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -18324,7 +18981,6 @@ async def _swap_slot_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -18429,14 +19085,17 @@ def list_snapshots_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18507,9 +19166,12 @@ async def get_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_source_control_slot.metadata['url'] # type: ignore @@ -18527,7 +19189,7 @@ async def get_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18561,10 +19223,13 @@ async def _create_or_update_source_control_slot_initial( **kwargs ) -> "models.SiteSourceControl": cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore @@ -18583,13 +19248,12 @@ async def _create_or_update_source_control_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -18708,7 +19372,9 @@ async def delete_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18769,10 +19435,13 @@ async def update_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control_slot.metadata['url'] # type: ignore @@ -18791,13 +19460,12 @@ async def update_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -18841,7 +19509,9 @@ async def start_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18899,7 +19569,9 @@ async def stop_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18956,7 +19628,9 @@ async def sync_repository_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19014,7 +19688,9 @@ async def sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19072,14 +19748,17 @@ def list_triggered_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19153,9 +19832,12 @@ async def get_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore @@ -19174,7 +19856,7 @@ async def get_triggered_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19221,7 +19903,9 @@ async def delete_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19283,14 +19967,17 @@ def list_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19368,9 +20055,12 @@ async def get_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore @@ -19390,7 +20080,7 @@ async def get_triggered_web_job_history_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19437,7 +20127,9 @@ async def run_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19502,14 +20194,17 @@ def list_usages_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19582,9 +20277,12 @@ async def list_vnet_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections_slot.metadata['url'] # type: ignore @@ -19602,7 +20300,7 @@ async def list_vnet_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19647,9 +20345,12 @@ async def get_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_slot.metadata['url'] # type: ignore @@ -19668,7 +20369,7 @@ async def get_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19717,10 +20418,13 @@ async def create_or_update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore @@ -19740,13 +20444,12 @@ async def create_or_update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -19789,7 +20492,9 @@ async def delete_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19855,10 +20560,13 @@ async def update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_slot.metadata['url'] # type: ignore @@ -19878,13 +20586,12 @@ async def update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -19930,9 +20637,12 @@ async def get_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -19952,7 +20662,7 @@ async def get_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20005,10 +20715,13 @@ async def create_or_update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -20029,13 +20742,12 @@ async def create_or_update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -20084,10 +20796,13 @@ async def update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -20108,13 +20823,12 @@ async def update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -20154,14 +20868,17 @@ def list_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20235,9 +20952,12 @@ async def get_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_web_job_slot.metadata['url'] # type: ignore @@ -20256,7 +20976,7 @@ async def get_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20297,16 +21017,19 @@ def list_slot_differences_from_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20325,7 +21048,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -20333,7 +21055,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -20368,7 +21089,9 @@ async def _swap_slot_with_production_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -20394,7 +21117,6 @@ async def _swap_slot_with_production_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -20491,14 +21213,17 @@ def list_snapshots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20564,9 +21289,12 @@ async def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -20583,7 +21311,7 @@ async def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20616,10 +21344,13 @@ async def _create_or_update_source_control_initial( **kwargs ) -> "models.SiteSourceControl": cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore @@ -20637,13 +21368,12 @@ async def _create_or_update_source_control_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -20753,7 +21483,9 @@ async def delete_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -20809,10 +21541,13 @@ async def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -20830,13 +21565,12 @@ async def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -20876,7 +21610,9 @@ async def start( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -20929,7 +21665,9 @@ async def stop( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -20982,7 +21720,9 @@ async def sync_repository( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21035,7 +21775,9 @@ async def sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21088,14 +21830,17 @@ def list_triggered_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21164,9 +21909,12 @@ async def get_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job.metadata['url'] # type: ignore @@ -21184,7 +21932,7 @@ async def get_triggered_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21227,7 +21975,9 @@ async def delete_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21284,14 +22034,17 @@ def list_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21364,9 +22117,12 @@ async def get_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history.metadata['url'] # type: ignore @@ -21385,7 +22141,7 @@ async def get_triggered_web_job_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21428,7 +22184,9 @@ async def run_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21488,14 +22246,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21563,9 +22324,12 @@ async def list_vnet_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections.metadata['url'] # type: ignore @@ -21582,7 +22346,7 @@ async def list_vnet_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21623,9 +22387,12 @@ async def get_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection.metadata['url'] # type: ignore @@ -21643,7 +22410,7 @@ async def get_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21688,10 +22455,13 @@ async def create_or_update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore @@ -21710,13 +22480,12 @@ async def create_or_update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -21755,7 +22524,9 @@ async def delete_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21816,10 +22587,13 @@ async def update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection.metadata['url'] # type: ignore @@ -21838,13 +22612,12 @@ async def update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -21886,9 +22659,12 @@ async def get_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore @@ -21907,7 +22683,7 @@ async def get_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21956,10 +22732,13 @@ async def create_or_update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -21979,13 +22758,12 @@ async def create_or_update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -22030,10 +22808,13 @@ async def update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -22053,13 +22834,12 @@ async def update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -22095,14 +22875,17 @@ def list_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22171,9 +22954,12 @@ async def get_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_web_job.metadata['url'] # type: ignore @@ -22191,7 +22977,7 @@ async def get_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_paged_models.py deleted file mode 100644 index d1ae9d025532..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/models/_paged_models.py +++ /dev/null @@ -1,326 +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 msrest.paging import Paged - - -class SitePaged(Paged): - """ - A paging container for iterating over a list of :class:`Site ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Site]'} - } - - def __init__(self, *args, **kwargs): - - super(SitePaged, self).__init__(*args, **kwargs) -class BackupItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`BackupItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupItem]'} - } - - def __init__(self, *args, **kwargs): - - super(BackupItemPaged, self).__init__(*args, **kwargs) -class SiteConfigResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteConfigResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteConfigResource]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteConfigResourcePaged, self).__init__(*args, **kwargs) -class SiteConfigurationSnapshotInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteConfigurationSnapshotInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteConfigurationSnapshotInfoPaged, self).__init__(*args, **kwargs) -class ContinuousWebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`ContinuousWebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ContinuousWebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(ContinuousWebJobPaged, self).__init__(*args, **kwargs) -class DeploymentPaged(Paged): - """ - A paging container for iterating over a list of :class:`Deployment ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Deployment]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentPaged, self).__init__(*args, **kwargs) -class IdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`Identifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Identifier]'} - } - - def __init__(self, *args, **kwargs): - - super(IdentifierPaged, self).__init__(*args, **kwargs) -class FunctionEnvelopePaged(Paged): - """ - A paging container for iterating over a list of :class:`FunctionEnvelope ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[FunctionEnvelope]'} - } - - def __init__(self, *args, **kwargs): - - super(FunctionEnvelopePaged, self).__init__(*args, **kwargs) -class HostNameBindingPaged(Paged): - """ - A paging container for iterating over a list of :class:`HostNameBinding ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[HostNameBinding]'} - } - - def __init__(self, *args, **kwargs): - - super(HostNameBindingPaged, self).__init__(*args, **kwargs) -class SiteInstancePaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteInstance ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteInstance]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteInstancePaged, self).__init__(*args, **kwargs) -class ProcessInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessInfoPaged, self).__init__(*args, **kwargs) -class ProcessModuleInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessModuleInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessModuleInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessModuleInfoPaged, self).__init__(*args, **kwargs) -class ProcessThreadInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessThreadInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessThreadInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessThreadInfoPaged, self).__init__(*args, **kwargs) -class ResourceMetricDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetricDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetricDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricDefinitionPaged, self).__init__(*args, **kwargs) -class ResourceMetricPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetric ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetric]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricPaged, self).__init__(*args, **kwargs) -class PerfMonResponsePaged(Paged): - """ - A paging container for iterating over a list of :class:`PerfMonResponse ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PerfMonResponse]'} - } - - def __init__(self, *args, **kwargs): - - super(PerfMonResponsePaged, self).__init__(*args, **kwargs) -class PublicCertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`PublicCertificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PublicCertificate]'} - } - - def __init__(self, *args, **kwargs): - - super(PublicCertificatePaged, self).__init__(*args, **kwargs) -class SiteExtensionInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteExtensionInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteExtensionInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteExtensionInfoPaged, self).__init__(*args, **kwargs) -class SlotDifferencePaged(Paged): - """ - A paging container for iterating over a list of :class:`SlotDifference ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SlotDifference]'} - } - - def __init__(self, *args, **kwargs): - - super(SlotDifferencePaged, self).__init__(*args, **kwargs) -class SnapshotPaged(Paged): - """ - A paging container for iterating over a list of :class:`Snapshot ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Snapshot]'} - } - - def __init__(self, *args, **kwargs): - - super(SnapshotPaged, self).__init__(*args, **kwargs) -class TriggeredWebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`TriggeredWebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TriggeredWebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(TriggeredWebJobPaged, self).__init__(*args, **kwargs) -class TriggeredJobHistoryPaged(Paged): - """ - A paging container for iterating over a list of :class:`TriggeredJobHistory ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TriggeredJobHistory]'} - } - - def __init__(self, *args, **kwargs): - - super(TriggeredJobHistoryPaged, self).__init__(*args, **kwargs) -class CsmUsageQuotaPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmUsageQuota ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmUsageQuota]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmUsageQuotaPaged, self).__init__(*args, **kwargs) -class WebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`WebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[WebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(WebJobPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py index f623879d22d7..ca27b8d8e141 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -135,14 +138,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -210,9 +216,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -229,7 +238,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -258,10 +267,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Site" cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -279,13 +291,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -403,7 +414,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -466,10 +479,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -487,13 +503,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -537,9 +552,12 @@ def analyze_custom_hostname( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname.metadata['url'] # type: ignore @@ -558,7 +576,7 @@ def analyze_custom_hostname( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -600,7 +618,9 @@ def apply_slot_config_to_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -626,7 +646,6 @@ def apply_slot_config_to_production( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -664,10 +683,13 @@ def backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup.metadata['url'] # type: ignore @@ -685,13 +707,12 @@ def backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -728,14 +749,17 @@ def list_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -806,10 +830,13 @@ def discover_restore( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_restore.metadata['url'] # type: ignore @@ -827,13 +854,12 @@ def discover_restore( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -873,9 +899,12 @@ def get_backup_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status.metadata['url'] # type: ignore @@ -893,7 +922,7 @@ def get_backup_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -935,7 +964,9 @@ def delete_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -998,10 +1029,13 @@ def list_backup_status_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets.metadata['url'] # type: ignore @@ -1020,13 +1054,12 @@ def list_backup_status_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1052,10 +1085,13 @@ def _restore_initial( ): # type: (...) -> "models.RestoreResponse" cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_initial.metadata['url'] # type: ignore @@ -1074,13 +1110,12 @@ def _restore_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -1189,14 +1224,17 @@ def list_configurations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1266,10 +1304,13 @@ def update_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings.metadata['url'] # type: ignore @@ -1287,13 +1328,12 @@ def update_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1330,9 +1370,12 @@ def list_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings.metadata['url'] # type: ignore @@ -1349,7 +1392,7 @@ def list_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1391,10 +1434,13 @@ def update_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings.metadata['url'] # type: ignore @@ -1412,13 +1458,12 @@ def update_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -1455,9 +1500,12 @@ def get_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings.metadata['url'] # type: ignore @@ -1474,7 +1522,7 @@ def get_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1516,10 +1564,13 @@ def update_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration.metadata['url'] # type: ignore @@ -1537,13 +1588,12 @@ def update_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1580,7 +1630,9 @@ def delete_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -1634,9 +1686,12 @@ def get_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration.metadata['url'] # type: ignore @@ -1653,7 +1708,7 @@ def get_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1695,10 +1750,13 @@ def update_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings.metadata['url'] # type: ignore @@ -1716,13 +1774,12 @@ def update_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -1759,9 +1816,12 @@ def list_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings.metadata['url'] # type: ignore @@ -1778,7 +1838,7 @@ def list_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1817,9 +1877,12 @@ def get_diagnostic_logs_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore @@ -1836,7 +1899,7 @@ def get_diagnostic_logs_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1879,10 +1942,13 @@ def update_diagnostic_logs_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore @@ -1900,13 +1966,12 @@ def update_diagnostic_logs_config( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -1946,10 +2011,13 @@ def update_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata.metadata['url'] # type: ignore @@ -1967,13 +2035,12 @@ def update_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -2010,9 +2077,12 @@ def list_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_metadata.metadata['url'] # type: ignore @@ -2029,7 +2099,7 @@ def list_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2055,9 +2125,12 @@ def _list_publishing_credentials_initial( ): # type: (...) -> "models.User" cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore @@ -2074,7 +2147,7 @@ def _list_publishing_credentials_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2180,10 +2253,13 @@ def update_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings.metadata['url'] # type: ignore @@ -2201,13 +2277,12 @@ def update_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -2244,9 +2319,12 @@ def list_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings.metadata['url'] # type: ignore @@ -2263,7 +2341,7 @@ def list_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2302,9 +2380,12 @@ def list_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_slot_configuration_names.metadata['url'] # type: ignore @@ -2321,7 +2402,7 @@ def list_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2364,10 +2445,13 @@ def update_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot_configuration_names.metadata['url'] # type: ignore @@ -2385,13 +2469,12 @@ def update_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') 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 @@ -2429,9 +2512,12 @@ def get_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration.metadata['url'] # type: ignore @@ -2448,7 +2534,7 @@ def get_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2490,10 +2576,13 @@ def create_or_update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration.metadata['url'] # type: ignore @@ -2511,13 +2600,12 @@ def create_or_update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2557,10 +2645,13 @@ def update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration.metadata['url'] # type: ignore @@ -2578,13 +2669,12 @@ def update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2622,14 +2712,17 @@ def list_configuration_snapshot_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2699,9 +2792,12 @@ def get_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot.metadata['url'] # type: ignore @@ -2719,7 +2815,7 @@ def get_configuration_snapshot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2761,7 +2857,9 @@ def recover_site_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -2816,9 +2914,12 @@ def get_web_site_container_logs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs.metadata['url'] # type: ignore @@ -2835,7 +2936,7 @@ def get_web_site_container_logs( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -2876,9 +2977,12 @@ def get_web_site_container_logs_zip( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/zip" # Construct URL url = self.get_web_site_container_logs_zip.metadata['url'] # type: ignore @@ -2895,7 +2999,7 @@ def get_web_site_container_logs_zip( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -2936,14 +3040,17 @@ def list_continuous_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3013,9 +3120,12 @@ def get_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job.metadata['url'] # type: ignore @@ -3033,7 +3143,7 @@ def get_continuous_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3077,7 +3187,9 @@ def delete_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3135,7 +3247,9 @@ def start_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3193,7 +3307,9 @@ def stop_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3248,14 +3364,17 @@ def list_deployments( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3325,9 +3444,12 @@ def get_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_deployment.metadata['url'] # type: ignore @@ -3345,7 +3467,7 @@ def get_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3390,10 +3512,13 @@ def create_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment.metadata['url'] # type: ignore @@ -3412,13 +3537,12 @@ def create_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -3458,7 +3582,9 @@ def delete_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3517,9 +3643,12 @@ def list_deployment_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log.metadata['url'] # type: ignore @@ -3537,7 +3666,7 @@ def list_deployment_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3576,14 +3705,17 @@ def list_domain_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3653,9 +3785,12 @@ def get_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3673,7 +3808,7 @@ def get_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3718,10 +3853,13 @@ def create_or_update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3740,13 +3878,12 @@ def create_or_update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -3786,7 +3923,9 @@ def delete_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -3847,10 +3986,13 @@ def update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3869,13 +4011,12 @@ def update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -3912,9 +4053,12 @@ def get_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status.metadata['url'] # type: ignore @@ -3931,7 +4075,7 @@ def get_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3958,10 +4102,13 @@ def _create_ms_deploy_operation_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -3979,13 +4126,12 @@ def _create_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -4092,9 +4238,12 @@ def get_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log.metadata['url'] # type: ignore @@ -4111,7 +4260,7 @@ def get_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4152,14 +4301,17 @@ def list_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4226,9 +4378,12 @@ def get_functions_admin_token( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token.metadata['url'] # type: ignore @@ -4245,7 +4400,7 @@ def get_functions_admin_token( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4287,9 +4442,12 @@ def get_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_function.metadata['url'] # type: ignore @@ -4307,7 +4465,7 @@ def get_function( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4337,10 +4495,13 @@ def _create_function_initial( ): # type: (...) -> "models.FunctionEnvelope" cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_function_initial.metadata['url'] # type: ignore @@ -4359,13 +4520,12 @@ def _create_function_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -4477,7 +4637,9 @@ def delete_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -4535,9 +4697,12 @@ def list_function_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets.metadata['url'] # type: ignore @@ -4555,7 +4720,7 @@ def list_function_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4594,14 +4759,17 @@ def list_host_name_bindings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4671,9 +4839,12 @@ def get_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding.metadata['url'] # type: ignore @@ -4691,7 +4862,7 @@ def get_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4737,10 +4908,13 @@ def create_or_update_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore @@ -4759,13 +4933,12 @@ def create_or_update_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -4805,7 +4978,9 @@ def delete_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -4866,9 +5041,12 @@ def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -4887,7 +5065,7 @@ def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4935,10 +5113,13 @@ def create_or_update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore @@ -4958,13 +5139,12 @@ def create_or_update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5007,7 +5187,9 @@ def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -5072,10 +5254,13 @@ def update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection.metadata['url'] # type: ignore @@ -5095,13 +5280,12 @@ def update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5144,9 +5328,12 @@ def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -5165,7 +5352,7 @@ def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5204,9 +5391,12 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections.metadata['url'] # type: ignore @@ -5223,7 +5413,7 @@ def list_hybrid_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5262,9 +5452,12 @@ def list_relay_service_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections.metadata['url'] # type: ignore @@ -5281,7 +5474,7 @@ def list_relay_service_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5323,9 +5516,12 @@ def get_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection.metadata['url'] # type: ignore @@ -5343,7 +5539,7 @@ def get_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5388,10 +5584,13 @@ def create_or_update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore @@ -5410,13 +5609,12 @@ def create_or_update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -5456,7 +5654,9 @@ def delete_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -5517,10 +5717,13 @@ def update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection.metadata['url'] # type: ignore @@ -5539,13 +5742,12 @@ def update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -5582,14 +5784,17 @@ def list_instance_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5659,9 +5864,12 @@ def get_instance_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore @@ -5679,7 +5887,7 @@ def get_instance_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5707,10 +5915,13 @@ def _create_instance_ms_deploy_operation_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -5729,13 +5940,12 @@ def _create_instance_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -5849,9 +6059,12 @@ def get_instance_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore @@ -5869,7 +6082,7 @@ def get_instance_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5915,14 +6128,17 @@ def list_instance_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5997,9 +6213,12 @@ def get_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process.metadata['url'] # type: ignore @@ -6018,7 +6237,7 @@ def get_instance_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6067,7 +6286,9 @@ def delete_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -6130,9 +6351,12 @@ def get_instance_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump.metadata['url'] # type: ignore @@ -6151,7 +6375,7 @@ def get_instance_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -6200,14 +6424,17 @@ def list_instance_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6286,9 +6513,12 @@ def get_instance_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module.metadata['url'] # type: ignore @@ -6308,7 +6538,7 @@ def get_instance_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6356,14 +6586,17 @@ def list_instance_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6443,9 +6676,12 @@ def get_instance_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread.metadata['url'] # type: ignore @@ -6465,7 +6701,7 @@ def get_instance_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6506,9 +6742,12 @@ def is_cloneable( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable.metadata['url'] # type: ignore @@ -6525,7 +6764,7 @@ def is_cloneable( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6564,9 +6803,12 @@ def list_sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers.metadata['url'] # type: ignore @@ -6583,7 +6825,7 @@ def list_sync_function_triggers( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6622,14 +6864,17 @@ def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6706,14 +6951,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6773,10 +7021,13 @@ def _migrate_storage_initial( ): # type: (...) -> "models.StorageMigrationResponse" cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_storage_initial.metadata['url'] # type: ignore @@ -6795,13 +7046,12 @@ def _migrate_storage_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') 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 @@ -6898,10 +7148,13 @@ def _migrate_my_sql_initial( ): # type: (...) -> "models.Operation" cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_my_sql_initial.metadata['url'] # type: ignore @@ -6919,13 +7172,12 @@ def _migrate_my_sql_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') 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 @@ -7031,9 +7283,12 @@ def get_migrate_my_sql_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore @@ -7050,7 +7305,7 @@ def get_migrate_my_sql_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7092,9 +7347,12 @@ def list_network_features( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_network_features.metadata['url'] # type: ignore @@ -7112,7 +7370,7 @@ def list_network_features( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7162,9 +7420,12 @@ def start_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace.metadata['url'] # type: ignore @@ -7187,7 +7448,7 @@ def start_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7226,9 +7487,12 @@ def stop_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace.metadata['url'] # type: ignore @@ -7245,7 +7509,7 @@ def stop_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7284,7 +7548,9 @@ def generate_new_site_publishing_password( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -7343,14 +7609,17 @@ def list_perf_mon_counters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7419,9 +7688,12 @@ def get_site_php_error_log_flag( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore @@ -7438,7 +7710,7 @@ def get_site_php_error_log_flag( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7477,9 +7749,12 @@ def list_premier_add_ons( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons.metadata['url'] # type: ignore @@ -7496,7 +7771,7 @@ def list_premier_add_ons( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7538,9 +7813,12 @@ def get_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on.metadata['url'] # type: ignore @@ -7558,7 +7836,7 @@ def get_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7603,10 +7881,13 @@ def add_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on.metadata['url'] # type: ignore @@ -7625,13 +7906,12 @@ def add_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -7671,7 +7951,9 @@ def delete_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -7727,14 +8009,17 @@ def list_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7804,9 +8089,12 @@ def get_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process.metadata['url'] # type: ignore @@ -7824,7 +8112,7 @@ def get_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7869,7 +8157,9 @@ def delete_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -7927,9 +8217,12 @@ def get_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump.metadata['url'] # type: ignore @@ -7947,7 +8240,7 @@ def get_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -7992,14 +8285,17 @@ def list_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8073,9 +8369,12 @@ def get_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_module.metadata['url'] # type: ignore @@ -8094,7 +8393,7 @@ def get_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8138,14 +8437,17 @@ def list_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8220,9 +8522,12 @@ def get_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_thread.metadata['url'] # type: ignore @@ -8241,7 +8546,7 @@ def get_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8282,14 +8587,17 @@ def list_public_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8359,9 +8667,12 @@ def get_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate.metadata['url'] # type: ignore @@ -8379,7 +8690,7 @@ def get_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8425,10 +8736,13 @@ def create_or_update_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate.metadata['url'] # type: ignore @@ -8447,13 +8761,12 @@ def create_or_update_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -8493,7 +8806,9 @@ def delete_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -8552,10 +8867,13 @@ def list_publishing_profile_xml_with_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore @@ -8573,13 +8891,12 @@ def list_publishing_profile_xml_with_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -8604,7 +8921,9 @@ def _recover_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -8630,7 +8949,6 @@ def _recover_initial( body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') 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 @@ -8731,7 +9049,9 @@ def reset_production_slot_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -8793,7 +9113,9 @@ def restart( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -8851,14 +9173,17 @@ def list_site_extensions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8928,9 +9253,12 @@ def get_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension.metadata['url'] # type: ignore @@ -8948,7 +9276,7 @@ def get_site_extension( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8977,9 +9305,12 @@ def _install_site_extension_initial( ): # type: (...) -> Optional["models.SiteExtensionInfo"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_initial.metadata['url'] # type: ignore @@ -8997,7 +9328,7 @@ def _install_site_extension_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -9112,7 +9443,9 @@ def delete_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -9167,14 +9500,17 @@ def list_slots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9244,9 +9580,12 @@ def get_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_slot.metadata['url'] # type: ignore @@ -9264,7 +9603,7 @@ def get_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9298,10 +9637,13 @@ def _create_or_update_slot_initial( ): # type: (...) -> "models.Site" cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_slot_initial.metadata['url'] # type: ignore @@ -9328,13 +9670,12 @@ def _create_or_update_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -9484,7 +9825,9 @@ def delete_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -9569,10 +9912,13 @@ def update_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot.metadata['url'] # type: ignore @@ -9599,13 +9945,12 @@ def update_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -9652,9 +9997,12 @@ def analyze_custom_hostname_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore @@ -9674,7 +10022,7 @@ def analyze_custom_hostname_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9720,7 +10068,9 @@ def apply_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -9747,7 +10097,6 @@ def apply_slot_configuration_slot( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -9789,10 +10138,13 @@ def backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup_slot.metadata['url'] # type: ignore @@ -9811,13 +10163,12 @@ def backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -9858,14 +10209,17 @@ def list_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9941,10 +10295,13 @@ def discover_restore_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_restore_slot.metadata['url'] # type: ignore @@ -9963,13 +10320,12 @@ def discover_restore_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10013,9 +10369,12 @@ def get_backup_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status_slot.metadata['url'] # type: ignore @@ -10034,7 +10393,7 @@ def get_backup_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10080,7 +10439,9 @@ def delete_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -10147,10 +10508,13 @@ def list_backup_status_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore @@ -10170,13 +10534,12 @@ def list_backup_status_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -10203,10 +10566,13 @@ def _restore_slot_initial( ): # type: (...) -> "models.RestoreResponse" cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_slot_initial.metadata['url'] # type: ignore @@ -10226,13 +10592,12 @@ def _restore_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10350,14 +10715,17 @@ def list_configurations_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10432,10 +10800,13 @@ def update_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings_slot.metadata['url'] # type: ignore @@ -10454,13 +10825,12 @@ def update_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -10501,9 +10871,12 @@ def list_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings_slot.metadata['url'] # type: ignore @@ -10521,7 +10894,7 @@ def list_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10566,10 +10939,13 @@ def update_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings_slot.metadata['url'] # type: ignore @@ -10588,13 +10964,12 @@ def update_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -10635,9 +11010,12 @@ def get_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings_slot.metadata['url'] # type: ignore @@ -10655,7 +11033,7 @@ def get_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10701,10 +11079,13 @@ def update_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration_slot.metadata['url'] # type: ignore @@ -10723,13 +11104,12 @@ def update_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -10770,7 +11150,9 @@ def delete_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -10829,9 +11211,12 @@ def get_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration_slot.metadata['url'] # type: ignore @@ -10849,7 +11234,7 @@ def get_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10895,10 +11280,13 @@ def update_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings_slot.metadata['url'] # type: ignore @@ -10917,13 +11305,12 @@ def update_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -10964,9 +11351,12 @@ def list_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings_slot.metadata['url'] # type: ignore @@ -10984,7 +11374,7 @@ def list_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11027,9 +11417,12 @@ def get_diagnostic_logs_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore @@ -11047,7 +11440,7 @@ def get_diagnostic_logs_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11094,10 +11487,13 @@ def update_diagnostic_logs_config_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore @@ -11116,13 +11512,12 @@ def update_diagnostic_logs_config_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -11166,10 +11561,13 @@ def update_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata_slot.metadata['url'] # type: ignore @@ -11188,13 +11586,12 @@ def update_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -11235,9 +11632,12 @@ def list_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_metadata_slot.metadata['url'] # type: ignore @@ -11255,7 +11655,7 @@ def list_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11282,9 +11682,12 @@ def _list_publishing_credentials_slot_initial( ): # type: (...) -> "models.User" cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore @@ -11302,7 +11705,7 @@ def _list_publishing_credentials_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11416,10 +11819,13 @@ def update_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings_slot.metadata['url'] # type: ignore @@ -11438,13 +11844,12 @@ def update_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -11484,9 +11889,12 @@ def list_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings_slot.metadata['url'] # type: ignore @@ -11504,7 +11912,7 @@ def list_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11548,9 +11956,12 @@ def get_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_slot.metadata['url'] # type: ignore @@ -11568,7 +11979,7 @@ def get_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11614,10 +12025,13 @@ def create_or_update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore @@ -11636,13 +12050,12 @@ def create_or_update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -11686,10 +12099,13 @@ def update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration_slot.metadata['url'] # type: ignore @@ -11708,13 +12124,12 @@ def update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -11756,14 +12171,17 @@ def list_configuration_snapshot_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11838,9 +12256,12 @@ def get_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -11859,7 +12280,7 @@ def get_configuration_snapshot_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11905,7 +12326,9 @@ def recover_site_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -11964,9 +12387,12 @@ def get_web_site_container_logs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore @@ -11984,7 +12410,7 @@ def get_web_site_container_logs_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -12028,9 +12454,12 @@ def get_web_site_container_logs_zip_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/zip" # Construct URL url = self.get_web_site_container_logs_zip_slot.metadata['url'] # type: ignore @@ -12048,7 +12477,7 @@ def get_web_site_container_logs_zip_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -12093,14 +12522,17 @@ def list_continuous_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12175,9 +12607,12 @@ def get_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore @@ -12196,7 +12631,7 @@ def get_continuous_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12244,7 +12679,9 @@ def delete_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12307,7 +12744,9 @@ def start_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12370,7 +12809,9 @@ def stop_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12430,14 +12871,17 @@ def list_deployments_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12512,9 +12956,12 @@ def get_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_deployment_slot.metadata['url'] # type: ignore @@ -12533,7 +12980,7 @@ def get_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12582,10 +13029,13 @@ def create_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment_slot.metadata['url'] # type: ignore @@ -12605,13 +13055,12 @@ def create_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -12655,7 +13104,9 @@ def delete_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -12719,9 +13170,12 @@ def list_deployment_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log_slot.metadata['url'] # type: ignore @@ -12740,7 +13194,7 @@ def list_deployment_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12783,14 +13237,17 @@ def list_domain_ownership_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12865,9 +13322,12 @@ def get_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -12886,7 +13346,7 @@ def get_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12935,10 +13395,13 @@ def create_or_update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -12958,13 +13421,12 @@ def create_or_update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -13008,7 +13470,9 @@ def delete_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -13074,10 +13538,13 @@ def update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -13097,13 +13564,12 @@ def update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -13143,9 +13609,12 @@ def get_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -13163,7 +13632,7 @@ def get_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13191,10 +13660,13 @@ def _create_ms_deploy_operation_slot_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -13213,13 +13685,12 @@ def _create_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -13333,9 +13804,12 @@ def get_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -13353,7 +13827,7 @@ def get_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13398,14 +13872,17 @@ def list_instance_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13476,9 +13953,12 @@ def get_functions_admin_token_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore @@ -13496,7 +13976,7 @@ def get_functions_admin_token_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13542,9 +14022,12 @@ def get_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_function_slot.metadata['url'] # type: ignore @@ -13563,7 +14046,7 @@ def get_instance_function_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13594,10 +14077,13 @@ def _create_instance_function_slot_initial( ): # type: (...) -> "models.FunctionEnvelope" cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore @@ -13617,13 +14103,12 @@ def _create_instance_function_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -13744,7 +14229,9 @@ def delete_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -13807,9 +14294,12 @@ def list_function_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets_slot.metadata['url'] # type: ignore @@ -13828,7 +14318,7 @@ def list_function_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13871,14 +14361,17 @@ def list_host_name_bindings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13953,9 +14446,12 @@ def get_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding_slot.metadata['url'] # type: ignore @@ -13974,7 +14470,7 @@ def get_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14024,10 +14520,13 @@ def create_or_update_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore @@ -14047,13 +14546,12 @@ def create_or_update_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -14097,7 +14595,9 @@ def delete_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -14162,9 +14662,12 @@ def get_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore @@ -14184,7 +14687,7 @@ def get_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14235,10 +14738,13 @@ def create_or_update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -14259,13 +14765,12 @@ def create_or_update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -14311,7 +14816,9 @@ def delete_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -14380,10 +14887,13 @@ def update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -14404,13 +14914,12 @@ def update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -14456,9 +14965,12 @@ def list_hybrid_connection_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore @@ -14478,7 +14990,7 @@ def list_hybrid_connection_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14520,9 +15032,12 @@ def list_hybrid_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore @@ -14540,7 +15055,7 @@ def list_hybrid_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14583,9 +15098,12 @@ def list_relay_service_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore @@ -14603,7 +15121,7 @@ def list_relay_service_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14649,9 +15167,12 @@ def get_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore @@ -14670,7 +15191,7 @@ def get_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14719,10 +15240,13 @@ def create_or_update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -14742,13 +15266,12 @@ def create_or_update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -14792,7 +15315,9 @@ def delete_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -14858,10 +15383,13 @@ def update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -14881,13 +15409,12 @@ def update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -14928,14 +15455,17 @@ def list_instance_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15009,9 +15539,12 @@ def get_instance_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -15030,7 +15563,7 @@ def get_instance_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15059,10 +15592,13 @@ def _create_instance_ms_deploy_operation_slot_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -15082,13 +15618,12 @@ def _create_instance_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -15209,9 +15744,12 @@ def get_instance_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -15230,7 +15768,7 @@ def get_instance_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15280,14 +15818,17 @@ def list_instance_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15367,9 +15908,12 @@ def get_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_slot.metadata['url'] # type: ignore @@ -15389,7 +15933,7 @@ def get_instance_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15442,7 +15986,9 @@ def delete_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -15510,9 +16056,12 @@ def get_instance_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore @@ -15532,7 +16081,7 @@ def get_instance_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -15585,14 +16134,17 @@ def list_instance_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15676,9 +16228,12 @@ def get_instance_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module_slot.metadata['url'] # type: ignore @@ -15699,7 +16254,7 @@ def get_instance_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15751,14 +16306,17 @@ def list_instance_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15843,9 +16401,12 @@ def get_instance_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore @@ -15866,7 +16427,7 @@ def get_instance_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15911,9 +16472,12 @@ def is_cloneable_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable_slot.metadata['url'] # type: ignore @@ -15931,7 +16495,7 @@ def is_cloneable_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15974,9 +16538,12 @@ def list_sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore @@ -15994,7 +16561,7 @@ def list_sync_function_triggers_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16037,14 +16604,17 @@ def list_metric_definitions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16126,14 +16696,17 @@ def list_metrics_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16209,9 +16782,12 @@ def get_migrate_my_sql_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore @@ -16229,7 +16805,7 @@ def get_migrate_my_sql_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16275,9 +16851,12 @@ def list_network_features_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_network_features_slot.metadata['url'] # type: ignore @@ -16296,7 +16875,7 @@ def list_network_features_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16349,9 +16928,12 @@ def start_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -16375,7 +16957,7 @@ def start_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16417,9 +16999,12 @@ def stop_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -16437,7 +17022,7 @@ def stop_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16480,7 +17065,9 @@ def generate_new_site_publishing_password_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -16543,14 +17130,17 @@ def list_perf_mon_counters_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16623,9 +17213,12 @@ def get_site_php_error_log_flag_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore @@ -16643,7 +17236,7 @@ def get_site_php_error_log_flag_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16686,9 +17279,12 @@ def list_premier_add_ons_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore @@ -16706,7 +17302,7 @@ def list_premier_add_ons_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16752,9 +17348,12 @@ def get_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on_slot.metadata['url'] # type: ignore @@ -16773,7 +17372,7 @@ def get_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16822,10 +17421,13 @@ def add_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on_slot.metadata['url'] # type: ignore @@ -16845,13 +17447,12 @@ def add_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -16895,7 +17496,9 @@ def delete_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -16956,14 +17559,17 @@ def list_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17038,9 +17644,12 @@ def get_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_slot.metadata['url'] # type: ignore @@ -17059,7 +17668,7 @@ def get_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17108,7 +17717,9 @@ def delete_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -17171,9 +17782,12 @@ def get_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump_slot.metadata['url'] # type: ignore @@ -17192,7 +17806,7 @@ def get_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -17241,14 +17855,17 @@ def list_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17327,9 +17944,12 @@ def get_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_module_slot.metadata['url'] # type: ignore @@ -17349,7 +17969,7 @@ def get_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17397,14 +18017,17 @@ def list_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17484,9 +18107,12 @@ def get_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_process_thread_slot.metadata['url'] # type: ignore @@ -17506,7 +18132,7 @@ def get_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17551,14 +18177,17 @@ def list_public_certificates_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17633,9 +18262,12 @@ def get_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate_slot.metadata['url'] # type: ignore @@ -17654,7 +18286,7 @@ def get_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17704,10 +18336,13 @@ def create_or_update_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore @@ -17727,13 +18362,12 @@ def create_or_update_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -17777,7 +18411,9 @@ def delete_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -17841,10 +18477,13 @@ def list_publishing_profile_xml_with_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore @@ -17863,13 +18502,12 @@ def list_publishing_profile_xml_with_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -17895,7 +18533,9 @@ def _recover_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -17922,7 +18562,6 @@ def _recover_slot_initial( body_content = self._serialize.body(recovery_entity, 'SnapshotRecoveryRequest') 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 @@ -18031,7 +18670,9 @@ def reset_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18098,7 +18739,9 @@ def restart_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18161,14 +18804,17 @@ def list_site_extensions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18243,9 +18889,12 @@ def get_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension_slot.metadata['url'] # type: ignore @@ -18264,7 +18913,7 @@ def get_site_extension_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18294,9 +18943,12 @@ def _install_site_extension_slot_initial( ): # type: (...) -> Optional["models.SiteExtensionInfo"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore @@ -18315,7 +18967,7 @@ def _install_site_extension_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -18439,7 +19091,9 @@ def delete_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -18502,16 +19156,19 @@ def list_slot_differences_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18531,7 +19188,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -18539,7 +19195,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -18576,7 +19231,9 @@ def _swap_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -18603,7 +19260,6 @@ def _swap_slot_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -18710,14 +19366,17 @@ def list_snapshots_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18789,9 +19448,12 @@ def get_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_source_control_slot.metadata['url'] # type: ignore @@ -18809,7 +19471,7 @@ def get_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18844,10 +19506,13 @@ def _create_or_update_source_control_slot_initial( ): # type: (...) -> "models.SiteSourceControl" cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore @@ -18866,13 +19531,12 @@ def _create_or_update_source_control_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -18993,7 +19657,9 @@ def delete_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19055,10 +19721,13 @@ def update_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control_slot.metadata['url'] # type: ignore @@ -19077,13 +19746,12 @@ def update_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -19128,7 +19796,9 @@ def start_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19187,7 +19857,9 @@ def stop_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19245,7 +19917,9 @@ def sync_repository_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19304,7 +19978,9 @@ def sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19363,14 +20039,17 @@ def list_triggered_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19445,9 +20124,12 @@ def get_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore @@ -19466,7 +20148,7 @@ def get_triggered_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19514,7 +20196,9 @@ def delete_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19577,14 +20261,17 @@ def list_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19663,9 +20350,12 @@ def get_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore @@ -19685,7 +20375,7 @@ def get_triggered_web_job_history_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19733,7 +20423,9 @@ def run_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -19799,14 +20491,17 @@ def list_usages_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19880,9 +20575,12 @@ def list_vnet_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections_slot.metadata['url'] # type: ignore @@ -19900,7 +20598,7 @@ def list_vnet_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19946,9 +20644,12 @@ def get_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_slot.metadata['url'] # type: ignore @@ -19967,7 +20668,7 @@ def get_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20017,10 +20718,13 @@ def create_or_update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore @@ -20040,13 +20744,12 @@ def create_or_update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -20090,7 +20793,9 @@ def delete_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -20157,10 +20862,13 @@ def update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_slot.metadata['url'] # type: ignore @@ -20180,13 +20888,12 @@ def update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -20233,9 +20940,12 @@ def get_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -20255,7 +20965,7 @@ def get_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20309,10 +21019,13 @@ def create_or_update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -20333,13 +21046,12 @@ def create_or_update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -20389,10 +21101,13 @@ def update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -20413,13 +21128,12 @@ def update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -20460,14 +21174,17 @@ def list_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20542,9 +21259,12 @@ def get_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_web_job_slot.metadata['url'] # type: ignore @@ -20563,7 +21283,7 @@ def get_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20605,16 +21325,19 @@ def list_slot_differences_from_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20633,7 +21356,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -20641,7 +21363,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -20677,7 +21398,9 @@ def _swap_slot_with_production_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") @@ -20703,7 +21426,6 @@ def _swap_slot_with_production_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -20802,14 +21524,17 @@ def list_snapshots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20876,9 +21601,12 @@ def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -20895,7 +21623,7 @@ def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20929,10 +21657,13 @@ def _create_or_update_source_control_initial( ): # type: (...) -> "models.SiteSourceControl" cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore @@ -20950,13 +21681,12 @@ def _create_or_update_source_control_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -21068,7 +21798,9 @@ def delete_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21125,10 +21857,13 @@ def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -21146,13 +21881,12 @@ def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -21193,7 +21927,9 @@ def start( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21247,7 +21983,9 @@ def stop( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21301,7 +22039,9 @@ def sync_repository( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21355,7 +22095,9 @@ def sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21409,14 +22151,17 @@ def list_triggered_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21486,9 +22231,12 @@ def get_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job.metadata['url'] # type: ignore @@ -21506,7 +22254,7 @@ def get_triggered_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21550,7 +22298,9 @@ def delete_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21608,14 +22358,17 @@ def list_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21689,9 +22442,12 @@ def get_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history.metadata['url'] # type: ignore @@ -21710,7 +22466,7 @@ def get_triggered_web_job_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21754,7 +22510,9 @@ def run_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -21815,14 +22573,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21891,9 +22652,12 @@ def list_vnet_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections.metadata['url'] # type: ignore @@ -21910,7 +22674,7 @@ def list_vnet_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21952,9 +22716,12 @@ def get_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection.metadata['url'] # type: ignore @@ -21972,7 +22739,7 @@ def get_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22018,10 +22785,13 @@ def create_or_update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore @@ -22040,13 +22810,12 @@ def create_or_update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -22086,7 +22855,9 @@ def delete_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" @@ -22148,10 +22919,13 @@ def update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection.metadata['url'] # type: ignore @@ -22170,13 +22944,12 @@ def update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -22219,9 +22992,12 @@ def get_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore @@ -22240,7 +23016,7 @@ def get_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22290,10 +23066,13 @@ def create_or_update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -22313,13 +23092,12 @@ def create_or_update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -22365,10 +23143,13 @@ def update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -22388,13 +23169,12 @@ def update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -22431,14 +23211,17 @@ def list_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22508,9 +23291,12 @@ def get_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-08-01" + accept = "application/json" # Construct URL url = self.get_web_job.metadata['url'] # type: ignore @@ -22528,7 +23314,7 @@ def get_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py index 68e22e307460..7fd05d3967f8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2016-09-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json index f26eccb00ee8..10283baeb328 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": true }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "app_service_environments": "AppServiceEnvironmentsOperations", diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py index 51314bb605e4..a777791a5848 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py @@ -53,6 +53,7 @@ def __init__( 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.app_service_environments = AppServiceEnvironmentsOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration.py index 0331c9bd226b..7a0b7491a6a3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2016-09-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py similarity index 90% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py index 4df8ab56a42d..d8aa4d3bb784 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py @@ -15,9 +15,9 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import AppServiceEnvironmentsOperations -from .operations_async import AppServicePlansOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import AppServiceEnvironmentsOperations +from .operations import AppServicePlansOperations from .. import models @@ -25,9 +25,9 @@ class WebSiteManagementClient(object): """WebSite Management Client. :ivar app_service_environments: AppServiceEnvironmentsOperations operations - :vartype app_service_environments: azure.mgmt.web.v2016_09_01.aio.operations_async.AppServiceEnvironmentsOperations + :vartype app_service_environments: azure.mgmt.web.v2016_09_01.aio.operations.AppServiceEnvironmentsOperations :ivar app_service_plans: AppServicePlansOperations operations - :vartype app_service_plans: azure.mgmt.web.v2016_09_01.aio.operations_async.AppServicePlansOperations + :vartype app_service_plans: azure.mgmt.web.v2016_09_01.aio.operations.AppServicePlansOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). @@ -50,6 +50,7 @@ def __init__( 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.app_service_environments = AppServiceEnvironmentsOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/__init__.py similarity index 77% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__init__.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/__init__.py index 2189b42e4cdb..5d511905f8ab 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/__init__.py @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._app_service_environments_operations_async import AppServiceEnvironmentsOperations -from ._app_service_plans_operations_async import AppServicePlansOperations +from ._app_service_environments_operations import AppServiceEnvironmentsOperations +from ._app_service_plans_operations import AppServicePlansOperations __all__ = [ 'AppServiceEnvironmentsOperations', diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py index 0464e4c3494b..2db95cbcfca2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_environments_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -125,14 +128,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -242,10 +251,13 @@ async def _create_or_update_initial( **kwargs ) -> Optional["models.AppServiceEnvironmentResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -263,13 +275,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') 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 @@ -365,7 +376,9 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -488,10 +501,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -509,13 +525,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') 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 @@ -556,14 +571,17 @@ def list_capacities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -629,9 +647,12 @@ async def list_vips( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_vips.metadata['url'] # type: ignore @@ -648,7 +669,7 @@ async def list_vips( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -686,9 +707,12 @@ async def list_diagnostics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_diagnostics.metadata['url'] # type: ignore @@ -705,7 +729,7 @@ async def list_diagnostics( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -746,9 +770,12 @@ async def get_diagnostics_item( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_diagnostics_item.metadata['url'] # type: ignore @@ -766,7 +793,7 @@ async def get_diagnostics_item( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -804,9 +831,12 @@ async def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_metric_definitions.metadata['url'] # type: ignore @@ -823,7 +853,7 @@ async def list_metric_definitions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -871,14 +901,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -948,14 +981,17 @@ def list_multi_role_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1021,9 +1057,12 @@ async def get_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_multi_role_pool.metadata['url'] # type: ignore @@ -1040,7 +1079,7 @@ async def get_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1066,10 +1105,13 @@ async def _create_or_update_multi_role_pool_initial( **kwargs ) -> Optional["models.WorkerPoolResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore @@ -1087,13 +1129,12 @@ async def _create_or_update_multi_role_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1204,10 +1245,13 @@ async def update_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_multi_role_pool.metadata['url'] # type: ignore @@ -1225,13 +1269,12 @@ async def update_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1276,14 +1319,17 @@ def list_multi_role_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1357,14 +1403,17 @@ def list_multi_role_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1433,14 +1482,17 @@ def list_multi_role_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1525,14 +1577,17 @@ def list_multi_role_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1608,14 +1663,17 @@ def list_multi_role_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1681,14 +1739,17 @@ def list_multi_role_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1754,9 +1815,12 @@ async def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -1773,7 +1837,7 @@ async def list_operations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1811,7 +1875,9 @@ async def reboot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1851,9 +1917,12 @@ async def _resume_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self._resume_initial.metadata['url'] # type: ignore @@ -1870,7 +1939,7 @@ async def _resume_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1917,14 +1986,17 @@ async def begin_resume( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2026,14 +2098,17 @@ def list_app_service_plans( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2102,14 +2177,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2164,9 +2242,12 @@ async def _suspend_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self._suspend_initial.metadata['url'] # type: ignore @@ -2183,7 +2264,7 @@ async def _suspend_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2230,14 +2311,17 @@ async def begin_suspend( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2345,14 +2429,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2420,14 +2507,17 @@ def list_worker_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2496,9 +2586,12 @@ async def get_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_worker_pool.metadata['url'] # type: ignore @@ -2516,7 +2609,7 @@ async def get_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2543,10 +2636,13 @@ async def _create_or_update_worker_pool_initial( **kwargs ) -> Optional["models.WorkerPoolResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore @@ -2565,13 +2661,12 @@ async def _create_or_update_worker_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2689,10 +2784,13 @@ async def update_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_worker_pool.metadata['url'] # type: ignore @@ -2711,13 +2809,12 @@ async def update_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2764,14 +2861,17 @@ def list_worker_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2855,14 +2955,17 @@ def list_worker_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2937,14 +3040,17 @@ def list_web_worker_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3024,14 +3130,17 @@ def list_web_worker_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3105,14 +3214,17 @@ def list_worker_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3182,14 +3294,17 @@ def list_web_worker_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py index faefaec6eb9a..d6c08ade839f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations_async/_app_service_plans_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -132,14 +135,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -251,10 +260,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServicePlan": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -272,13 +284,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') 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 @@ -388,7 +399,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -444,10 +457,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -465,13 +481,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') 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 @@ -511,9 +526,12 @@ async def list_capabilities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_capabilities.metadata['url'] # type: ignore @@ -530,7 +548,7 @@ async def list_capabilities( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -574,9 +592,12 @@ async def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -595,7 +616,7 @@ async def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -639,7 +660,9 @@ async def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -700,9 +723,12 @@ async def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -721,7 +747,7 @@ async def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -765,14 +791,17 @@ def list_web_apps_by_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -840,9 +869,12 @@ async def get_hybrid_connection_plan_limit( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore @@ -859,7 +891,7 @@ async def get_hybrid_connection_plan_limit( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -897,14 +929,17 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -970,14 +1005,17 @@ def list_metric_defintions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1053,14 +1091,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1135,7 +1176,9 @@ async def restart_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1202,14 +1245,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1281,9 +1327,12 @@ async def get_server_farm_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_server_farm_skus.metadata['url'] # type: ignore @@ -1300,7 +1349,7 @@ async def get_server_farm_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1342,14 +1391,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1417,9 +1469,12 @@ async def list_vnets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_vnets.metadata['url'] # type: ignore @@ -1436,7 +1491,7 @@ async def list_vnets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1477,9 +1532,12 @@ async def get_vnet_from_server_farm( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore @@ -1497,7 +1555,7 @@ async def get_vnet_from_server_farm( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1543,9 +1601,12 @@ async def get_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_vnet_gateway.metadata['url'] # type: ignore @@ -1564,7 +1625,7 @@ async def get_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1611,10 +1672,13 @@ async def update_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_gateway.metadata['url'] # type: ignore @@ -1634,13 +1698,12 @@ async def update_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -1679,9 +1742,12 @@ async def list_routes_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_routes_for_vnet.metadata['url'] # type: ignore @@ -1699,7 +1765,7 @@ async def list_routes_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1743,9 +1809,12 @@ async def get_route_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_route_for_vnet.metadata['url'] # type: ignore @@ -1764,7 +1833,7 @@ async def get_route_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1813,10 +1882,13 @@ async def create_or_update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_route.metadata['url'] # type: ignore @@ -1836,13 +1908,12 @@ async def create_or_update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1886,7 +1957,9 @@ async def delete_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1950,10 +2023,13 @@ async def update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_route.metadata['url'] # type: ignore @@ -1973,13 +2049,12 @@ async def update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -2020,7 +2095,9 @@ async def reboot_worker( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_paged_models.py deleted file mode 100644 index 483d81a457f5..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/models/_paged_models.py +++ /dev/null @@ -1,170 +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 msrest.paging import Paged - - -class AppServiceEnvironmentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceEnvironmentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceEnvironmentResourcePaged, self).__init__(*args, **kwargs) -class StampCapacityPaged(Paged): - """ - A paging container for iterating over a list of :class:`StampCapacity ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StampCapacity]'} - } - - def __init__(self, *args, **kwargs): - - super(StampCapacityPaged, self).__init__(*args, **kwargs) -class ResourceMetricPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetric ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetric]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricPaged, self).__init__(*args, **kwargs) -class WorkerPoolResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`WorkerPoolResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[WorkerPoolResource]'} - } - - def __init__(self, *args, **kwargs): - - super(WorkerPoolResourcePaged, self).__init__(*args, **kwargs) -class ResourceMetricDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetricDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetricDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricDefinitionPaged, self).__init__(*args, **kwargs) -class SkuInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SkuInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SkuInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SkuInfoPaged, self).__init__(*args, **kwargs) -class UsagePaged(Paged): - """ - A paging container for iterating over a list of :class:`Usage ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Usage]'} - } - - def __init__(self, *args, **kwargs): - - super(UsagePaged, self).__init__(*args, **kwargs) -class AppServicePlanPaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServicePlan ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServicePlan]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServicePlanPaged, self).__init__(*args, **kwargs) -class SitePaged(Paged): - """ - A paging container for iterating over a list of :class:`Site ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Site]'} - } - - def __init__(self, *args, **kwargs): - - super(SitePaged, self).__init__(*args, **kwargs) -class CsmUsageQuotaPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmUsageQuota ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmUsageQuota]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmUsageQuotaPaged, self).__init__(*args, **kwargs) -class StrPaged(Paged): - """ - A paging container for iterating over a list of str object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[str]'} - } - - def __init__(self, *args, **kwargs): - - super(StrPaged, self).__init__(*args, **kwargs) -class HybridConnectionPaged(Paged): - """ - A paging container for iterating over a list of :class:`HybridConnection ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[HybridConnection]'} - } - - def __init__(self, *args, **kwargs): - - super(HybridConnectionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py index f016f17d1bc2..7ed6714bef8b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -131,14 +134,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -250,10 +259,13 @@ def _create_or_update_initial( ): # type: (...) -> Optional["models.AppServiceEnvironmentResource"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -271,13 +283,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') 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 @@ -375,7 +386,9 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -500,10 +513,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -521,13 +537,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') 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 @@ -569,14 +584,17 @@ def list_capacities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -643,9 +661,12 @@ def list_vips( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_vips.metadata['url'] # type: ignore @@ -662,7 +683,7 @@ def list_vips( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -701,9 +722,12 @@ def list_diagnostics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_diagnostics.metadata['url'] # type: ignore @@ -720,7 +744,7 @@ def list_diagnostics( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -762,9 +786,12 @@ def get_diagnostics_item( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_diagnostics_item.metadata['url'] # type: ignore @@ -782,7 +809,7 @@ def get_diagnostics_item( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -821,9 +848,12 @@ def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_metric_definitions.metadata['url'] # type: ignore @@ -840,7 +870,7 @@ def list_metric_definitions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -889,14 +919,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -967,14 +1000,17 @@ def list_multi_role_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1041,9 +1077,12 @@ def get_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_multi_role_pool.metadata['url'] # type: ignore @@ -1060,7 +1099,7 @@ def get_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1087,10 +1126,13 @@ def _create_or_update_multi_role_pool_initial( ): # type: (...) -> Optional["models.WorkerPoolResource"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore @@ -1108,13 +1150,12 @@ def _create_or_update_multi_role_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1227,10 +1268,13 @@ def update_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_multi_role_pool.metadata['url'] # type: ignore @@ -1248,13 +1292,12 @@ def update_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1300,14 +1343,17 @@ def list_multi_role_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1382,14 +1428,17 @@ def list_multi_role_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1459,14 +1508,17 @@ def list_multi_role_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1552,14 +1604,17 @@ def list_multi_role_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1636,14 +1691,17 @@ def list_multi_role_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1710,14 +1768,17 @@ def list_multi_role_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1784,9 +1845,12 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -1803,7 +1867,7 @@ def list_operations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1842,7 +1906,9 @@ def reboot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1883,9 +1949,12 @@ def _resume_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self._resume_initial.metadata['url'] # type: ignore @@ -1902,7 +1971,7 @@ def _resume_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1950,14 +2019,17 @@ def begin_resume( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2060,14 +2132,17 @@ def list_app_service_plans( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2137,14 +2212,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2200,9 +2278,12 @@ def _suspend_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self._suspend_initial.metadata['url'] # type: ignore @@ -2219,7 +2300,7 @@ def _suspend_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2267,14 +2348,17 @@ def begin_suspend( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2383,14 +2467,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2459,14 +2546,17 @@ def list_worker_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2536,9 +2626,12 @@ def get_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_worker_pool.metadata['url'] # type: ignore @@ -2556,7 +2649,7 @@ def get_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2584,10 +2677,13 @@ def _create_or_update_worker_pool_initial( ): # type: (...) -> Optional["models.WorkerPoolResource"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore @@ -2606,13 +2702,12 @@ def _create_or_update_worker_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2732,10 +2827,13 @@ def update_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_worker_pool.metadata['url'] # type: ignore @@ -2754,13 +2852,12 @@ def update_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2808,14 +2905,17 @@ def list_worker_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2900,14 +3000,17 @@ def list_worker_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2983,14 +3086,17 @@ def list_web_worker_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3071,14 +3177,17 @@ def list_web_worker_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3153,14 +3262,17 @@ def list_worker_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3231,14 +3343,17 @@ def list_web_worker_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py index 2aef22f98539..5525f3a61f1d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -138,14 +141,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -211,9 +217,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -230,7 +239,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -259,10 +268,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServicePlan" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -280,13 +292,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') 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 @@ -398,7 +409,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -455,10 +468,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -476,13 +492,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') 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 @@ -523,9 +538,12 @@ def list_capabilities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_capabilities.metadata['url'] # type: ignore @@ -542,7 +560,7 @@ def list_capabilities( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -587,9 +605,12 @@ def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -608,7 +629,7 @@ def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -653,7 +674,9 @@ def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -715,9 +738,12 @@ def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -736,7 +762,7 @@ def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -781,14 +807,17 @@ def list_web_apps_by_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -857,9 +886,12 @@ def get_hybrid_connection_plan_limit( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore @@ -876,7 +908,7 @@ def get_hybrid_connection_plan_limit( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -915,14 +947,17 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -989,14 +1024,17 @@ def list_metric_defintions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1073,14 +1111,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1156,7 +1197,9 @@ def restart_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1224,14 +1267,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1304,9 +1350,12 @@ def get_server_farm_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_server_farm_skus.metadata['url'] # type: ignore @@ -1323,7 +1372,7 @@ def get_server_farm_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1366,14 +1415,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1442,9 +1494,12 @@ def list_vnets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_vnets.metadata['url'] # type: ignore @@ -1461,7 +1516,7 @@ def list_vnets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1503,9 +1558,12 @@ def get_vnet_from_server_farm( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore @@ -1523,7 +1581,7 @@ def get_vnet_from_server_farm( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1570,9 +1628,12 @@ def get_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_vnet_gateway.metadata['url'] # type: ignore @@ -1591,7 +1652,7 @@ def get_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1639,10 +1700,13 @@ def update_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_gateway.metadata['url'] # type: ignore @@ -1662,13 +1726,12 @@ def update_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -1708,9 +1771,12 @@ def list_routes_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.list_routes_for_vnet.metadata['url'] # type: ignore @@ -1728,7 +1794,7 @@ def list_routes_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1773,9 +1839,12 @@ def get_route_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" + accept = "application/json" # Construct URL url = self.get_route_for_vnet.metadata['url'] # type: ignore @@ -1794,7 +1863,7 @@ def get_route_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1844,10 +1913,13 @@ def create_or_update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_route.metadata['url'] # type: ignore @@ -1867,13 +1939,12 @@ def create_or_update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1918,7 +1989,9 @@ def delete_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1983,10 +2056,13 @@ def update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_route.metadata['url'] # type: ignore @@ -2006,13 +2082,12 @@ def update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -2054,7 +2129,9 @@ def reboot_worker( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py index 9f338026cff6..20b106b6e2da 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2018-02-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json index 291d81148549..8d301fc99de1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": true }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "app_service_certificate_orders": "AppServiceCertificateOrdersOperations", @@ -270,6 +272,6 @@ "call": "resource_group_name, move_resource_envelope" } }, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py index d322680c76e8..0fae3013eec7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py @@ -90,6 +90,7 @@ def __init__( 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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration.py index e19d910addc6..af56b6258589 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2018-02-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py similarity index 78% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py index d0a2d875a28b..767f88832c8b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py @@ -15,22 +15,22 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import AppServiceCertificateOrdersOperations -from .operations_async import CertificateRegistrationProviderOperations -from .operations_async import DomainsOperations -from .operations_async import TopLevelDomainsOperations -from .operations_async import DomainRegistrationProviderOperations -from .operations_async import CertificatesOperations -from .operations_async import DeletedWebAppsOperations -from .operations_async import DiagnosticsOperations -from .operations_async import ProviderOperations -from .operations_async import RecommendationsOperations -from .operations_async import WebSiteManagementClientOperationsMixin -from .operations_async import WebAppsOperations -from .operations_async import AppServiceEnvironmentsOperations -from .operations_async import AppServicePlansOperations -from .operations_async import ResourceHealthMetadataOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import AppServiceCertificateOrdersOperations +from .operations import CertificateRegistrationProviderOperations +from .operations import DomainsOperations +from .operations import TopLevelDomainsOperations +from .operations import DomainRegistrationProviderOperations +from .operations import CertificatesOperations +from .operations import DeletedWebAppsOperations +from .operations import DiagnosticsOperations +from .operations import ProviderOperations +from .operations import RecommendationsOperations +from .operations import WebSiteManagementClientOperationsMixin +from .operations import WebAppsOperations +from .operations import AppServiceEnvironmentsOperations +from .operations import AppServicePlansOperations +from .operations import ResourceHealthMetadataOperations from .. import models @@ -38,33 +38,33 @@ class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): """WebSite Management Client. :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations - :vartype app_service_certificate_orders: azure.mgmt.web.v2018_02_01.aio.operations_async.AppServiceCertificateOrdersOperations + :vartype app_service_certificate_orders: azure.mgmt.web.v2018_02_01.aio.operations.AppServiceCertificateOrdersOperations :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations - :vartype certificate_registration_provider: azure.mgmt.web.v2018_02_01.aio.operations_async.CertificateRegistrationProviderOperations + :vartype certificate_registration_provider: azure.mgmt.web.v2018_02_01.aio.operations.CertificateRegistrationProviderOperations :ivar domains: DomainsOperations operations - :vartype domains: azure.mgmt.web.v2018_02_01.aio.operations_async.DomainsOperations + :vartype domains: azure.mgmt.web.v2018_02_01.aio.operations.DomainsOperations :ivar top_level_domains: TopLevelDomainsOperations operations - :vartype top_level_domains: azure.mgmt.web.v2018_02_01.aio.operations_async.TopLevelDomainsOperations + :vartype top_level_domains: azure.mgmt.web.v2018_02_01.aio.operations.TopLevelDomainsOperations :ivar domain_registration_provider: DomainRegistrationProviderOperations operations - :vartype domain_registration_provider: azure.mgmt.web.v2018_02_01.aio.operations_async.DomainRegistrationProviderOperations + :vartype domain_registration_provider: azure.mgmt.web.v2018_02_01.aio.operations.DomainRegistrationProviderOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.web.v2018_02_01.aio.operations_async.CertificatesOperations + :vartype certificates: azure.mgmt.web.v2018_02_01.aio.operations.CertificatesOperations :ivar deleted_web_apps: DeletedWebAppsOperations operations - :vartype deleted_web_apps: azure.mgmt.web.v2018_02_01.aio.operations_async.DeletedWebAppsOperations + :vartype deleted_web_apps: azure.mgmt.web.v2018_02_01.aio.operations.DeletedWebAppsOperations :ivar diagnostics: DiagnosticsOperations operations - :vartype diagnostics: azure.mgmt.web.v2018_02_01.aio.operations_async.DiagnosticsOperations + :vartype diagnostics: azure.mgmt.web.v2018_02_01.aio.operations.DiagnosticsOperations :ivar provider: ProviderOperations operations - :vartype provider: azure.mgmt.web.v2018_02_01.aio.operations_async.ProviderOperations + :vartype provider: azure.mgmt.web.v2018_02_01.aio.operations.ProviderOperations :ivar recommendations: RecommendationsOperations operations - :vartype recommendations: azure.mgmt.web.v2018_02_01.aio.operations_async.RecommendationsOperations + :vartype recommendations: azure.mgmt.web.v2018_02_01.aio.operations.RecommendationsOperations :ivar web_apps: WebAppsOperations operations - :vartype web_apps: azure.mgmt.web.v2018_02_01.aio.operations_async.WebAppsOperations + :vartype web_apps: azure.mgmt.web.v2018_02_01.aio.operations.WebAppsOperations :ivar app_service_environments: AppServiceEnvironmentsOperations operations - :vartype app_service_environments: azure.mgmt.web.v2018_02_01.aio.operations_async.AppServiceEnvironmentsOperations + :vartype app_service_environments: azure.mgmt.web.v2018_02_01.aio.operations.AppServiceEnvironmentsOperations :ivar app_service_plans: AppServicePlansOperations operations - :vartype app_service_plans: azure.mgmt.web.v2018_02_01.aio.operations_async.AppServicePlansOperations + :vartype app_service_plans: azure.mgmt.web.v2018_02_01.aio.operations.AppServicePlansOperations :ivar resource_health_metadata: ResourceHealthMetadataOperations operations - :vartype resource_health_metadata: azure.mgmt.web.v2018_02_01.aio.operations_async.ResourceHealthMetadataOperations + :vartype resource_health_metadata: azure.mgmt.web.v2018_02_01.aio.operations.ResourceHealthMetadataOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). @@ -87,6 +87,7 @@ def __init__( 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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/__init__.py new file mode 100644 index 000000000000..abb596e5aa8b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/__init__.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_service_certificate_orders_operations import AppServiceCertificateOrdersOperations +from ._certificate_registration_provider_operations import CertificateRegistrationProviderOperations +from ._domains_operations import DomainsOperations +from ._top_level_domains_operations import TopLevelDomainsOperations +from ._domain_registration_provider_operations import DomainRegistrationProviderOperations +from ._certificates_operations import CertificatesOperations +from ._deleted_web_apps_operations import DeletedWebAppsOperations +from ._diagnostics_operations import DiagnosticsOperations +from ._provider_operations import ProviderOperations +from ._recommendations_operations import RecommendationsOperations +from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin +from ._web_apps_operations import WebAppsOperations +from ._app_service_environments_operations import AppServiceEnvironmentsOperations +from ._app_service_plans_operations import AppServicePlansOperations +from ._resource_health_metadata_operations import ResourceHealthMetadataOperations + +__all__ = [ + 'AppServiceCertificateOrdersOperations', + 'CertificateRegistrationProviderOperations', + 'DomainsOperations', + 'TopLevelDomainsOperations', + 'DomainRegistrationProviderOperations', + 'CertificatesOperations', + 'DeletedWebAppsOperations', + 'DiagnosticsOperations', + 'ProviderOperations', + 'RecommendationsOperations', + 'WebSiteManagementClientOperationsMixin', + 'WebAppsOperations', + 'AppServiceEnvironmentsOperations', + 'AppServicePlansOperations', + 'ResourceHealthMetadataOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py similarity index 94% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py index 0d2297aeca88..eedcdd1fafa8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_certificate_orders_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -126,7 +129,9 @@ async def validate_purchase_information( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -150,7 +155,6 @@ async def validate_purchase_information( body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') 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 @@ -180,14 +184,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -253,9 +260,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -272,7 +282,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -299,10 +309,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServiceCertificateOrder": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -320,13 +333,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') 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 @@ -434,7 +446,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -490,10 +504,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -511,13 +528,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') 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 @@ -558,14 +574,17 @@ def list_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -635,9 +654,12 @@ async def get_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_certificate.metadata['url'] # type: ignore @@ -655,7 +677,7 @@ async def get_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -683,10 +705,13 @@ async def _create_or_update_certificate_initial( **kwargs ) -> "models.AppServiceCertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore @@ -705,13 +730,12 @@ async def _create_or_update_certificate_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') 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 @@ -826,7 +850,9 @@ async def delete_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -886,10 +912,13 @@ async def update_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_certificate.metadata['url'] # type: ignore @@ -908,13 +937,12 @@ async def update_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') 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 @@ -958,7 +986,9 @@ async def reissue( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -984,7 +1014,6 @@ async def reissue( body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') 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 @@ -1020,7 +1049,9 @@ async def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1046,7 +1077,6 @@ async def renew( body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') 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 @@ -1079,7 +1109,9 @@ async def resend_email( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1135,7 +1167,9 @@ async def resend_request_emails( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1161,7 +1195,6 @@ async def resend_request_emails( body_content = self._serialize.body(name_identifier, 'NameIdentifier') 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 @@ -1197,10 +1230,13 @@ async def retrieve_site_seal( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.retrieve_site_seal.metadata['url'] # type: ignore @@ -1218,13 +1254,12 @@ async def retrieve_site_seal( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') 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 @@ -1261,7 +1296,9 @@ async def verify_domain_ownership( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1314,9 +1351,12 @@ async def retrieve_certificate_actions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_actions.metadata['url'] # type: ignore @@ -1333,7 +1373,7 @@ async def retrieve_certificate_actions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1372,9 +1412,12 @@ async def retrieve_certificate_email_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore @@ -1391,7 +1434,7 @@ async def retrieve_certificate_email_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py similarity index 94% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py index 25b35b46b051..9140a134ea1d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_environments_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -126,14 +129,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -199,9 +205,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -218,7 +227,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -245,10 +254,13 @@ async def _create_or_update_initial( **kwargs ) -> Optional["models.AppServiceEnvironmentResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -266,13 +278,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') 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 @@ -368,7 +379,9 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -491,10 +504,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -512,13 +528,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') 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 @@ -559,14 +574,17 @@ def list_capacities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -633,9 +651,12 @@ async def list_vips( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vips.metadata['url'] # type: ignore @@ -652,7 +673,7 @@ async def list_vips( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -679,10 +700,13 @@ async def _change_vnet_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._change_vnet_initial.metadata['url'] # type: ignore @@ -700,13 +724,12 @@ async def _change_vnet_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') 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 @@ -755,16 +778,19 @@ async def begin_change_vnet( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -783,7 +809,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -791,7 +816,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -876,9 +900,12 @@ async def list_diagnostics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_diagnostics.metadata['url'] # type: ignore @@ -895,7 +922,7 @@ async def list_diagnostics( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -937,9 +964,12 @@ async def get_diagnostics_item( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_diagnostics_item.metadata['url'] # type: ignore @@ -957,7 +987,7 @@ async def get_diagnostics_item( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -996,14 +1026,17 @@ def get_inbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1070,9 +1103,12 @@ async def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_metric_definitions.metadata['url'] # type: ignore @@ -1089,7 +1125,7 @@ async def list_metric_definitions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1138,14 +1174,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1216,14 +1255,17 @@ def list_multi_role_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1290,9 +1332,12 @@ async def get_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_multi_role_pool.metadata['url'] # type: ignore @@ -1309,7 +1354,7 @@ async def get_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1336,10 +1381,13 @@ async def _create_or_update_multi_role_pool_initial( **kwargs ) -> Optional["models.WorkerPoolResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore @@ -1357,13 +1405,12 @@ async def _create_or_update_multi_role_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1474,10 +1521,13 @@ async def update_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_multi_role_pool.metadata['url'] # type: ignore @@ -1495,13 +1545,12 @@ async def update_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1546,14 +1595,17 @@ def list_multi_role_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1628,14 +1680,17 @@ def list_multi_role_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1705,14 +1760,17 @@ def list_multi_role_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1798,14 +1856,17 @@ def list_multi_role_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1882,14 +1943,17 @@ def list_multi_role_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1956,14 +2020,17 @@ def list_multi_role_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2030,9 +2097,12 @@ async def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -2049,7 +2119,7 @@ async def list_operations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2088,14 +2158,17 @@ def get_outbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2162,7 +2235,9 @@ async def reboot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -2202,9 +2277,12 @@ async def _resume_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._resume_initial.metadata['url'] # type: ignore @@ -2221,7 +2299,7 @@ async def _resume_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2269,14 +2347,17 @@ async def begin_resume( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2379,14 +2460,17 @@ def list_app_service_plans( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2456,14 +2540,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2519,9 +2606,12 @@ async def _suspend_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._suspend_initial.metadata['url'] # type: ignore @@ -2538,7 +2628,7 @@ async def _suspend_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2586,14 +2676,17 @@ async def begin_suspend( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2702,14 +2795,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2778,14 +2874,17 @@ def list_worker_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2855,9 +2954,12 @@ async def get_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_worker_pool.metadata['url'] # type: ignore @@ -2875,7 +2977,7 @@ async def get_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2903,10 +3005,13 @@ async def _create_or_update_worker_pool_initial( **kwargs ) -> Optional["models.WorkerPoolResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore @@ -2925,13 +3030,12 @@ async def _create_or_update_worker_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -3049,10 +3153,13 @@ async def update_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_worker_pool.metadata['url'] # type: ignore @@ -3071,13 +3178,12 @@ async def update_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -3124,14 +3230,17 @@ def list_worker_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3216,14 +3325,17 @@ def list_worker_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3299,14 +3411,17 @@ def list_web_worker_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3387,14 +3502,17 @@ def list_web_worker_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3469,14 +3587,17 @@ def list_worker_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3547,14 +3668,17 @@ def list_web_worker_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py index 42d823b97dc4..6495ab86d20a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_app_service_plans_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -133,14 +136,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,9 +212,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -225,7 +234,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -253,10 +262,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServicePlan": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -274,13 +286,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') 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 @@ -391,7 +402,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -447,10 +460,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -468,13 +484,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') 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 @@ -515,9 +530,12 @@ async def list_capabilities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_capabilities.metadata['url'] # type: ignore @@ -534,7 +552,7 @@ async def list_capabilities( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -579,9 +597,12 @@ async def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -600,7 +621,7 @@ async def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -645,7 +666,9 @@ async def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -706,9 +729,12 @@ async def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -727,7 +753,7 @@ async def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -772,14 +798,17 @@ def list_web_apps_by_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -848,9 +877,12 @@ async def get_hybrid_connection_plan_limit( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore @@ -867,7 +899,7 @@ async def get_hybrid_connection_plan_limit( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -906,14 +938,17 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -980,14 +1015,17 @@ def list_metric_defintions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1064,14 +1102,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1147,7 +1188,9 @@ async def restart_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1214,14 +1257,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1294,9 +1340,12 @@ async def get_server_farm_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_server_farm_skus.metadata['url'] # type: ignore @@ -1313,7 +1362,7 @@ async def get_server_farm_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1356,14 +1405,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1432,9 +1484,12 @@ async def list_vnets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vnets.metadata['url'] # type: ignore @@ -1451,7 +1506,7 @@ async def list_vnets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1493,9 +1548,12 @@ async def get_vnet_from_server_farm( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore @@ -1513,7 +1571,7 @@ async def get_vnet_from_server_farm( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1559,9 +1617,12 @@ async def get_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_gateway.metadata['url'] # type: ignore @@ -1580,7 +1641,7 @@ async def get_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1628,10 +1689,13 @@ async def update_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_gateway.metadata['url'] # type: ignore @@ -1651,13 +1715,12 @@ async def update_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -1697,9 +1760,12 @@ async def list_routes_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_routes_for_vnet.metadata['url'] # type: ignore @@ -1717,7 +1783,7 @@ async def list_routes_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1762,9 +1828,12 @@ async def get_route_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_route_for_vnet.metadata['url'] # type: ignore @@ -1783,7 +1852,7 @@ async def get_route_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1832,10 +1901,13 @@ async def create_or_update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_route.metadata['url'] # type: ignore @@ -1855,13 +1927,12 @@ async def create_or_update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1905,7 +1976,9 @@ async def delete_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1969,10 +2042,13 @@ async def update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_route.metadata['url'] # type: ignore @@ -1992,13 +2068,12 @@ async def update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -2039,7 +2114,9 @@ async def reboot_worker( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py index b6a38554fbcf..f4c09e3df117 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificate_registration_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -56,14 +56,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py index 059398a2c00c..afe68517e511 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_certificates_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -258,10 +267,13 @@ async def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -279,13 +291,12 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -322,7 +333,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -378,10 +391,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -399,13 +415,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py index 41ffdebddde6..e89f3cf26589 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_deleted_web_apps_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get_deleted_web_app_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get_deleted_web_app_by_location( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py index 5a668416703e..21b26fb3cf1e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_diagnostics_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py @@ -10,7 +10,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -62,14 +62,17 @@ def list_hosting_environment_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -148,9 +151,12 @@ async def get_hosting_environment_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore @@ -174,7 +180,7 @@ async def get_hosting_environment_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -213,14 +219,17 @@ def list_site_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -299,9 +308,12 @@ async def get_site_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response.metadata['url'] # type: ignore @@ -325,7 +337,7 @@ async def get_site_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -364,14 +376,17 @@ def list_site_diagnostic_categories( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -441,9 +456,12 @@ async def get_site_diagnostic_category( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category.metadata['url'] # type: ignore @@ -461,7 +479,7 @@ async def get_site_diagnostic_category( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -503,14 +521,17 @@ def list_site_analyses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -584,9 +605,12 @@ async def get_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_analysis.metadata['url'] # type: ignore @@ -605,7 +629,7 @@ async def get_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -659,9 +683,12 @@ async def execute_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis.metadata['url'] # type: ignore @@ -686,7 +713,7 @@ async def execute_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -728,14 +755,17 @@ def list_site_detectors( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -809,14 +839,17 @@ def get_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -900,9 +933,12 @@ async def execute_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_detector.metadata['url'] # type: ignore @@ -927,7 +963,7 @@ async def execute_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -969,14 +1005,17 @@ def list_site_detector_responses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1059,9 +1098,12 @@ async def get_site_detector_response_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response_slot.metadata['url'] # type: ignore @@ -1086,7 +1128,7 @@ async def get_site_detector_response_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1128,14 +1170,17 @@ def list_site_diagnostic_categories_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1209,9 +1254,12 @@ async def get_site_diagnostic_category_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore @@ -1230,7 +1278,7 @@ async def get_site_diagnostic_category_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1275,14 +1323,17 @@ def list_site_analyses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1360,9 +1411,12 @@ async def get_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_analysis_slot.metadata['url'] # type: ignore @@ -1382,7 +1436,7 @@ async def get_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1439,9 +1493,12 @@ async def execute_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis_slot.metadata['url'] # type: ignore @@ -1467,7 +1524,7 @@ async def execute_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1512,14 +1569,17 @@ def list_site_detectors_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1597,14 +1657,17 @@ def get_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1692,9 +1755,12 @@ async def execute_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_detector_slot.metadata['url'] # type: ignore @@ -1720,7 +1786,7 @@ async def execute_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py index f90d9bff82ce..2686b8ca377d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domain_registration_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -56,14 +56,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py index ff07ee58a795..87447b3e41fe 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_domains_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -60,10 +60,13 @@ async def check_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_availability.metadata['url'] # type: ignore @@ -79,13 +82,12 @@ async def check_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') 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 @@ -116,14 +118,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -182,9 +187,12 @@ async def get_control_center_sso_request( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_control_center_sso_request.metadata['url'] # type: ignore @@ -199,7 +207,7 @@ async def get_control_center_sso_request( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -235,16 +243,19 @@ def list_recommendations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -261,7 +272,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -269,7 +279,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -314,14 +323,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -387,9 +399,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -406,7 +421,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -433,10 +448,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Domain": cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -454,13 +472,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') 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 @@ -572,7 +589,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -630,10 +649,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -651,13 +673,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') 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 @@ -698,14 +719,17 @@ def list_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -775,9 +799,12 @@ async def get_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ownership_identifier.metadata['url'] # type: ignore @@ -795,7 +822,7 @@ async def get_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -841,10 +868,13 @@ async def create_or_update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore @@ -863,13 +893,12 @@ async def create_or_update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -909,7 +938,9 @@ async def delete_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -970,10 +1001,13 @@ async def update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ownership_identifier.metadata['url'] # type: ignore @@ -992,13 +1026,12 @@ async def update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -1035,7 +1068,9 @@ async def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py index 649a181a6b72..12d1ed822772 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -58,14 +58,17 @@ def get_available_stacks( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -123,14 +126,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -188,14 +194,17 @@ def get_available_stacks_on_prem( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py similarity index 94% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py index b22e63f3eda8..f8006a294f5c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_recommendations_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -64,14 +64,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -134,7 +137,9 @@ async def reset_all_filters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -182,7 +187,9 @@ async def disable_recommendation_for_subscription( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -243,14 +250,17 @@ def list_history_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -329,14 +339,17 @@ def list_recommended_rules_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -410,7 +423,9 @@ async def disable_all_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -467,7 +482,9 @@ async def reset_all_filters_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -532,9 +549,12 @@ async def get_rule_details_by_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore @@ -556,7 +576,7 @@ async def get_rule_details_by_hosting_environment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -601,7 +621,9 @@ async def disable_recommendation_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -665,14 +687,17 @@ def list_history_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -751,14 +776,17 @@ def list_recommended_rules_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -829,7 +857,9 @@ async def disable_all_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -882,7 +912,9 @@ async def reset_all_filters_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -946,9 +978,12 @@ async def get_rule_details_by_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore @@ -970,7 +1005,7 @@ async def get_rule_details_by_web_app( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1012,7 +1047,9 @@ async def disable_recommendation_for_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py index 09ec6ccf96a2..4bab97b607dc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_resource_health_metadata_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,14 +203,17 @@ def list_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -271,9 +280,12 @@ async def get_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_by_site.metadata['url'] # type: ignore @@ -290,7 +302,7 @@ async def get_by_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -332,14 +344,17 @@ def list_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -410,9 +425,12 @@ async def get_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_by_site_slot.metadata['url'] # type: ignore @@ -430,7 +448,7 @@ async def get_by_site_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py index 049e7ddfd626..60678dfbc1ea 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_top_level_domains_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,9 +127,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -142,7 +148,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -181,16 +187,19 @@ def list_agreements( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -208,7 +217,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -216,7 +224,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py index 532c466b016f..47270e46b083 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_apps_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -205,9 +211,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -224,7 +233,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -252,10 +261,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Site": cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -273,13 +285,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -396,7 +407,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -458,10 +471,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -479,13 +495,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -529,9 +544,12 @@ async def analyze_custom_hostname( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname.metadata['url'] # type: ignore @@ -550,7 +568,7 @@ async def analyze_custom_hostname( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -592,7 +610,9 @@ async def apply_slot_config_to_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -618,7 +638,6 @@ async def apply_slot_config_to_production( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -655,10 +674,13 @@ async def backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup.metadata['url'] # type: ignore @@ -676,13 +698,12 @@ async def backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -719,14 +740,17 @@ def list_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -796,9 +820,12 @@ async def get_backup_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_status.metadata['url'] # type: ignore @@ -816,7 +843,7 @@ async def get_backup_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -858,7 +885,9 @@ async def delete_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -920,10 +949,13 @@ async def list_backup_status_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets.metadata['url'] # type: ignore @@ -942,13 +974,12 @@ async def list_backup_status_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -974,7 +1005,9 @@ async def _restore_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1001,7 +1034,6 @@ async def _restore_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -1102,14 +1134,17 @@ def list_configurations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1179,10 +1214,13 @@ async def update_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings.metadata['url'] # type: ignore @@ -1200,13 +1238,12 @@ async def update_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1243,9 +1280,12 @@ async def list_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_application_settings.metadata['url'] # type: ignore @@ -1262,7 +1302,7 @@ async def list_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1304,10 +1344,13 @@ async def update_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings.metadata['url'] # type: ignore @@ -1325,13 +1368,12 @@ async def update_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -1368,9 +1410,12 @@ async def get_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_auth_settings.metadata['url'] # type: ignore @@ -1387,7 +1432,7 @@ async def get_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1429,10 +1474,13 @@ async def update_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts.metadata['url'] # type: ignore @@ -1450,13 +1498,12 @@ async def update_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -1493,9 +1540,12 @@ async def list_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts.metadata['url'] # type: ignore @@ -1512,7 +1562,7 @@ async def list_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1554,10 +1604,13 @@ async def update_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration.metadata['url'] # type: ignore @@ -1575,13 +1628,12 @@ async def update_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1618,7 +1670,9 @@ async def delete_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1671,9 +1725,12 @@ async def get_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration.metadata['url'] # type: ignore @@ -1690,7 +1747,7 @@ async def get_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1732,10 +1789,13 @@ async def update_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings.metadata['url'] # type: ignore @@ -1753,13 +1813,12 @@ async def update_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -1796,9 +1855,12 @@ async def list_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_connection_strings.metadata['url'] # type: ignore @@ -1815,7 +1877,7 @@ async def list_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1854,9 +1916,12 @@ async def get_diagnostic_logs_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore @@ -1873,7 +1938,7 @@ async def get_diagnostic_logs_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1916,10 +1981,13 @@ async def update_diagnostic_logs_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore @@ -1937,13 +2005,12 @@ async def update_diagnostic_logs_config( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -1983,10 +2050,13 @@ async def update_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata.metadata['url'] # type: ignore @@ -2004,13 +2074,12 @@ async def update_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -2047,9 +2116,12 @@ async def list_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_metadata.metadata['url'] # type: ignore @@ -2066,7 +2138,7 @@ async def list_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2092,9 +2164,12 @@ async def _list_publishing_credentials_initial( **kwargs ) -> "models.User": cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore @@ -2111,7 +2186,7 @@ async def _list_publishing_credentials_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2216,10 +2291,13 @@ async def update_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings.metadata['url'] # type: ignore @@ -2237,13 +2315,12 @@ async def update_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -2280,9 +2357,12 @@ async def list_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings.metadata['url'] # type: ignore @@ -2299,7 +2379,7 @@ async def list_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2338,9 +2418,12 @@ async def list_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_slot_configuration_names.metadata['url'] # type: ignore @@ -2357,7 +2440,7 @@ async def list_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2400,10 +2483,13 @@ async def update_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot_configuration_names.metadata['url'] # type: ignore @@ -2421,13 +2507,12 @@ async def update_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') 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 @@ -2465,9 +2550,12 @@ async def get_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration.metadata['url'] # type: ignore @@ -2484,7 +2572,7 @@ async def get_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2526,10 +2614,13 @@ async def create_or_update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration.metadata['url'] # type: ignore @@ -2547,13 +2638,12 @@ async def create_or_update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2593,10 +2683,13 @@ async def update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration.metadata['url'] # type: ignore @@ -2614,13 +2707,12 @@ async def update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2658,14 +2750,17 @@ def list_configuration_snapshot_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2735,9 +2830,12 @@ async def get_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot.metadata['url'] # type: ignore @@ -2755,7 +2853,7 @@ async def get_configuration_snapshot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2797,7 +2895,9 @@ async def recover_site_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -2851,9 +2951,12 @@ async def get_web_site_container_logs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs.metadata['url'] # type: ignore @@ -2870,7 +2973,7 @@ async def get_web_site_container_logs( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -2910,9 +3013,12 @@ async def get_container_logs_zip( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip.metadata['url'] # type: ignore @@ -2929,7 +3035,7 @@ async def get_container_logs_zip( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -2969,14 +3075,17 @@ def list_continuous_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3046,9 +3155,12 @@ async def get_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job.metadata['url'] # type: ignore @@ -3066,7 +3178,7 @@ async def get_continuous_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3109,7 +3221,9 @@ async def delete_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3166,7 +3280,9 @@ async def start_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3223,7 +3339,9 @@ async def stop_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3277,14 +3395,17 @@ def list_deployments( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3354,9 +3475,12 @@ async def get_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_deployment.metadata['url'] # type: ignore @@ -3374,7 +3498,7 @@ async def get_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3419,10 +3543,13 @@ async def create_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment.metadata['url'] # type: ignore @@ -3441,13 +3568,12 @@ async def create_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -3487,7 +3613,9 @@ async def delete_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3545,9 +3673,12 @@ async def list_deployment_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_deployment_log.metadata['url'] # type: ignore @@ -3565,7 +3696,7 @@ async def list_deployment_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3609,10 +3740,13 @@ async def discover_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup.metadata['url'] # type: ignore @@ -3630,13 +3764,12 @@ async def discover_backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -3673,14 +3806,17 @@ def list_domain_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3750,9 +3886,12 @@ async def get_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3770,7 +3909,7 @@ async def get_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3815,10 +3954,13 @@ async def create_or_update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3837,13 +3979,12 @@ async def create_or_update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -3883,7 +4024,9 @@ async def delete_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3943,10 +4086,13 @@ async def update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3965,13 +4111,12 @@ async def update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -4008,9 +4153,12 @@ async def get_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status.metadata['url'] # type: ignore @@ -4027,7 +4175,7 @@ async def get_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4054,10 +4202,13 @@ async def _create_ms_deploy_operation_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -4075,13 +4226,12 @@ async def _create_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -4186,9 +4336,12 @@ async def get_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log.metadata['url'] # type: ignore @@ -4205,7 +4358,7 @@ async def get_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4245,14 +4398,17 @@ def list_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4318,9 +4474,12 @@ async def get_functions_admin_token( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token.metadata['url'] # type: ignore @@ -4337,7 +4496,7 @@ async def get_functions_admin_token( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4379,9 +4538,12 @@ async def get_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_function.metadata['url'] # type: ignore @@ -4399,7 +4561,7 @@ async def get_function( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4428,10 +4590,13 @@ async def _create_function_initial( **kwargs ) -> "models.FunctionEnvelope": cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_function_initial.metadata['url'] # type: ignore @@ -4450,13 +4615,12 @@ async def _create_function_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -4567,7 +4731,9 @@ async def delete_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -4630,10 +4796,13 @@ async def create_or_update_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret.metadata['url'] # type: ignore @@ -4653,13 +4822,12 @@ async def create_or_update_function_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -4706,7 +4874,9 @@ async def delete_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -4764,9 +4934,12 @@ async def list_function_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_keys.metadata['url'] # type: ignore @@ -4784,7 +4957,7 @@ async def list_function_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4826,9 +4999,12 @@ async def list_function_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_secrets.metadata['url'] # type: ignore @@ -4846,7 +5022,7 @@ async def list_function_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4885,9 +5061,12 @@ async def list_host_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_host_keys.metadata['url'] # type: ignore @@ -4904,7 +5083,7 @@ async def list_host_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4943,9 +5122,12 @@ async def list_sync_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_status.metadata['url'] # type: ignore @@ -4962,6 +5144,7 @@ async def list_sync_status( # 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) @@ -4997,7 +5180,9 @@ async def sync_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -5059,10 +5244,13 @@ async def create_or_update_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret.metadata['url'] # type: ignore @@ -5082,13 +5270,12 @@ async def create_or_update_host_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -5135,9 +5322,12 @@ async def delete_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.delete_host_secret.metadata['url'] # type: ignore @@ -5156,6 +5346,7 @@ async def delete_host_secret( # 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) @@ -5191,14 +5382,17 @@ def list_host_name_bindings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5268,9 +5462,12 @@ async def get_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding.metadata['url'] # type: ignore @@ -5288,7 +5485,7 @@ async def get_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5334,10 +5531,13 @@ async def create_or_update_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore @@ -5356,13 +5556,12 @@ async def create_or_update_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -5402,7 +5601,9 @@ async def delete_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -5462,9 +5663,12 @@ async def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -5483,7 +5687,7 @@ async def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5531,10 +5735,13 @@ async def create_or_update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore @@ -5554,13 +5761,12 @@ async def create_or_update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5603,7 +5809,9 @@ async def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -5667,10 +5875,13 @@ async def update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection.metadata['url'] # type: ignore @@ -5690,13 +5901,12 @@ async def update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5739,9 +5949,12 @@ async def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -5760,7 +5973,7 @@ async def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5799,9 +6012,12 @@ async def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections.metadata['url'] # type: ignore @@ -5818,7 +6034,7 @@ async def list_hybrid_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5857,9 +6073,12 @@ async def list_relay_service_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections.metadata['url'] # type: ignore @@ -5876,7 +6095,7 @@ async def list_relay_service_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5918,9 +6137,12 @@ async def get_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection.metadata['url'] # type: ignore @@ -5938,7 +6160,7 @@ async def get_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5983,10 +6205,13 @@ async def create_or_update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore @@ -6005,13 +6230,12 @@ async def create_or_update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6051,7 +6275,9 @@ async def delete_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -6111,10 +6337,13 @@ async def update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection.metadata['url'] # type: ignore @@ -6133,13 +6362,12 @@ async def update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6176,14 +6404,17 @@ def list_instance_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6253,9 +6484,12 @@ async def get_instance_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore @@ -6273,7 +6507,7 @@ async def get_instance_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6301,10 +6535,13 @@ async def _create_instance_ms_deploy_operation_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -6323,13 +6560,12 @@ async def _create_instance_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -6441,9 +6677,12 @@ async def get_instance_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore @@ -6461,7 +6700,7 @@ async def get_instance_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6506,14 +6745,17 @@ def list_instance_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6587,9 +6829,12 @@ async def get_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process.metadata['url'] # type: ignore @@ -6608,7 +6853,7 @@ async def get_instance_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6656,7 +6901,9 @@ async def delete_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -6718,9 +6965,12 @@ async def get_instance_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump.metadata['url'] # type: ignore @@ -6739,7 +6989,7 @@ async def get_instance_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -6787,14 +7037,17 @@ def list_instance_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6872,9 +7125,12 @@ async def get_instance_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module.metadata['url'] # type: ignore @@ -6894,7 +7150,7 @@ async def get_instance_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6941,14 +7197,17 @@ def list_instance_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7027,9 +7286,12 @@ async def get_instance_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread.metadata['url'] # type: ignore @@ -7049,7 +7311,7 @@ async def get_instance_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7089,9 +7351,12 @@ async def is_cloneable( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.is_cloneable.metadata['url'] # type: ignore @@ -7108,7 +7373,7 @@ async def is_cloneable( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7147,9 +7412,12 @@ async def list_sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers.metadata['url'] # type: ignore @@ -7166,7 +7434,7 @@ async def list_sync_function_triggers( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7205,14 +7473,17 @@ def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7289,14 +7560,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7356,10 +7630,13 @@ async def _migrate_storage_initial( **kwargs ) -> "models.StorageMigrationResponse": cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_storage_initial.metadata['url'] # type: ignore @@ -7378,13 +7655,12 @@ async def _migrate_storage_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') 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 @@ -7480,10 +7756,13 @@ async def _migrate_my_sql_initial( **kwargs ) -> "models.Operation": cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_my_sql_initial.metadata['url'] # type: ignore @@ -7501,13 +7780,12 @@ async def _migrate_my_sql_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') 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 @@ -7612,9 +7890,12 @@ async def get_migrate_my_sql_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore @@ -7631,7 +7912,7 @@ async def get_migrate_my_sql_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7670,9 +7951,12 @@ async def get_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -7689,7 +7973,7 @@ async def get_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7735,10 +8019,13 @@ async def create_or_update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -7756,13 +8043,12 @@ async def create_or_update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -7799,7 +8085,9 @@ async def delete_swift_virtual_network( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -7859,10 +8147,13 @@ async def update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -7880,13 +8171,12 @@ async def update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -7926,9 +8216,12 @@ async def list_network_features( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_network_features.metadata['url'] # type: ignore @@ -7946,7 +8239,7 @@ async def list_network_features( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7989,9 +8282,12 @@ async def get_network_trace_operation( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation.metadata['url'] # type: ignore @@ -8009,7 +8305,7 @@ async def get_network_trace_operation( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8061,9 +8357,12 @@ async def start_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace.metadata['url'] # type: ignore @@ -8086,7 +8385,7 @@ async def start_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8115,9 +8414,12 @@ async def _start_web_site_network_trace_operation_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore @@ -8140,7 +8442,7 @@ async def _start_web_site_network_trace_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8258,7 +8560,9 @@ async def stop_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -8314,9 +8618,12 @@ async def get_network_traces( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces.metadata['url'] # type: ignore @@ -8334,7 +8641,7 @@ async def get_network_traces( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8376,9 +8683,12 @@ async def get_network_trace_operation_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore @@ -8396,7 +8706,7 @@ async def get_network_trace_operation_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8442,9 +8752,12 @@ async def get_network_traces_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces_v2.metadata['url'] # type: ignore @@ -8462,7 +8775,7 @@ async def get_network_traces_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8501,7 +8814,9 @@ async def generate_new_site_publishing_password( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -8559,14 +8874,17 @@ def list_perf_mon_counters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8635,9 +8953,12 @@ async def get_site_php_error_log_flag( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore @@ -8654,7 +8975,7 @@ async def get_site_php_error_log_flag( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8693,9 +9014,12 @@ async def list_premier_add_ons( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons.metadata['url'] # type: ignore @@ -8712,7 +9036,7 @@ async def list_premier_add_ons( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8754,9 +9078,12 @@ async def get_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on.metadata['url'] # type: ignore @@ -8774,7 +9101,7 @@ async def get_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8819,10 +9146,13 @@ async def add_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on.metadata['url'] # type: ignore @@ -8841,13 +9171,12 @@ async def add_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -8887,7 +9216,9 @@ async def delete_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -8947,10 +9278,13 @@ async def update_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on.metadata['url'] # type: ignore @@ -8969,13 +9303,12 @@ async def update_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -9013,9 +9346,12 @@ async def get_private_access( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_private_access.metadata['url'] # type: ignore @@ -9032,7 +9368,7 @@ async def get_private_access( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9075,10 +9411,13 @@ async def put_private_access_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet.metadata['url'] # type: ignore @@ -9096,13 +9435,12 @@ async def put_private_access_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -9140,14 +9478,17 @@ def list_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9216,9 +9557,12 @@ async def get_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process.metadata['url'] # type: ignore @@ -9236,7 +9580,7 @@ async def get_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9280,7 +9624,9 @@ async def delete_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -9337,9 +9683,12 @@ async def get_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_dump.metadata['url'] # type: ignore @@ -9357,7 +9706,7 @@ async def get_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -9401,14 +9750,17 @@ def list_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9481,9 +9833,12 @@ async def get_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_module.metadata['url'] # type: ignore @@ -9502,7 +9857,7 @@ async def get_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9545,14 +9900,17 @@ def list_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9626,9 +9984,12 @@ async def get_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_thread.metadata['url'] # type: ignore @@ -9647,7 +10008,7 @@ async def get_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9687,14 +10048,17 @@ def list_public_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9764,9 +10128,12 @@ async def get_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_public_certificate.metadata['url'] # type: ignore @@ -9784,7 +10151,7 @@ async def get_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9830,10 +10197,13 @@ async def create_or_update_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate.metadata['url'] # type: ignore @@ -9852,13 +10222,12 @@ async def create_or_update_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -9898,7 +10267,9 @@ async def delete_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -9956,10 +10327,13 @@ async def list_publishing_profile_xml_with_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore @@ -9977,13 +10351,12 @@ async def list_publishing_profile_xml_with_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -10021,7 +10394,9 @@ async def reset_production_slot_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10082,7 +10457,9 @@ async def restart( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10127,7 +10504,9 @@ async def _restore_from_backup_blob_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -10153,7 +10532,6 @@ async def _restore_from_backup_blob_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10238,7 +10616,9 @@ async def _restore_from_deleted_app_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -10264,7 +10644,6 @@ async def _restore_from_deleted_app_initial( body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -10349,7 +10728,9 @@ async def _restore_snapshot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -10375,7 +10756,6 @@ async def _restore_snapshot_initial( body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -10473,14 +10853,17 @@ def list_site_extensions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10549,9 +10932,12 @@ async def get_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_extension.metadata['url'] # type: ignore @@ -10569,7 +10955,7 @@ async def get_site_extension( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10597,9 +10983,12 @@ async def _install_site_extension_initial( **kwargs ) -> Optional["models.SiteExtensionInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._install_site_extension_initial.metadata['url'] # type: ignore @@ -10617,7 +11006,7 @@ async def _install_site_extension_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -10730,7 +11119,9 @@ async def delete_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10784,14 +11175,17 @@ def list_slots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10861,9 +11255,12 @@ async def get_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_slot.metadata['url'] # type: ignore @@ -10881,7 +11278,7 @@ async def get_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10910,10 +11307,13 @@ async def _create_or_update_slot_initial( **kwargs ) -> "models.Site": cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_slot_initial.metadata['url'] # type: ignore @@ -10932,13 +11332,12 @@ async def _create_or_update_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -11065,7 +11464,9 @@ async def delete_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -11132,10 +11533,13 @@ async def update_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot.metadata['url'] # type: ignore @@ -11154,13 +11558,12 @@ async def update_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -11207,9 +11610,12 @@ async def analyze_custom_hostname_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore @@ -11229,7 +11635,7 @@ async def analyze_custom_hostname_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11275,7 +11681,9 @@ async def apply_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -11302,7 +11710,6 @@ async def apply_slot_configuration_slot( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -11343,10 +11750,13 @@ async def backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup_slot.metadata['url'] # type: ignore @@ -11365,13 +11775,12 @@ async def backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -11412,14 +11821,17 @@ def list_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11494,9 +11906,12 @@ async def get_backup_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_status_slot.metadata['url'] # type: ignore @@ -11515,7 +11930,7 @@ async def get_backup_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11561,7 +11976,9 @@ async def delete_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -11627,10 +12044,13 @@ async def list_backup_status_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore @@ -11650,13 +12070,12 @@ async def list_backup_status_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -11683,7 +12102,9 @@ async def _restore_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -11711,7 +12132,6 @@ async def _restore_slot_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -11821,14 +12241,17 @@ def list_configurations_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11903,10 +12326,13 @@ async def update_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings_slot.metadata['url'] # type: ignore @@ -11925,13 +12351,12 @@ async def update_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -11972,9 +12397,12 @@ async def list_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_application_settings_slot.metadata['url'] # type: ignore @@ -11992,7 +12420,7 @@ async def list_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12037,10 +12465,13 @@ async def update_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings_slot.metadata['url'] # type: ignore @@ -12059,13 +12490,12 @@ async def update_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -12106,9 +12536,12 @@ async def get_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_auth_settings_slot.metadata['url'] # type: ignore @@ -12126,7 +12559,7 @@ async def get_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12172,10 +12605,13 @@ async def update_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12194,13 +12630,12 @@ async def update_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -12241,9 +12676,12 @@ async def list_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12261,7 +12699,7 @@ async def list_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12307,10 +12745,13 @@ async def update_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration_slot.metadata['url'] # type: ignore @@ -12329,13 +12770,12 @@ async def update_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -12376,7 +12816,9 @@ async def delete_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -12434,9 +12876,12 @@ async def get_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration_slot.metadata['url'] # type: ignore @@ -12454,7 +12899,7 @@ async def get_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12500,10 +12945,13 @@ async def update_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings_slot.metadata['url'] # type: ignore @@ -12522,13 +12970,12 @@ async def update_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -12569,9 +13016,12 @@ async def list_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_connection_strings_slot.metadata['url'] # type: ignore @@ -12589,7 +13039,7 @@ async def list_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12632,9 +13082,12 @@ async def get_diagnostic_logs_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore @@ -12652,7 +13105,7 @@ async def get_diagnostic_logs_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12699,10 +13152,13 @@ async def update_diagnostic_logs_config_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore @@ -12721,13 +13177,12 @@ async def update_diagnostic_logs_config_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -12771,10 +13226,13 @@ async def update_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata_slot.metadata['url'] # type: ignore @@ -12793,13 +13251,12 @@ async def update_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -12840,9 +13297,12 @@ async def list_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_metadata_slot.metadata['url'] # type: ignore @@ -12860,7 +13320,7 @@ async def list_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12887,9 +13347,12 @@ async def _list_publishing_credentials_slot_initial( **kwargs ) -> "models.User": cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore @@ -12907,7 +13370,7 @@ async def _list_publishing_credentials_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13020,10 +13483,13 @@ async def update_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings_slot.metadata['url'] # type: ignore @@ -13042,13 +13508,12 @@ async def update_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -13088,9 +13553,12 @@ async def list_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings_slot.metadata['url'] # type: ignore @@ -13108,7 +13576,7 @@ async def list_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13152,9 +13620,12 @@ async def get_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration_slot.metadata['url'] # type: ignore @@ -13172,7 +13643,7 @@ async def get_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13218,10 +13689,13 @@ async def create_or_update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore @@ -13240,13 +13714,12 @@ async def create_or_update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13290,10 +13763,13 @@ async def update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration_slot.metadata['url'] # type: ignore @@ -13312,13 +13788,12 @@ async def update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13360,14 +13835,17 @@ def list_configuration_snapshot_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13442,9 +13920,12 @@ async def get_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -13463,7 +13944,7 @@ async def get_configuration_snapshot_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13509,7 +13990,9 @@ async def recover_site_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -13567,9 +14050,12 @@ async def get_web_site_container_logs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore @@ -13587,7 +14073,7 @@ async def get_web_site_container_logs_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -13630,9 +14116,12 @@ async def get_container_logs_zip_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore @@ -13650,7 +14139,7 @@ async def get_container_logs_zip_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -13694,14 +14183,17 @@ def list_continuous_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13776,9 +14268,12 @@ async def get_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore @@ -13797,7 +14292,7 @@ async def get_continuous_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13844,7 +14339,9 @@ async def delete_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -13906,7 +14403,9 @@ async def start_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -13968,7 +14467,9 @@ async def stop_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14027,14 +14528,17 @@ def list_deployments_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14109,9 +14613,12 @@ async def get_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_deployment_slot.metadata['url'] # type: ignore @@ -14130,7 +14637,7 @@ async def get_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14179,10 +14686,13 @@ async def create_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment_slot.metadata['url'] # type: ignore @@ -14202,13 +14712,12 @@ async def create_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -14252,7 +14761,9 @@ async def delete_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14315,9 +14826,12 @@ async def list_deployment_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_deployment_log_slot.metadata['url'] # type: ignore @@ -14336,7 +14850,7 @@ async def list_deployment_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14384,10 +14898,13 @@ async def discover_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup_slot.metadata['url'] # type: ignore @@ -14406,13 +14923,12 @@ async def discover_backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -14453,14 +14969,17 @@ def list_domain_ownership_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14535,9 +15054,12 @@ async def get_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14556,7 +15078,7 @@ async def get_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14605,10 +15127,13 @@ async def create_or_update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14628,13 +15153,12 @@ async def create_or_update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -14678,7 +15202,9 @@ async def delete_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14743,10 +15269,13 @@ async def update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14766,13 +15295,12 @@ async def update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -14812,9 +15340,12 @@ async def get_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -14832,7 +15363,7 @@ async def get_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14860,10 +15391,13 @@ async def _create_ms_deploy_operation_slot_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -14882,13 +15416,12 @@ async def _create_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -15000,9 +15533,12 @@ async def get_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -15020,7 +15556,7 @@ async def get_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15063,14 +15599,17 @@ def list_instance_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15140,9 +15679,12 @@ async def get_functions_admin_token_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore @@ -15160,7 +15702,7 @@ async def get_functions_admin_token_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15205,9 +15747,12 @@ async def get_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_function_slot.metadata['url'] # type: ignore @@ -15226,7 +15771,7 @@ async def get_instance_function_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15256,10 +15801,13 @@ async def _create_instance_function_slot_initial( **kwargs ) -> "models.FunctionEnvelope": cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore @@ -15279,13 +15827,12 @@ async def _create_instance_function_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -15403,7 +15950,9 @@ async def delete_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -15470,10 +16019,13 @@ async def create_or_update_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore @@ -15494,13 +16046,12 @@ async def create_or_update_function_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -15550,7 +16101,9 @@ async def delete_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -15612,9 +16165,12 @@ async def list_function_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_keys_slot.metadata['url'] # type: ignore @@ -15633,7 +16189,7 @@ async def list_function_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15678,9 +16234,12 @@ async def list_function_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_secrets_slot.metadata['url'] # type: ignore @@ -15699,7 +16258,7 @@ async def list_function_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15741,9 +16300,12 @@ async def list_host_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_host_keys_slot.metadata['url'] # type: ignore @@ -15761,7 +16323,7 @@ async def list_host_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15803,9 +16365,12 @@ async def list_sync_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_status_slot.metadata['url'] # type: ignore @@ -15823,6 +16388,7 @@ async def list_sync_status_slot( # 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) @@ -15861,9 +16427,12 @@ async def sync_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.sync_functions_slot.metadata['url'] # type: ignore @@ -15881,6 +16450,7 @@ async def sync_functions_slot( # 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) @@ -15928,10 +16498,13 @@ async def create_or_update_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore @@ -15952,13 +16525,12 @@ async def create_or_update_host_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -16008,9 +16580,12 @@ async def delete_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.delete_host_secret_slot.metadata['url'] # type: ignore @@ -16030,6 +16605,7 @@ async def delete_host_secret_slot( # 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) @@ -16069,14 +16645,17 @@ def list_host_name_bindings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16151,9 +16730,12 @@ async def get_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding_slot.metadata['url'] # type: ignore @@ -16172,7 +16754,7 @@ async def get_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16222,10 +16804,13 @@ async def create_or_update_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore @@ -16245,13 +16830,12 @@ async def create_or_update_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -16295,7 +16879,9 @@ async def delete_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -16359,9 +16945,12 @@ async def get_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16381,7 +16970,7 @@ async def get_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16432,10 +17021,13 @@ async def create_or_update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16456,13 +17048,12 @@ async def create_or_update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -16508,7 +17099,9 @@ async def delete_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -16576,10 +17169,13 @@ async def update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16600,13 +17196,12 @@ async def update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -16652,9 +17247,12 @@ async def list_hybrid_connection_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore @@ -16674,7 +17272,7 @@ async def list_hybrid_connection_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16716,9 +17314,12 @@ async def list_hybrid_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore @@ -16736,7 +17337,7 @@ async def list_hybrid_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16779,9 +17380,12 @@ async def list_relay_service_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore @@ -16799,7 +17403,7 @@ async def list_relay_service_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16845,9 +17449,12 @@ async def get_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore @@ -16866,7 +17473,7 @@ async def get_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16915,10 +17522,13 @@ async def create_or_update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -16938,13 +17548,12 @@ async def create_or_update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -16988,7 +17597,9 @@ async def delete_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -17053,10 +17664,13 @@ async def update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17076,13 +17690,12 @@ async def update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17123,14 +17736,17 @@ def list_instance_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17204,9 +17820,12 @@ async def get_instance_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -17225,7 +17844,7 @@ async def get_instance_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17254,10 +17873,13 @@ async def _create_instance_ms_deploy_operation_slot_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -17277,13 +17899,12 @@ async def _create_instance_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -17402,9 +18023,12 @@ async def get_instance_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -17423,7 +18047,7 @@ async def get_instance_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17472,14 +18096,17 @@ def list_instance_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17558,9 +18185,12 @@ async def get_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_slot.metadata['url'] # type: ignore @@ -17580,7 +18210,7 @@ async def get_instance_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17632,7 +18262,9 @@ async def delete_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -17699,9 +18331,12 @@ async def get_instance_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore @@ -17721,7 +18356,7 @@ async def get_instance_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -17773,14 +18408,17 @@ def list_instance_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17863,9 +18501,12 @@ async def get_instance_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module_slot.metadata['url'] # type: ignore @@ -17886,7 +18527,7 @@ async def get_instance_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17937,14 +18578,17 @@ def list_instance_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18028,9 +18672,12 @@ async def get_instance_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore @@ -18051,7 +18698,7 @@ async def get_instance_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18095,9 +18742,12 @@ async def is_cloneable_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.is_cloneable_slot.metadata['url'] # type: ignore @@ -18115,7 +18765,7 @@ async def is_cloneable_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18157,9 +18807,12 @@ async def list_sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore @@ -18177,7 +18830,7 @@ async def list_sync_function_triggers_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18220,14 +18873,17 @@ def list_metric_definitions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18309,14 +18965,17 @@ def list_metrics_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18392,9 +19051,12 @@ async def get_migrate_my_sql_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore @@ -18412,7 +19074,7 @@ async def get_migrate_my_sql_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18455,9 +19117,12 @@ async def get_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18475,7 +19140,7 @@ async def get_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18525,10 +19190,13 @@ async def create_or_update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18547,13 +19215,12 @@ async def create_or_update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -18594,7 +19261,9 @@ async def delete_swift_virtual_network_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -18659,10 +19328,13 @@ async def update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18681,13 +19353,12 @@ async def update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -18731,9 +19402,12 @@ async def list_network_features_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_network_features_slot.metadata['url'] # type: ignore @@ -18752,7 +19426,7 @@ async def list_network_features_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18799,9 +19473,12 @@ async def get_network_trace_operation_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore @@ -18820,7 +19497,7 @@ async def get_network_trace_operation_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18875,9 +19552,12 @@ async def start_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -18901,7 +19581,7 @@ async def start_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18931,9 +19611,12 @@ async def _start_web_site_network_trace_operation_slot_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore @@ -18957,7 +19640,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19082,7 +19765,9 @@ async def stop_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -19143,9 +19828,12 @@ async def get_network_traces_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot.metadata['url'] # type: ignore @@ -19164,7 +19852,7 @@ async def get_network_traces_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19210,9 +19898,12 @@ async def get_network_trace_operation_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore @@ -19231,7 +19922,7 @@ async def get_network_trace_operation_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19281,9 +19972,12 @@ async def get_network_traces_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore @@ -19302,7 +19996,7 @@ async def get_network_traces_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19345,7 +20039,9 @@ async def generate_new_site_publishing_password_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -19407,14 +20103,17 @@ def list_perf_mon_counters_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19487,9 +20186,12 @@ async def get_site_php_error_log_flag_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore @@ -19507,7 +20209,7 @@ async def get_site_php_error_log_flag_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19550,9 +20252,12 @@ async def list_premier_add_ons_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore @@ -19570,7 +20275,7 @@ async def list_premier_add_ons_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19616,9 +20321,12 @@ async def get_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on_slot.metadata['url'] # type: ignore @@ -19637,7 +20345,7 @@ async def get_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19686,10 +20394,13 @@ async def add_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on_slot.metadata['url'] # type: ignore @@ -19709,13 +20420,12 @@ async def add_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -19759,7 +20469,9 @@ async def delete_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -19824,10 +20536,13 @@ async def update_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on_slot.metadata['url'] # type: ignore @@ -19847,13 +20562,12 @@ async def update_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -19894,9 +20608,12 @@ async def get_private_access_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_private_access_slot.metadata['url'] # type: ignore @@ -19914,7 +20631,7 @@ async def get_private_access_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19960,10 +20677,13 @@ async def put_private_access_vnet_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore @@ -19982,13 +20702,12 @@ async def put_private_access_vnet_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -20030,14 +20749,17 @@ def list_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20111,9 +20833,12 @@ async def get_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_slot.metadata['url'] # type: ignore @@ -20132,7 +20857,7 @@ async def get_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20180,7 +20905,9 @@ async def delete_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -20242,9 +20969,12 @@ async def get_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_dump_slot.metadata['url'] # type: ignore @@ -20263,7 +20993,7 @@ async def get_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -20311,14 +21041,17 @@ def list_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20396,9 +21129,12 @@ async def get_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_module_slot.metadata['url'] # type: ignore @@ -20418,7 +21154,7 @@ async def get_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20465,14 +21201,17 @@ def list_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20551,9 +21290,12 @@ async def get_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_thread_slot.metadata['url'] # type: ignore @@ -20573,7 +21315,7 @@ async def get_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20617,14 +21359,17 @@ def list_public_certificates_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20699,9 +21444,12 @@ async def get_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_public_certificate_slot.metadata['url'] # type: ignore @@ -20720,7 +21468,7 @@ async def get_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20770,10 +21518,13 @@ async def create_or_update_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore @@ -20793,13 +21544,12 @@ async def create_or_update_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -20843,7 +21593,9 @@ async def delete_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -20906,10 +21658,13 @@ async def list_publishing_profile_xml_with_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore @@ -20928,13 +21683,12 @@ async def list_publishing_profile_xml_with_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -20976,7 +21730,9 @@ async def reset_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -21042,7 +21798,9 @@ async def restart_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -21089,7 +21847,9 @@ async def _restore_from_backup_blob_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21116,7 +21876,6 @@ async def _restore_from_backup_blob_slot_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -21207,7 +21966,9 @@ async def _restore_from_deleted_app_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21234,7 +21995,6 @@ async def _restore_from_deleted_app_slot_initial( body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -21324,7 +22084,9 @@ async def _restore_snapshot_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21351,7 +22113,6 @@ async def _restore_snapshot_slot_initial( body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -21457,14 +22218,17 @@ def list_site_extensions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21538,9 +22302,12 @@ async def get_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_extension_slot.metadata['url'] # type: ignore @@ -21559,7 +22326,7 @@ async def get_site_extension_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21588,9 +22355,12 @@ async def _install_site_extension_slot_initial( **kwargs ) -> Optional["models.SiteExtensionInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore @@ -21609,7 +22379,7 @@ async def _install_site_extension_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -21731,7 +22501,9 @@ async def delete_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -21793,16 +22565,19 @@ def list_slot_differences_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21822,7 +22597,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -21830,7 +22604,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -21867,7 +22640,9 @@ async def _swap_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21894,7 +22669,6 @@ async def _swap_slot_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -21999,14 +22773,17 @@ def list_snapshots_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22077,14 +22854,17 @@ def list_snapshots_from_dr_secondary_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22156,9 +22936,12 @@ async def get_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_source_control_slot.metadata['url'] # type: ignore @@ -22176,7 +22959,7 @@ async def get_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22211,10 +22994,13 @@ async def _create_or_update_source_control_slot_initial( **kwargs ) -> "models.SiteSourceControl": cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore @@ -22233,13 +23019,12 @@ async def _create_or_update_source_control_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -22359,7 +23144,9 @@ async def delete_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22420,10 +23207,13 @@ async def update_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control_slot.metadata['url'] # type: ignore @@ -22442,13 +23232,12 @@ async def update_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -22496,7 +23285,9 @@ async def start_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22541,9 +23332,12 @@ async def _start_network_trace_slot_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore @@ -22567,7 +23361,7 @@ async def _start_network_trace_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22693,7 +23487,9 @@ async def stop_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22750,7 +23546,9 @@ async def stop_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22807,7 +23605,9 @@ async def sync_repository_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22864,7 +23664,9 @@ async def sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22922,14 +23724,17 @@ def list_triggered_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23004,9 +23809,12 @@ async def get_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore @@ -23025,7 +23833,7 @@ async def get_triggered_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23072,7 +23880,9 @@ async def delete_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23134,14 +23944,17 @@ def list_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23219,9 +24032,12 @@ async def get_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore @@ -23241,7 +24057,7 @@ async def get_triggered_web_job_history_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23288,7 +24104,9 @@ async def run_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23353,14 +24171,17 @@ def list_usages_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23434,9 +24255,12 @@ async def list_vnet_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections_slot.metadata['url'] # type: ignore @@ -23454,7 +24278,7 @@ async def list_vnet_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23500,9 +24324,12 @@ async def get_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_slot.metadata['url'] # type: ignore @@ -23521,7 +24348,7 @@ async def get_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23571,10 +24398,13 @@ async def create_or_update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore @@ -23594,13 +24424,12 @@ async def create_or_update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -23644,7 +24473,9 @@ async def delete_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23710,10 +24541,13 @@ async def update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_slot.metadata['url'] # type: ignore @@ -23733,13 +24567,12 @@ async def update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -23786,9 +24619,12 @@ async def get_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -23808,7 +24644,7 @@ async def get_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23861,10 +24697,13 @@ async def create_or_update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -23885,13 +24724,12 @@ async def create_or_update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -23941,10 +24779,13 @@ async def update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -23965,13 +24806,12 @@ async def update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -24012,14 +24852,17 @@ def list_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24094,9 +24937,12 @@ async def get_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_web_job_slot.metadata['url'] # type: ignore @@ -24115,7 +24961,7 @@ async def get_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24157,16 +25003,19 @@ def list_slot_differences_from_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24185,7 +25034,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -24193,7 +25041,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -24229,7 +25076,9 @@ async def _swap_slot_with_production_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -24255,7 +25104,6 @@ async def _swap_slot_with_production_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -24352,14 +25200,17 @@ def list_snapshots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24426,14 +25277,17 @@ def list_snapshots_from_dr_secondary( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24500,9 +25354,12 @@ async def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -24519,7 +25376,7 @@ async def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24553,10 +25410,13 @@ async def _create_or_update_source_control_initial( **kwargs ) -> "models.SiteSourceControl": cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore @@ -24574,13 +25434,12 @@ async def _create_or_update_source_control_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -24691,7 +25550,9 @@ async def delete_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -24747,10 +25608,13 @@ async def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -24768,13 +25632,12 @@ async def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -24818,7 +25681,9 @@ async def start( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -24861,9 +25726,12 @@ async def _start_network_trace_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_network_trace_initial.metadata['url'] # type: ignore @@ -24886,7 +25754,7 @@ async def _start_network_trace_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25004,7 +25872,9 @@ async def stop( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25057,7 +25927,9 @@ async def stop_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25110,7 +25982,9 @@ async def sync_repository( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25163,7 +26037,9 @@ async def sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25216,14 +26092,17 @@ def list_triggered_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25293,9 +26172,12 @@ async def get_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job.metadata['url'] # type: ignore @@ -25313,7 +26195,7 @@ async def get_triggered_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25356,7 +26238,9 @@ async def delete_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25413,14 +26297,17 @@ def list_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25493,9 +26380,12 @@ async def get_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history.metadata['url'] # type: ignore @@ -25514,7 +26404,7 @@ async def get_triggered_web_job_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25557,7 +26447,9 @@ async def run_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25617,14 +26509,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25693,9 +26588,12 @@ async def list_vnet_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections.metadata['url'] # type: ignore @@ -25712,7 +26610,7 @@ async def list_vnet_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25754,9 +26652,12 @@ async def get_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection.metadata['url'] # type: ignore @@ -25774,7 +26675,7 @@ async def get_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25820,10 +26721,13 @@ async def create_or_update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore @@ -25842,13 +26746,12 @@ async def create_or_update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -25888,7 +26791,9 @@ async def delete_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25949,10 +26854,13 @@ async def update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection.metadata['url'] # type: ignore @@ -25971,13 +26879,12 @@ async def update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -26020,9 +26927,12 @@ async def get_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26041,7 +26951,7 @@ async def get_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26090,10 +27000,13 @@ async def create_or_update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26113,13 +27026,12 @@ async def create_or_update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -26165,10 +27077,13 @@ async def update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26188,13 +27103,12 @@ async def update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -26231,14 +27145,17 @@ def list_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26308,9 +27225,12 @@ async def get_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_web_job.metadata['url'] # type: ignore @@ -26328,7 +27248,7 @@ async def get_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py index 873bf5825680..70cde8488555 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/_web_site_management_client_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -35,9 +35,12 @@ async def get_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_publishing_user.metadata['url'] # type: ignore @@ -48,7 +51,7 @@ async def get_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -84,10 +87,13 @@ async def update_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_publishing_user.metadata['url'] # type: ignore @@ -99,13 +105,12 @@ async def update_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') 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 @@ -136,14 +141,17 @@ def list_source_controls( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -201,9 +209,12 @@ async def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -218,7 +229,7 @@ async def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -257,10 +268,13 @@ async def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -276,13 +290,12 @@ async def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') 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 @@ -319,14 +332,17 @@ def list_billing_meters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -398,12 +414,15 @@ async def check_name_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_name_availability.metadata['url'] # type: ignore @@ -419,13 +438,12 @@ async def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') 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 @@ -456,9 +474,12 @@ async def get_subscription_deployment_locations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore @@ -473,7 +494,7 @@ async def get_subscription_deployment_locations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -521,14 +542,17 @@ def list_geo_regions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -598,16 +622,19 @@ def list_site_identifiers_assigned_to_host_name( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -624,7 +651,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -632,7 +658,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -674,14 +699,17 @@ def list_premier_add_on_offers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -740,9 +768,12 @@ async def list_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_skus.metadata['url'] # type: ignore @@ -757,7 +788,7 @@ async def list_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -794,10 +825,13 @@ async def verify_hosting_environment_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore @@ -813,13 +847,12 @@ async def verify_hosting_environment_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') 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 @@ -856,7 +889,9 @@ async def move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -881,7 +916,6 @@ async def move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 @@ -914,10 +948,13 @@ async def validate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate.metadata['url'] # type: ignore @@ -934,13 +971,12 @@ async def validate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') 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 @@ -977,10 +1013,13 @@ async def validate_container_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate_container_settings.metadata['url'] # type: ignore @@ -997,13 +1036,12 @@ async def validate_container_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_container_settings_request, 'ValidateContainerSettingsRequest') 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 @@ -1040,7 +1078,9 @@ async def validate_move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1065,7 +1105,6 @@ async def validate_move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py deleted file mode 100644 index 6de2329231bb..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations_async/__init__.py +++ /dev/null @@ -1,41 +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_service_certificate_orders_operations_async import AppServiceCertificateOrdersOperations -from ._certificate_registration_provider_operations_async import CertificateRegistrationProviderOperations -from ._domains_operations_async import DomainsOperations -from ._top_level_domains_operations_async import TopLevelDomainsOperations -from ._domain_registration_provider_operations_async import DomainRegistrationProviderOperations -from ._certificates_operations_async import CertificatesOperations -from ._deleted_web_apps_operations_async import DeletedWebAppsOperations -from ._diagnostics_operations_async import DiagnosticsOperations -from ._provider_operations_async import ProviderOperations -from ._recommendations_operations_async import RecommendationsOperations -from ._web_site_management_client_operations_async import WebSiteManagementClientOperationsMixin -from ._web_apps_operations_async import WebAppsOperations -from ._app_service_environments_operations_async import AppServiceEnvironmentsOperations -from ._app_service_plans_operations_async import AppServicePlansOperations -from ._resource_health_metadata_operations_async import ResourceHealthMetadataOperations - -__all__ = [ - 'AppServiceCertificateOrdersOperations', - 'CertificateRegistrationProviderOperations', - 'DomainsOperations', - 'TopLevelDomainsOperations', - 'DomainRegistrationProviderOperations', - 'CertificatesOperations', - 'DeletedWebAppsOperations', - 'DiagnosticsOperations', - 'ProviderOperations', - 'RecommendationsOperations', - 'WebSiteManagementClientOperationsMixin', - 'WebAppsOperations', - 'AppServiceEnvironmentsOperations', - 'AppServicePlansOperations', - 'ResourceHealthMetadataOperations', -] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_paged_models.py deleted file mode 100644 index 908d8095c47e..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/models/_paged_models.py +++ /dev/null @@ -1,729 +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 msrest.paging import Paged - - -class AppServiceCertificateOrderPaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceCertificateOrder ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceCertificateOrder]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceCertificateOrderPaged, self).__init__(*args, **kwargs) -class AppServiceCertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceCertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceCertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceCertificateResourcePaged, self).__init__(*args, **kwargs) -class CsmOperationDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmOperationDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmOperationDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmOperationDescriptionPaged, self).__init__(*args, **kwargs) -class DomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`Domain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Domain]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainPaged, self).__init__(*args, **kwargs) -class NameIdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`NameIdentifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[NameIdentifier]'} - } - - def __init__(self, *args, **kwargs): - - super(NameIdentifierPaged, self).__init__(*args, **kwargs) -class DomainOwnershipIdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`DomainOwnershipIdentifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainOwnershipIdentifierPaged, self).__init__(*args, **kwargs) -class TopLevelDomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`TopLevelDomain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TopLevelDomain]'} - } - - def __init__(self, *args, **kwargs): - - super(TopLevelDomainPaged, self).__init__(*args, **kwargs) -class TldLegalAgreementPaged(Paged): - """ - A paging container for iterating over a list of :class:`TldLegalAgreement ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TldLegalAgreement]'} - } - - def __init__(self, *args, **kwargs): - - super(TldLegalAgreementPaged, self).__init__(*args, **kwargs) -class CertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`Certificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Certificate]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificatePaged, self).__init__(*args, **kwargs) -class DeletedSitePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSite ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSite]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSitePaged, self).__init__(*args, **kwargs) -class DetectorResponsePaged(Paged): - """ - A paging container for iterating over a list of :class:`DetectorResponse ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DetectorResponse]'} - } - - def __init__(self, *args, **kwargs): - - super(DetectorResponsePaged, self).__init__(*args, **kwargs) -class DiagnosticCategoryPaged(Paged): - """ - A paging container for iterating over a list of :class:`DiagnosticCategory ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DiagnosticCategory]'} - } - - def __init__(self, *args, **kwargs): - - super(DiagnosticCategoryPaged, self).__init__(*args, **kwargs) -class AnalysisDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`AnalysisDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AnalysisDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(AnalysisDefinitionPaged, self).__init__(*args, **kwargs) -class DetectorDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`DetectorDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DetectorDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(DetectorDefinitionPaged, self).__init__(*args, **kwargs) -class ApplicationStackPaged(Paged): - """ - A paging container for iterating over a list of :class:`ApplicationStack ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ApplicationStack]'} - } - - def __init__(self, *args, **kwargs): - - super(ApplicationStackPaged, self).__init__(*args, **kwargs) -class RecommendationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Recommendation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Recommendation]'} - } - - def __init__(self, *args, **kwargs): - - super(RecommendationPaged, self).__init__(*args, **kwargs) -class SourceControlPaged(Paged): - """ - A paging container for iterating over a list of :class:`SourceControl ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SourceControl]'} - } - - def __init__(self, *args, **kwargs): - - super(SourceControlPaged, self).__init__(*args, **kwargs) -class BillingMeterPaged(Paged): - """ - A paging container for iterating over a list of :class:`BillingMeter ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BillingMeter]'} - } - - def __init__(self, *args, **kwargs): - - super(BillingMeterPaged, self).__init__(*args, **kwargs) -class GeoRegionPaged(Paged): - """ - A paging container for iterating over a list of :class:`GeoRegion ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[GeoRegion]'} - } - - def __init__(self, *args, **kwargs): - - super(GeoRegionPaged, self).__init__(*args, **kwargs) -class IdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`Identifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Identifier]'} - } - - def __init__(self, *args, **kwargs): - - super(IdentifierPaged, self).__init__(*args, **kwargs) -class PremierAddOnOfferPaged(Paged): - """ - A paging container for iterating over a list of :class:`PremierAddOnOffer ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PremierAddOnOffer]'} - } - - def __init__(self, *args, **kwargs): - - super(PremierAddOnOfferPaged, self).__init__(*args, **kwargs) -class SitePaged(Paged): - """ - A paging container for iterating over a list of :class:`Site ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Site]'} - } - - def __init__(self, *args, **kwargs): - - super(SitePaged, self).__init__(*args, **kwargs) -class BackupItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`BackupItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupItem]'} - } - - def __init__(self, *args, **kwargs): - - super(BackupItemPaged, self).__init__(*args, **kwargs) -class SiteConfigResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteConfigResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteConfigResource]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteConfigResourcePaged, self).__init__(*args, **kwargs) -class SiteConfigurationSnapshotInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteConfigurationSnapshotInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteConfigurationSnapshotInfoPaged, self).__init__(*args, **kwargs) -class ContinuousWebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`ContinuousWebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ContinuousWebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(ContinuousWebJobPaged, self).__init__(*args, **kwargs) -class DeploymentPaged(Paged): - """ - A paging container for iterating over a list of :class:`Deployment ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Deployment]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentPaged, self).__init__(*args, **kwargs) -class FunctionEnvelopePaged(Paged): - """ - A paging container for iterating over a list of :class:`FunctionEnvelope ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[FunctionEnvelope]'} - } - - def __init__(self, *args, **kwargs): - - super(FunctionEnvelopePaged, self).__init__(*args, **kwargs) -class HostNameBindingPaged(Paged): - """ - A paging container for iterating over a list of :class:`HostNameBinding ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[HostNameBinding]'} - } - - def __init__(self, *args, **kwargs): - - super(HostNameBindingPaged, self).__init__(*args, **kwargs) -class SiteInstancePaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteInstance ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteInstance]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteInstancePaged, self).__init__(*args, **kwargs) -class ProcessInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessInfoPaged, self).__init__(*args, **kwargs) -class ProcessModuleInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessModuleInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessModuleInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessModuleInfoPaged, self).__init__(*args, **kwargs) -class ProcessThreadInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessThreadInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessThreadInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessThreadInfoPaged, self).__init__(*args, **kwargs) -class ResourceMetricDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetricDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetricDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricDefinitionPaged, self).__init__(*args, **kwargs) -class ResourceMetricPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetric ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetric]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricPaged, self).__init__(*args, **kwargs) -class PerfMonResponsePaged(Paged): - """ - A paging container for iterating over a list of :class:`PerfMonResponse ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PerfMonResponse]'} - } - - def __init__(self, *args, **kwargs): - - super(PerfMonResponsePaged, self).__init__(*args, **kwargs) -class PublicCertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`PublicCertificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PublicCertificate]'} - } - - def __init__(self, *args, **kwargs): - - super(PublicCertificatePaged, self).__init__(*args, **kwargs) -class SiteExtensionInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteExtensionInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteExtensionInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteExtensionInfoPaged, self).__init__(*args, **kwargs) -class SlotDifferencePaged(Paged): - """ - A paging container for iterating over a list of :class:`SlotDifference ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SlotDifference]'} - } - - def __init__(self, *args, **kwargs): - - super(SlotDifferencePaged, self).__init__(*args, **kwargs) -class SnapshotPaged(Paged): - """ - A paging container for iterating over a list of :class:`Snapshot ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Snapshot]'} - } - - def __init__(self, *args, **kwargs): - - super(SnapshotPaged, self).__init__(*args, **kwargs) -class TriggeredWebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`TriggeredWebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TriggeredWebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(TriggeredWebJobPaged, self).__init__(*args, **kwargs) -class TriggeredJobHistoryPaged(Paged): - """ - A paging container for iterating over a list of :class:`TriggeredJobHistory ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TriggeredJobHistory]'} - } - - def __init__(self, *args, **kwargs): - - super(TriggeredJobHistoryPaged, self).__init__(*args, **kwargs) -class CsmUsageQuotaPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmUsageQuota ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmUsageQuota]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmUsageQuotaPaged, self).__init__(*args, **kwargs) -class WebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`WebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[WebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(WebJobPaged, self).__init__(*args, **kwargs) -class AppServiceEnvironmentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceEnvironmentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceEnvironmentResourcePaged, self).__init__(*args, **kwargs) -class StampCapacityPaged(Paged): - """ - A paging container for iterating over a list of :class:`StampCapacity ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StampCapacity]'} - } - - def __init__(self, *args, **kwargs): - - super(StampCapacityPaged, self).__init__(*args, **kwargs) -class InboundEnvironmentEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`InboundEnvironmentEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[InboundEnvironmentEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(InboundEnvironmentEndpointPaged, self).__init__(*args, **kwargs) -class WorkerPoolResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`WorkerPoolResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[WorkerPoolResource]'} - } - - def __init__(self, *args, **kwargs): - - super(WorkerPoolResourcePaged, self).__init__(*args, **kwargs) -class SkuInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SkuInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SkuInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SkuInfoPaged, self).__init__(*args, **kwargs) -class UsagePaged(Paged): - """ - A paging container for iterating over a list of :class:`Usage ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Usage]'} - } - - def __init__(self, *args, **kwargs): - - super(UsagePaged, self).__init__(*args, **kwargs) -class OutboundEnvironmentEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`OutboundEnvironmentEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(OutboundEnvironmentEndpointPaged, self).__init__(*args, **kwargs) -class AppServicePlanPaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServicePlan ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServicePlan]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServicePlanPaged, self).__init__(*args, **kwargs) -class StrPaged(Paged): - """ - A paging container for iterating over a list of str object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[str]'} - } - - def __init__(self, *args, **kwargs): - - super(StrPaged, self).__init__(*args, **kwargs) -class HybridConnectionPaged(Paged): - """ - A paging container for iterating over a list of :class:`HybridConnection ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[HybridConnection]'} - } - - def __init__(self, *args, **kwargs): - - super(HybridConnectionPaged, self).__init__(*args, **kwargs) -class ResourceHealthMetadataPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceHealthMetadata ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceHealthMetadata]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceHealthMetadataPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py index 5a98edb7c3f3..88f11eda133e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -132,7 +135,9 @@ def validate_purchase_information( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -156,7 +161,6 @@ def validate_purchase_information( body_content = self._serialize.body(app_service_certificate_order, 'AppServiceCertificateOrder') 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 @@ -187,14 +191,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -261,9 +268,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -280,7 +290,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -308,10 +318,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServiceCertificateOrder" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -329,13 +342,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') 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 @@ -445,7 +457,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -502,10 +516,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -523,13 +540,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') 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 @@ -571,14 +587,17 @@ def list_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -649,9 +668,12 @@ def get_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_certificate.metadata['url'] # type: ignore @@ -669,7 +691,7 @@ def get_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -698,10 +720,13 @@ def _create_or_update_certificate_initial( ): # type: (...) -> "models.AppServiceCertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore @@ -720,13 +745,12 @@ def _create_or_update_certificate_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') 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 @@ -843,7 +867,9 @@ def delete_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -904,10 +930,13 @@ def update_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_certificate.metadata['url'] # type: ignore @@ -926,13 +955,12 @@ def update_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') 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 @@ -977,7 +1005,9 @@ def reissue( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1003,7 +1033,6 @@ def reissue( body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') 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 @@ -1040,7 +1069,9 @@ def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1066,7 +1097,6 @@ def renew( body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') 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 @@ -1100,7 +1130,9 @@ def resend_email( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1157,7 +1189,9 @@ def resend_request_emails( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1183,7 +1217,6 @@ def resend_request_emails( body_content = self._serialize.body(name_identifier, 'NameIdentifier') 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 @@ -1220,10 +1253,13 @@ def retrieve_site_seal( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.retrieve_site_seal.metadata['url'] # type: ignore @@ -1241,13 +1277,12 @@ def retrieve_site_seal( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') 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 @@ -1285,7 +1320,9 @@ def verify_domain_ownership( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1339,9 +1376,12 @@ def retrieve_certificate_actions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_actions.metadata['url'] # type: ignore @@ -1358,7 +1398,7 @@ def retrieve_certificate_actions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1398,9 +1438,12 @@ def retrieve_certificate_email_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore @@ -1417,7 +1460,7 @@ def retrieve_certificate_email_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py index 8ec9049f500a..3b041ba06bb5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -132,14 +135,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,9 +212,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -225,7 +234,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -253,10 +262,13 @@ def _create_or_update_initial( ): # type: (...) -> Optional["models.AppServiceEnvironmentResource"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -274,13 +286,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') 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 @@ -378,7 +389,9 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -503,10 +516,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServiceEnvironmentResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -524,13 +540,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') 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 @@ -572,14 +587,17 @@ def list_capacities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -647,9 +665,12 @@ def list_vips( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vips.metadata['url'] # type: ignore @@ -666,7 +687,7 @@ def list_vips( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -694,10 +715,13 @@ def _change_vnet_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._change_vnet_initial.metadata['url'] # type: ignore @@ -715,13 +739,12 @@ def _change_vnet_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') 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 @@ -771,16 +794,19 @@ def begin_change_vnet( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -799,7 +825,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -807,7 +832,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -893,9 +917,12 @@ def list_diagnostics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_diagnostics.metadata['url'] # type: ignore @@ -912,7 +939,7 @@ def list_diagnostics( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -955,9 +982,12 @@ def get_diagnostics_item( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_diagnostics_item.metadata['url'] # type: ignore @@ -975,7 +1005,7 @@ def get_diagnostics_item( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1015,14 +1045,17 @@ def get_inbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1090,9 +1123,12 @@ def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_metric_definitions.metadata['url'] # type: ignore @@ -1109,7 +1145,7 @@ def list_metric_definitions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1159,14 +1195,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1238,14 +1277,17 @@ def list_multi_role_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1313,9 +1355,12 @@ def get_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_multi_role_pool.metadata['url'] # type: ignore @@ -1332,7 +1377,7 @@ def get_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1360,10 +1405,13 @@ def _create_or_update_multi_role_pool_initial( ): # type: (...) -> Optional["models.WorkerPoolResource"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore @@ -1381,13 +1429,12 @@ def _create_or_update_multi_role_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1500,10 +1547,13 @@ def update_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_multi_role_pool.metadata['url'] # type: ignore @@ -1521,13 +1571,12 @@ def update_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1573,14 +1622,17 @@ def list_multi_role_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1656,14 +1708,17 @@ def list_multi_role_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1734,14 +1789,17 @@ def list_multi_role_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1828,14 +1886,17 @@ def list_multi_role_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1913,14 +1974,17 @@ def list_multi_role_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1988,14 +2052,17 @@ def list_multi_role_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2063,9 +2130,12 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -2082,7 +2152,7 @@ def list_operations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2122,14 +2192,17 @@ def get_outbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2197,7 +2270,9 @@ def reboot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -2238,9 +2313,12 @@ def _resume_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._resume_initial.metadata['url'] # type: ignore @@ -2257,7 +2335,7 @@ def _resume_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2306,14 +2384,17 @@ def begin_resume( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2417,14 +2498,17 @@ def list_app_service_plans( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2495,14 +2579,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2559,9 +2646,12 @@ def _suspend_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._suspend_initial.metadata['url'] # type: ignore @@ -2578,7 +2668,7 @@ def _suspend_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2627,14 +2717,17 @@ def begin_suspend( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2744,14 +2837,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2821,14 +2917,17 @@ def list_worker_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2899,9 +2998,12 @@ def get_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_worker_pool.metadata['url'] # type: ignore @@ -2919,7 +3021,7 @@ def get_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2948,10 +3050,13 @@ def _create_or_update_worker_pool_initial( ): # type: (...) -> Optional["models.WorkerPoolResource"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore @@ -2970,13 +3075,12 @@ def _create_or_update_worker_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -3096,10 +3200,13 @@ def update_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WorkerPoolResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_worker_pool.metadata['url'] # type: ignore @@ -3118,13 +3225,12 @@ def update_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -3172,14 +3278,17 @@ def list_worker_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3265,14 +3374,17 @@ def list_worker_pool_instance_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3349,14 +3461,17 @@ def list_web_worker_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3438,14 +3553,17 @@ def list_web_worker_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3521,14 +3639,17 @@ def list_worker_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3600,14 +3721,17 @@ def list_web_worker_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py index b6009a1e08d1..bbafff94ccc8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -139,14 +142,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -213,9 +219,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -232,7 +241,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -261,10 +270,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServicePlan" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -282,13 +294,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') 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 @@ -401,7 +412,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -458,10 +471,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -479,13 +495,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') 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 @@ -527,9 +542,12 @@ def list_capabilities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_capabilities.metadata['url'] # type: ignore @@ -546,7 +564,7 @@ def list_capabilities( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -592,9 +610,12 @@ def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -613,7 +634,7 @@ def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -659,7 +680,9 @@ def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -721,9 +744,12 @@ def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -742,7 +768,7 @@ def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -788,14 +814,17 @@ def list_web_apps_by_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -865,9 +894,12 @@ def get_hybrid_connection_plan_limit( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore @@ -884,7 +916,7 @@ def get_hybrid_connection_plan_limit( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -924,14 +956,17 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -999,14 +1034,17 @@ def list_metric_defintions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1084,14 +1122,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1168,7 +1209,9 @@ def restart_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1236,14 +1279,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1317,9 +1363,12 @@ def get_server_farm_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_server_farm_skus.metadata['url'] # type: ignore @@ -1336,7 +1385,7 @@ def get_server_farm_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1380,14 +1429,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1457,9 +1509,12 @@ def list_vnets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vnets.metadata['url'] # type: ignore @@ -1476,7 +1531,7 @@ def list_vnets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1519,9 +1574,12 @@ def get_vnet_from_server_farm( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore @@ -1539,7 +1597,7 @@ def get_vnet_from_server_farm( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1586,9 +1644,12 @@ def get_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_gateway.metadata['url'] # type: ignore @@ -1607,7 +1668,7 @@ def get_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1656,10 +1717,13 @@ def update_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_gateway.metadata['url'] # type: ignore @@ -1679,13 +1743,12 @@ def update_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -1726,9 +1789,12 @@ def list_routes_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_routes_for_vnet.metadata['url'] # type: ignore @@ -1746,7 +1812,7 @@ def list_routes_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1792,9 +1858,12 @@ def get_route_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_route_for_vnet.metadata['url'] # type: ignore @@ -1813,7 +1882,7 @@ def get_route_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1863,10 +1932,13 @@ def create_or_update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_route.metadata['url'] # type: ignore @@ -1886,13 +1958,12 @@ def create_or_update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1937,7 +2008,9 @@ def delete_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -2002,10 +2075,13 @@ def update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_route.metadata['url'] # type: ignore @@ -2025,13 +2101,12 @@ def update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -2073,7 +2148,9 @@ def reboot_worker( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py index 9eb5daaa1ed8..839d201b753f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -61,14 +61,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py index 2ac5ccb1879e..cf71ad47db9d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -266,10 +275,13 @@ def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -287,13 +299,12 @@ def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -331,7 +342,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -388,10 +401,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -409,13 +425,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py index a7f8120d9fdc..0cbdd534b66e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get_deleted_web_app_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get_deleted_web_app_by_location( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py index 0940da3c4f69..36a3c812f155 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -67,14 +67,17 @@ def list_hosting_environment_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -154,9 +157,12 @@ def get_hosting_environment_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore @@ -180,7 +186,7 @@ def get_hosting_environment_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -220,14 +226,17 @@ def list_site_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -307,9 +316,12 @@ def get_site_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response.metadata['url'] # type: ignore @@ -333,7 +345,7 @@ def get_site_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -373,14 +385,17 @@ def list_site_diagnostic_categories( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -451,9 +466,12 @@ def get_site_diagnostic_category( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category.metadata['url'] # type: ignore @@ -471,7 +489,7 @@ def get_site_diagnostic_category( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -514,14 +532,17 @@ def list_site_analyses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -596,9 +617,12 @@ def get_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_analysis.metadata['url'] # type: ignore @@ -617,7 +641,7 @@ def get_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -672,9 +696,12 @@ def execute_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis.metadata['url'] # type: ignore @@ -699,7 +726,7 @@ def execute_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -742,14 +769,17 @@ def list_site_detectors( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -824,14 +854,17 @@ def get_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -916,9 +949,12 @@ def execute_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_detector.metadata['url'] # type: ignore @@ -943,7 +979,7 @@ def execute_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -986,14 +1022,17 @@ def list_site_detector_responses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1077,9 +1116,12 @@ def get_site_detector_response_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response_slot.metadata['url'] # type: ignore @@ -1104,7 +1146,7 @@ def get_site_detector_response_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1147,14 +1189,17 @@ def list_site_diagnostic_categories_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1229,9 +1274,12 @@ def get_site_diagnostic_category_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore @@ -1250,7 +1298,7 @@ def get_site_diagnostic_category_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1296,14 +1344,17 @@ def list_site_analyses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1382,9 +1433,12 @@ def get_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_analysis_slot.metadata['url'] # type: ignore @@ -1404,7 +1458,7 @@ def get_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1462,9 +1516,12 @@ def execute_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis_slot.metadata['url'] # type: ignore @@ -1490,7 +1547,7 @@ def execute_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1536,14 +1593,17 @@ def list_site_detectors_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1622,14 +1682,17 @@ def get_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1718,9 +1781,12 @@ def execute_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.execute_site_detector_slot.metadata['url'] # type: ignore @@ -1746,7 +1812,7 @@ def execute_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py index 0038e92379d8..b0612b6e6754 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -61,14 +61,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py index d92cf92d2e7f..744a144ce22e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -65,10 +65,13 @@ def check_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailablilityCheckResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_availability.metadata['url'] # type: ignore @@ -84,13 +87,12 @@ def check_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') 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 @@ -122,14 +124,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -189,9 +194,12 @@ def get_control_center_sso_request( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_control_center_sso_request.metadata['url'] # type: ignore @@ -206,7 +214,7 @@ def get_control_center_sso_request( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -243,16 +251,19 @@ def list_recommendations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -269,7 +280,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -277,7 +287,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -323,14 +332,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -397,9 +409,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -416,7 +431,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -444,10 +459,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Domain" cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -465,13 +483,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') 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 @@ -585,7 +602,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -644,10 +663,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -665,13 +687,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') 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 @@ -713,14 +734,17 @@ def list_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -791,9 +815,12 @@ def get_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ownership_identifier.metadata['url'] # type: ignore @@ -811,7 +838,7 @@ def get_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -858,10 +885,13 @@ def create_or_update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore @@ -880,13 +910,12 @@ def create_or_update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -927,7 +956,9 @@ def delete_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -989,10 +1020,13 @@ def update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ownership_identifier.metadata['url'] # type: ignore @@ -1011,13 +1045,12 @@ def update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -1055,7 +1088,9 @@ def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py index 13af311d060d..2c8bbbb67928 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -63,14 +63,17 @@ def get_available_stacks( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -129,14 +132,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -195,14 +201,17 @@ def get_available_stacks_on_prem( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py index 7cc571d49b3a..e18c8a87ee79 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -69,14 +69,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -140,7 +143,9 @@ def reset_all_filters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -189,7 +194,9 @@ def disable_recommendation_for_subscription( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -251,14 +258,17 @@ def list_history_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -338,14 +348,17 @@ def list_recommended_rules_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -420,7 +433,9 @@ def disable_all_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -478,7 +493,9 @@ def reset_all_filters_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -544,9 +561,12 @@ def get_rule_details_by_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore @@ -568,7 +588,7 @@ def get_rule_details_by_hosting_environment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -614,7 +634,9 @@ def disable_recommendation_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -679,14 +701,17 @@ def list_history_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -766,14 +791,17 @@ def list_recommended_rules_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -845,7 +873,9 @@ def disable_all_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -899,7 +929,9 @@ def reset_all_filters_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -964,9 +996,12 @@ def get_rule_details_by_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore @@ -988,7 +1023,7 @@ def get_rule_details_by_web_app( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1031,7 +1066,9 @@ def disable_recommendation_for_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py index 1419faa873c7..b9ce879905dc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,14 +210,17 @@ def list_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -279,9 +288,12 @@ def get_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_by_site.metadata['url'] # type: ignore @@ -298,7 +310,7 @@ def get_by_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -341,14 +353,17 @@ def list_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -420,9 +435,12 @@ def get_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_by_site_slot.metadata['url'] # type: ignore @@ -440,7 +458,7 @@ def get_by_site_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py index 465a5ae885a0..84ff0b5dff87 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,9 +133,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -148,7 +154,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -188,16 +194,19 @@ def list_agreements( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -215,7 +224,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -223,7 +231,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py index 01e4b045f646..f1dbec7fc847 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -136,14 +139,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -212,9 +218,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -231,7 +240,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -260,10 +269,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Site" cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -281,13 +293,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -406,7 +417,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -469,10 +482,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -490,13 +506,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -541,9 +556,12 @@ def analyze_custom_hostname( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname.metadata['url'] # type: ignore @@ -562,7 +580,7 @@ def analyze_custom_hostname( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -605,7 +623,9 @@ def apply_slot_config_to_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -631,7 +651,6 @@ def apply_slot_config_to_production( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -669,10 +688,13 @@ def backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup.metadata['url'] # type: ignore @@ -690,13 +712,12 @@ def backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -734,14 +755,17 @@ def list_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -812,9 +836,12 @@ def get_backup_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_status.metadata['url'] # type: ignore @@ -832,7 +859,7 @@ def get_backup_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -875,7 +902,9 @@ def delete_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -938,10 +967,13 @@ def list_backup_status_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets.metadata['url'] # type: ignore @@ -960,13 +992,12 @@ def list_backup_status_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -993,7 +1024,9 @@ def _restore_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1020,7 +1053,6 @@ def _restore_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -1123,14 +1155,17 @@ def list_configurations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1201,10 +1236,13 @@ def update_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings.metadata['url'] # type: ignore @@ -1222,13 +1260,12 @@ def update_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1266,9 +1303,12 @@ def list_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_application_settings.metadata['url'] # type: ignore @@ -1285,7 +1325,7 @@ def list_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1328,10 +1368,13 @@ def update_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings.metadata['url'] # type: ignore @@ -1349,13 +1392,12 @@ def update_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -1393,9 +1435,12 @@ def get_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_auth_settings.metadata['url'] # type: ignore @@ -1412,7 +1457,7 @@ def get_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1455,10 +1500,13 @@ def update_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts.metadata['url'] # type: ignore @@ -1476,13 +1524,12 @@ def update_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -1520,9 +1567,12 @@ def list_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts.metadata['url'] # type: ignore @@ -1539,7 +1589,7 @@ def list_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1582,10 +1632,13 @@ def update_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration.metadata['url'] # type: ignore @@ -1603,13 +1656,12 @@ def update_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1647,7 +1699,9 @@ def delete_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1701,9 +1755,12 @@ def get_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration.metadata['url'] # type: ignore @@ -1720,7 +1777,7 @@ def get_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1763,10 +1820,13 @@ def update_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings.metadata['url'] # type: ignore @@ -1784,13 +1844,12 @@ def update_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -1828,9 +1887,12 @@ def list_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_connection_strings.metadata['url'] # type: ignore @@ -1847,7 +1909,7 @@ def list_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1887,9 +1949,12 @@ def get_diagnostic_logs_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore @@ -1906,7 +1971,7 @@ def get_diagnostic_logs_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1950,10 +2015,13 @@ def update_diagnostic_logs_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore @@ -1971,13 +2039,12 @@ def update_diagnostic_logs_config( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -2018,10 +2085,13 @@ def update_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata.metadata['url'] # type: ignore @@ -2039,13 +2109,12 @@ def update_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -2083,9 +2152,12 @@ def list_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_metadata.metadata['url'] # type: ignore @@ -2102,7 +2174,7 @@ def list_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2129,9 +2201,12 @@ def _list_publishing_credentials_initial( ): # type: (...) -> "models.User" cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore @@ -2148,7 +2223,7 @@ def _list_publishing_credentials_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2255,10 +2330,13 @@ def update_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings.metadata['url'] # type: ignore @@ -2276,13 +2354,12 @@ def update_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -2320,9 +2397,12 @@ def list_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings.metadata['url'] # type: ignore @@ -2339,7 +2419,7 @@ def list_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2379,9 +2459,12 @@ def list_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_slot_configuration_names.metadata['url'] # type: ignore @@ -2398,7 +2481,7 @@ def list_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2442,10 +2525,13 @@ def update_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot_configuration_names.metadata['url'] # type: ignore @@ -2463,13 +2549,12 @@ def update_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') 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 @@ -2508,9 +2593,12 @@ def get_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration.metadata['url'] # type: ignore @@ -2527,7 +2615,7 @@ def get_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2570,10 +2658,13 @@ def create_or_update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration.metadata['url'] # type: ignore @@ -2591,13 +2682,12 @@ def create_or_update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2638,10 +2728,13 @@ def update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration.metadata['url'] # type: ignore @@ -2659,13 +2752,12 @@ def update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -2704,14 +2796,17 @@ def list_configuration_snapshot_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2782,9 +2877,12 @@ def get_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot.metadata['url'] # type: ignore @@ -2802,7 +2900,7 @@ def get_configuration_snapshot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2845,7 +2943,9 @@ def recover_site_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -2900,9 +3000,12 @@ def get_web_site_container_logs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs.metadata['url'] # type: ignore @@ -2919,7 +3022,7 @@ def get_web_site_container_logs( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -2960,9 +3063,12 @@ def get_container_logs_zip( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip.metadata['url'] # type: ignore @@ -2979,7 +3085,7 @@ def get_container_logs_zip( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -3020,14 +3126,17 @@ def list_continuous_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3098,9 +3207,12 @@ def get_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job.metadata['url'] # type: ignore @@ -3118,7 +3230,7 @@ def get_continuous_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3162,7 +3274,9 @@ def delete_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3220,7 +3334,9 @@ def start_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3278,7 +3394,9 @@ def stop_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3333,14 +3451,17 @@ def list_deployments( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3411,9 +3532,12 @@ def get_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_deployment.metadata['url'] # type: ignore @@ -3431,7 +3555,7 @@ def get_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3477,10 +3601,13 @@ def create_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment.metadata['url'] # type: ignore @@ -3499,13 +3626,12 @@ def create_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -3546,7 +3672,9 @@ def delete_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -3605,9 +3733,12 @@ def list_deployment_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_deployment_log.metadata['url'] # type: ignore @@ -3625,7 +3756,7 @@ def list_deployment_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3670,10 +3801,13 @@ def discover_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup.metadata['url'] # type: ignore @@ -3691,13 +3825,12 @@ def discover_backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -3735,14 +3868,17 @@ def list_domain_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3813,9 +3949,12 @@ def get_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3833,7 +3972,7 @@ def get_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3879,10 +4018,13 @@ def create_or_update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -3901,13 +4043,12 @@ def create_or_update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -3948,7 +4089,9 @@ def delete_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -4009,10 +4152,13 @@ def update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4031,13 +4177,12 @@ def update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -4075,9 +4220,12 @@ def get_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status.metadata['url'] # type: ignore @@ -4094,7 +4242,7 @@ def get_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4122,10 +4270,13 @@ def _create_ms_deploy_operation_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -4143,13 +4294,12 @@ def _create_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -4256,9 +4406,12 @@ def get_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log.metadata['url'] # type: ignore @@ -4275,7 +4428,7 @@ def get_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4316,14 +4469,17 @@ def list_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4390,9 +4546,12 @@ def get_functions_admin_token( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token.metadata['url'] # type: ignore @@ -4409,7 +4568,7 @@ def get_functions_admin_token( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4452,9 +4611,12 @@ def get_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_function.metadata['url'] # type: ignore @@ -4472,7 +4634,7 @@ def get_function( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4502,10 +4664,13 @@ def _create_function_initial( ): # type: (...) -> "models.FunctionEnvelope" cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_function_initial.metadata['url'] # type: ignore @@ -4524,13 +4689,12 @@ def _create_function_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -4643,7 +4807,9 @@ def delete_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -4707,10 +4873,13 @@ def create_or_update_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret.metadata['url'] # type: ignore @@ -4730,13 +4899,12 @@ def create_or_update_function_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -4784,7 +4952,9 @@ def delete_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -4843,9 +5013,12 @@ def list_function_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_keys.metadata['url'] # type: ignore @@ -4863,7 +5036,7 @@ def list_function_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4906,9 +5079,12 @@ def list_function_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_secrets.metadata['url'] # type: ignore @@ -4926,7 +5102,7 @@ def list_function_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4966,9 +5142,12 @@ def list_host_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_host_keys.metadata['url'] # type: ignore @@ -4985,7 +5164,7 @@ def list_host_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5025,9 +5204,12 @@ def list_sync_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_status.metadata['url'] # type: ignore @@ -5044,6 +5226,7 @@ def list_sync_status( # 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) @@ -5080,7 +5263,9 @@ def sync_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -5143,10 +5328,13 @@ def create_or_update_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret.metadata['url'] # type: ignore @@ -5166,13 +5354,12 @@ def create_or_update_host_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -5220,9 +5407,12 @@ def delete_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.delete_host_secret.metadata['url'] # type: ignore @@ -5241,6 +5431,7 @@ def delete_host_secret( # 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) @@ -5277,14 +5468,17 @@ def list_host_name_bindings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5355,9 +5549,12 @@ def get_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding.metadata['url'] # type: ignore @@ -5375,7 +5572,7 @@ def get_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5422,10 +5619,13 @@ def create_or_update_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore @@ -5444,13 +5644,12 @@ def create_or_update_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -5491,7 +5690,9 @@ def delete_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -5552,9 +5753,12 @@ def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -5573,7 +5777,7 @@ def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5622,10 +5826,13 @@ def create_or_update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore @@ -5645,13 +5852,12 @@ def create_or_update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5695,7 +5901,9 @@ def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -5760,10 +5968,13 @@ def update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection.metadata['url'] # type: ignore @@ -5783,13 +5994,12 @@ def update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -5833,9 +6043,12 @@ def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -5854,7 +6067,7 @@ def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5894,9 +6107,12 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections.metadata['url'] # type: ignore @@ -5913,7 +6129,7 @@ def list_hybrid_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5953,9 +6169,12 @@ def list_relay_service_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections.metadata['url'] # type: ignore @@ -5972,7 +6191,7 @@ def list_relay_service_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6015,9 +6234,12 @@ def get_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection.metadata['url'] # type: ignore @@ -6035,7 +6257,7 @@ def get_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6081,10 +6303,13 @@ def create_or_update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore @@ -6103,13 +6328,12 @@ def create_or_update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6150,7 +6374,9 @@ def delete_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -6211,10 +6437,13 @@ def update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection.metadata['url'] # type: ignore @@ -6233,13 +6462,12 @@ def update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6277,14 +6505,17 @@ def list_instance_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6355,9 +6586,12 @@ def get_instance_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore @@ -6375,7 +6609,7 @@ def get_instance_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6404,10 +6638,13 @@ def _create_instance_ms_deploy_operation_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -6426,13 +6663,12 @@ def _create_instance_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -6546,9 +6782,12 @@ def get_instance_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore @@ -6566,7 +6805,7 @@ def get_instance_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6612,14 +6851,17 @@ def list_instance_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6694,9 +6936,12 @@ def get_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process.metadata['url'] # type: ignore @@ -6715,7 +6960,7 @@ def get_instance_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6764,7 +7009,9 @@ def delete_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -6827,9 +7074,12 @@ def get_instance_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump.metadata['url'] # type: ignore @@ -6848,7 +7098,7 @@ def get_instance_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -6897,14 +7147,17 @@ def list_instance_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6983,9 +7236,12 @@ def get_instance_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module.metadata['url'] # type: ignore @@ -7005,7 +7261,7 @@ def get_instance_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7053,14 +7309,17 @@ def list_instance_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7140,9 +7399,12 @@ def get_instance_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread.metadata['url'] # type: ignore @@ -7162,7 +7424,7 @@ def get_instance_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7203,9 +7465,12 @@ def is_cloneable( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.is_cloneable.metadata['url'] # type: ignore @@ -7222,7 +7487,7 @@ def is_cloneable( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7262,9 +7527,12 @@ def list_sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers.metadata['url'] # type: ignore @@ -7281,7 +7549,7 @@ def list_sync_function_triggers( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7321,14 +7589,17 @@ def list_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7406,14 +7677,17 @@ def list_metrics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7474,10 +7748,13 @@ def _migrate_storage_initial( ): # type: (...) -> "models.StorageMigrationResponse" cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_storage_initial.metadata['url'] # type: ignore @@ -7496,13 +7773,12 @@ def _migrate_storage_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') 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 @@ -7600,10 +7876,13 @@ def _migrate_my_sql_initial( ): # type: (...) -> "models.Operation" cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_my_sql_initial.metadata['url'] # type: ignore @@ -7621,13 +7900,12 @@ def _migrate_my_sql_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') 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 @@ -7734,9 +8012,12 @@ def get_migrate_my_sql_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore @@ -7753,7 +8034,7 @@ def get_migrate_my_sql_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7793,9 +8074,12 @@ def get_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -7812,7 +8096,7 @@ def get_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7859,10 +8143,13 @@ def create_or_update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -7880,13 +8167,12 @@ def create_or_update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -7924,7 +8210,9 @@ def delete_swift_virtual_network( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -7985,10 +8273,13 @@ def update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -8006,13 +8297,12 @@ def update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -8053,9 +8343,12 @@ def list_network_features( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_network_features.metadata['url'] # type: ignore @@ -8073,7 +8366,7 @@ def list_network_features( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8117,9 +8410,12 @@ def get_network_trace_operation( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation.metadata['url'] # type: ignore @@ -8137,7 +8433,7 @@ def get_network_trace_operation( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8190,9 +8486,12 @@ def start_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace.metadata['url'] # type: ignore @@ -8215,7 +8514,7 @@ def start_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8245,9 +8544,12 @@ def _start_web_site_network_trace_operation_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore @@ -8270,7 +8572,7 @@ def _start_web_site_network_trace_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8390,7 +8692,9 @@ def stop_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -8447,9 +8751,12 @@ def get_network_traces( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces.metadata['url'] # type: ignore @@ -8467,7 +8774,7 @@ def get_network_traces( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8510,9 +8817,12 @@ def get_network_trace_operation_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore @@ -8530,7 +8840,7 @@ def get_network_trace_operation_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8577,9 +8887,12 @@ def get_network_traces_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces_v2.metadata['url'] # type: ignore @@ -8597,7 +8910,7 @@ def get_network_traces_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8637,7 +8950,9 @@ def generate_new_site_publishing_password( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -8696,14 +9011,17 @@ def list_perf_mon_counters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8773,9 +9091,12 @@ def get_site_php_error_log_flag( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore @@ -8792,7 +9113,7 @@ def get_site_php_error_log_flag( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8832,9 +9153,12 @@ def list_premier_add_ons( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons.metadata['url'] # type: ignore @@ -8851,7 +9175,7 @@ def list_premier_add_ons( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8894,9 +9218,12 @@ def get_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on.metadata['url'] # type: ignore @@ -8914,7 +9241,7 @@ def get_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8960,10 +9287,13 @@ def add_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on.metadata['url'] # type: ignore @@ -8982,13 +9312,12 @@ def add_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -9029,7 +9358,9 @@ def delete_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -9090,10 +9421,13 @@ def update_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on.metadata['url'] # type: ignore @@ -9112,13 +9446,12 @@ def update_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -9157,9 +9490,12 @@ def get_private_access( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_private_access.metadata['url'] # type: ignore @@ -9176,7 +9512,7 @@ def get_private_access( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9220,10 +9556,13 @@ def put_private_access_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet.metadata['url'] # type: ignore @@ -9241,13 +9580,12 @@ def put_private_access_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -9286,14 +9624,17 @@ def list_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9363,9 +9704,12 @@ def get_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process.metadata['url'] # type: ignore @@ -9383,7 +9727,7 @@ def get_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9428,7 +9772,9 @@ def delete_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -9486,9 +9832,12 @@ def get_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_dump.metadata['url'] # type: ignore @@ -9506,7 +9855,7 @@ def get_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -9551,14 +9900,17 @@ def list_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9632,9 +9984,12 @@ def get_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_module.metadata['url'] # type: ignore @@ -9653,7 +10008,7 @@ def get_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9697,14 +10052,17 @@ def list_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9779,9 +10137,12 @@ def get_process_thread( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_thread.metadata['url'] # type: ignore @@ -9800,7 +10161,7 @@ def get_process_thread( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9841,14 +10202,17 @@ def list_public_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9919,9 +10283,12 @@ def get_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_public_certificate.metadata['url'] # type: ignore @@ -9939,7 +10306,7 @@ def get_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9986,10 +10353,13 @@ def create_or_update_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate.metadata['url'] # type: ignore @@ -10008,13 +10378,12 @@ def create_or_update_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -10055,7 +10424,9 @@ def delete_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10114,10 +10485,13 @@ def list_publishing_profile_xml_with_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore @@ -10135,13 +10509,12 @@ def list_publishing_profile_xml_with_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -10180,7 +10553,9 @@ def reset_production_slot_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10242,7 +10617,9 @@ def restart( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10288,7 +10665,9 @@ def _restore_from_backup_blob_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -10314,7 +10693,6 @@ def _restore_from_backup_blob_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10401,7 +10779,9 @@ def _restore_from_deleted_app_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -10427,7 +10807,6 @@ def _restore_from_deleted_app_initial( body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -10514,7 +10893,9 @@ def _restore_snapshot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -10540,7 +10921,6 @@ def _restore_snapshot_initial( body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -10640,14 +11020,17 @@ def list_site_extensions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10717,9 +11100,12 @@ def get_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_extension.metadata['url'] # type: ignore @@ -10737,7 +11123,7 @@ def get_site_extension( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10766,9 +11152,12 @@ def _install_site_extension_initial( ): # type: (...) -> Optional["models.SiteExtensionInfo"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._install_site_extension_initial.metadata['url'] # type: ignore @@ -10786,7 +11175,7 @@ def _install_site_extension_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -10901,7 +11290,9 @@ def delete_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -10956,14 +11347,17 @@ def list_slots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11034,9 +11428,12 @@ def get_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_slot.metadata['url'] # type: ignore @@ -11054,7 +11451,7 @@ def get_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11084,10 +11481,13 @@ def _create_or_update_slot_initial( ): # type: (...) -> "models.Site" cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_slot_initial.metadata['url'] # type: ignore @@ -11106,13 +11506,12 @@ def _create_or_update_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -11241,7 +11640,9 @@ def delete_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -11309,10 +11710,13 @@ def update_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot.metadata['url'] # type: ignore @@ -11331,13 +11735,12 @@ def update_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -11385,9 +11788,12 @@ def analyze_custom_hostname_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore @@ -11407,7 +11813,7 @@ def analyze_custom_hostname_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11454,7 +11860,9 @@ def apply_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -11481,7 +11889,6 @@ def apply_slot_configuration_slot( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -11523,10 +11930,13 @@ def backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup_slot.metadata['url'] # type: ignore @@ -11545,13 +11955,12 @@ def backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -11593,14 +12002,17 @@ def list_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11676,9 +12088,12 @@ def get_backup_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_status_slot.metadata['url'] # type: ignore @@ -11697,7 +12112,7 @@ def get_backup_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11744,7 +12159,9 @@ def delete_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -11811,10 +12228,13 @@ def list_backup_status_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore @@ -11834,13 +12254,12 @@ def list_backup_status_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -11868,7 +12287,9 @@ def _restore_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -11896,7 +12317,6 @@ def _restore_slot_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -12008,14 +12428,17 @@ def list_configurations_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12091,10 +12514,13 @@ def update_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings_slot.metadata['url'] # type: ignore @@ -12113,13 +12539,12 @@ def update_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -12161,9 +12586,12 @@ def list_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_application_settings_slot.metadata['url'] # type: ignore @@ -12181,7 +12609,7 @@ def list_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12227,10 +12655,13 @@ def update_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings_slot.metadata['url'] # type: ignore @@ -12249,13 +12680,12 @@ def update_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -12297,9 +12727,12 @@ def get_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_auth_settings_slot.metadata['url'] # type: ignore @@ -12317,7 +12750,7 @@ def get_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12364,10 +12797,13 @@ def update_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12386,13 +12822,12 @@ def update_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -12434,9 +12869,12 @@ def list_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12454,7 +12892,7 @@ def list_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12501,10 +12939,13 @@ def update_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration_slot.metadata['url'] # type: ignore @@ -12523,13 +12964,12 @@ def update_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -12571,7 +13011,9 @@ def delete_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -12630,9 +13072,12 @@ def get_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration_slot.metadata['url'] # type: ignore @@ -12650,7 +13095,7 @@ def get_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12697,10 +13142,13 @@ def update_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings_slot.metadata['url'] # type: ignore @@ -12719,13 +13167,12 @@ def update_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -12767,9 +13214,12 @@ def list_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_connection_strings_slot.metadata['url'] # type: ignore @@ -12787,7 +13237,7 @@ def list_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12831,9 +13281,12 @@ def get_diagnostic_logs_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore @@ -12851,7 +13304,7 @@ def get_diagnostic_logs_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12899,10 +13352,13 @@ def update_diagnostic_logs_config_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore @@ -12921,13 +13377,12 @@ def update_diagnostic_logs_config_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -12972,10 +13427,13 @@ def update_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata_slot.metadata['url'] # type: ignore @@ -12994,13 +13452,12 @@ def update_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -13042,9 +13499,12 @@ def list_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_metadata_slot.metadata['url'] # type: ignore @@ -13062,7 +13522,7 @@ def list_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13090,9 +13550,12 @@ def _list_publishing_credentials_slot_initial( ): # type: (...) -> "models.User" cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore @@ -13110,7 +13573,7 @@ def _list_publishing_credentials_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13225,10 +13688,13 @@ def update_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings_slot.metadata['url'] # type: ignore @@ -13247,13 +13713,12 @@ def update_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -13294,9 +13759,12 @@ def list_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings_slot.metadata['url'] # type: ignore @@ -13314,7 +13782,7 @@ def list_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13359,9 +13827,12 @@ def get_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration_slot.metadata['url'] # type: ignore @@ -13379,7 +13850,7 @@ def get_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13426,10 +13897,13 @@ def create_or_update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore @@ -13448,13 +13922,12 @@ def create_or_update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13499,10 +13972,13 @@ def update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration_slot.metadata['url'] # type: ignore @@ -13521,13 +13997,12 @@ def update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13570,14 +14045,17 @@ def list_configuration_snapshot_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13653,9 +14131,12 @@ def get_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -13674,7 +14155,7 @@ def get_configuration_snapshot_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13721,7 +14202,9 @@ def recover_site_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -13780,9 +14263,12 @@ def get_web_site_container_logs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore @@ -13800,7 +14286,7 @@ def get_web_site_container_logs_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -13844,9 +14330,12 @@ def get_container_logs_zip_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore @@ -13864,7 +14353,7 @@ def get_container_logs_zip_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -13909,14 +14398,17 @@ def list_continuous_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13992,9 +14484,12 @@ def get_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14013,7 +14508,7 @@ def get_continuous_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14061,7 +14556,9 @@ def delete_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14124,7 +14621,9 @@ def start_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14187,7 +14686,9 @@ def stop_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14247,14 +14748,17 @@ def list_deployments_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14330,9 +14834,12 @@ def get_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_deployment_slot.metadata['url'] # type: ignore @@ -14351,7 +14858,7 @@ def get_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14401,10 +14908,13 @@ def create_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment_slot.metadata['url'] # type: ignore @@ -14424,13 +14934,12 @@ def create_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -14475,7 +14984,9 @@ def delete_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14539,9 +15050,12 @@ def list_deployment_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_deployment_log_slot.metadata['url'] # type: ignore @@ -14560,7 +15074,7 @@ def list_deployment_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14609,10 +15123,13 @@ def discover_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup_slot.metadata['url'] # type: ignore @@ -14631,13 +15148,12 @@ def discover_backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -14679,14 +15195,17 @@ def list_domain_ownership_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14762,9 +15281,12 @@ def get_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14783,7 +15305,7 @@ def get_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14833,10 +15355,13 @@ def create_or_update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14856,13 +15381,12 @@ def create_or_update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -14907,7 +15431,9 @@ def delete_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -14973,10 +15499,13 @@ def update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14996,13 +15525,12 @@ def update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -15043,9 +15571,12 @@ def get_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -15063,7 +15594,7 @@ def get_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15092,10 +15623,13 @@ def _create_ms_deploy_operation_slot_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -15114,13 +15648,12 @@ def _create_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -15234,9 +15767,12 @@ def get_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -15254,7 +15790,7 @@ def get_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15298,14 +15834,17 @@ def list_instance_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15376,9 +15915,12 @@ def get_functions_admin_token_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore @@ -15396,7 +15938,7 @@ def get_functions_admin_token_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15442,9 +15984,12 @@ def get_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_function_slot.metadata['url'] # type: ignore @@ -15463,7 +16008,7 @@ def get_instance_function_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15494,10 +16039,13 @@ def _create_instance_function_slot_initial( ): # type: (...) -> "models.FunctionEnvelope" cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore @@ -15517,13 +16065,12 @@ def _create_instance_function_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -15643,7 +16190,9 @@ def delete_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -15711,10 +16260,13 @@ def create_or_update_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore @@ -15735,13 +16287,12 @@ def create_or_update_function_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -15792,7 +16343,9 @@ def delete_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -15855,9 +16408,12 @@ def list_function_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_keys_slot.metadata['url'] # type: ignore @@ -15876,7 +16432,7 @@ def list_function_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15922,9 +16478,12 @@ def list_function_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_function_secrets_slot.metadata['url'] # type: ignore @@ -15943,7 +16502,7 @@ def list_function_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15986,9 +16545,12 @@ def list_host_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_host_keys_slot.metadata['url'] # type: ignore @@ -16006,7 +16568,7 @@ def list_host_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16049,9 +16611,12 @@ def list_sync_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_status_slot.metadata['url'] # type: ignore @@ -16069,6 +16634,7 @@ def list_sync_status_slot( # 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) @@ -16108,9 +16674,12 @@ def sync_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.sync_functions_slot.metadata['url'] # type: ignore @@ -16128,6 +16697,7 @@ def sync_functions_slot( # 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) @@ -16176,10 +16746,13 @@ def create_or_update_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore @@ -16200,13 +16773,12 @@ def create_or_update_host_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -16257,9 +16829,12 @@ def delete_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.delete_host_secret_slot.metadata['url'] # type: ignore @@ -16279,6 +16854,7 @@ def delete_host_secret_slot( # 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) @@ -16319,14 +16895,17 @@ def list_host_name_bindings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16402,9 +16981,12 @@ def get_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding_slot.metadata['url'] # type: ignore @@ -16423,7 +17005,7 @@ def get_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16474,10 +17056,13 @@ def create_or_update_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore @@ -16497,13 +17082,12 @@ def create_or_update_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -16548,7 +17132,9 @@ def delete_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -16613,9 +17199,12 @@ def get_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16635,7 +17224,7 @@ def get_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16687,10 +17276,13 @@ def create_or_update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16711,13 +17303,12 @@ def create_or_update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -16764,7 +17355,9 @@ def delete_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -16833,10 +17426,13 @@ def update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16857,13 +17453,12 @@ def update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -16910,9 +17505,12 @@ def list_hybrid_connection_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys_slot.metadata['url'] # type: ignore @@ -16932,7 +17530,7 @@ def list_hybrid_connection_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16975,9 +17573,12 @@ def list_hybrid_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore @@ -16995,7 +17596,7 @@ def list_hybrid_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17039,9 +17640,12 @@ def list_relay_service_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore @@ -17059,7 +17663,7 @@ def list_relay_service_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17106,9 +17710,12 @@ def get_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17127,7 +17734,7 @@ def get_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17177,10 +17784,13 @@ def create_or_update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17200,13 +17810,12 @@ def create_or_update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17251,7 +17860,9 @@ def delete_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -17317,10 +17928,13 @@ def update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17340,13 +17954,12 @@ def update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17388,14 +18001,17 @@ def list_instance_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17470,9 +18086,12 @@ def get_instance_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -17491,7 +18110,7 @@ def get_instance_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17521,10 +18140,13 @@ def _create_instance_ms_deploy_operation_slot_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -17544,13 +18166,12 @@ def _create_instance_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -17671,9 +18292,12 @@ def get_instance_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -17692,7 +18316,7 @@ def get_instance_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17742,14 +18366,17 @@ def list_instance_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17829,9 +18456,12 @@ def get_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_slot.metadata['url'] # type: ignore @@ -17851,7 +18481,7 @@ def get_instance_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17904,7 +18534,9 @@ def delete_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -17972,9 +18604,12 @@ def get_instance_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore @@ -17994,7 +18629,7 @@ def get_instance_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -18047,14 +18682,17 @@ def list_instance_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18138,9 +18776,12 @@ def get_instance_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module_slot.metadata['url'] # type: ignore @@ -18161,7 +18802,7 @@ def get_instance_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18213,14 +18854,17 @@ def list_instance_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18305,9 +18949,12 @@ def get_instance_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_instance_process_thread_slot.metadata['url'] # type: ignore @@ -18328,7 +18975,7 @@ def get_instance_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18373,9 +19020,12 @@ def is_cloneable_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.is_cloneable_slot.metadata['url'] # type: ignore @@ -18393,7 +19043,7 @@ def is_cloneable_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18436,9 +19086,12 @@ def list_sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore @@ -18456,7 +19109,7 @@ def list_sync_function_triggers_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18500,14 +19153,17 @@ def list_metric_definitions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18590,14 +19246,17 @@ def list_metrics_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18674,9 +19333,12 @@ def get_migrate_my_sql_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore @@ -18694,7 +19356,7 @@ def get_migrate_my_sql_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18738,9 +19400,12 @@ def get_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18758,7 +19423,7 @@ def get_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18809,10 +19474,13 @@ def create_or_update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18831,13 +19499,12 @@ def create_or_update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -18879,7 +19546,9 @@ def delete_swift_virtual_network_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -18945,10 +19614,13 @@ def update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18967,13 +19639,12 @@ def update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -19018,9 +19689,12 @@ def list_network_features_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_network_features_slot.metadata['url'] # type: ignore @@ -19039,7 +19713,7 @@ def list_network_features_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19087,9 +19761,12 @@ def get_network_trace_operation_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore @@ -19108,7 +19785,7 @@ def get_network_trace_operation_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19164,9 +19841,12 @@ def start_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -19190,7 +19870,7 @@ def start_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19221,9 +19901,12 @@ def _start_web_site_network_trace_operation_slot_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore @@ -19247,7 +19930,7 @@ def _start_web_site_network_trace_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19374,7 +20057,9 @@ def stop_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -19436,9 +20121,12 @@ def get_network_traces_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot.metadata['url'] # type: ignore @@ -19457,7 +20145,7 @@ def get_network_traces_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19504,9 +20192,12 @@ def get_network_trace_operation_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore @@ -19525,7 +20216,7 @@ def get_network_trace_operation_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19576,9 +20267,12 @@ def get_network_traces_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore @@ -19597,7 +20291,7 @@ def get_network_traces_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19641,7 +20335,9 @@ def generate_new_site_publishing_password_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -19704,14 +20400,17 @@ def list_perf_mon_counters_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19785,9 +20484,12 @@ def get_site_php_error_log_flag_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore @@ -19805,7 +20507,7 @@ def get_site_php_error_log_flag_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19849,9 +20551,12 @@ def list_premier_add_ons_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore @@ -19869,7 +20574,7 @@ def list_premier_add_ons_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19916,9 +20621,12 @@ def get_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on_slot.metadata['url'] # type: ignore @@ -19937,7 +20645,7 @@ def get_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19987,10 +20695,13 @@ def add_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on_slot.metadata['url'] # type: ignore @@ -20010,13 +20721,12 @@ def add_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -20061,7 +20771,9 @@ def delete_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -20127,10 +20839,13 @@ def update_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on_slot.metadata['url'] # type: ignore @@ -20150,13 +20865,12 @@ def update_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -20198,9 +20912,12 @@ def get_private_access_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_private_access_slot.metadata['url'] # type: ignore @@ -20218,7 +20935,7 @@ def get_private_access_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20265,10 +20982,13 @@ def put_private_access_vnet_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore @@ -20287,13 +21007,12 @@ def put_private_access_vnet_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -20336,14 +21055,17 @@ def list_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20418,9 +21140,12 @@ def get_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_slot.metadata['url'] # type: ignore @@ -20439,7 +21164,7 @@ def get_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20488,7 +21213,9 @@ def delete_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -20551,9 +21278,12 @@ def get_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_dump_slot.metadata['url'] # type: ignore @@ -20572,7 +21302,7 @@ def get_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -20621,14 +21351,17 @@ def list_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20707,9 +21440,12 @@ def get_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_module_slot.metadata['url'] # type: ignore @@ -20729,7 +21465,7 @@ def get_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20777,14 +21513,17 @@ def list_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20864,9 +21603,12 @@ def get_process_thread_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessThreadInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_process_thread_slot.metadata['url'] # type: ignore @@ -20886,7 +21628,7 @@ def get_process_thread_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20931,14 +21673,17 @@ def list_public_certificates_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21014,9 +21759,12 @@ def get_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_public_certificate_slot.metadata['url'] # type: ignore @@ -21035,7 +21783,7 @@ def get_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21086,10 +21834,13 @@ def create_or_update_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore @@ -21109,13 +21860,12 @@ def create_or_update_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -21160,7 +21910,9 @@ def delete_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -21224,10 +21976,13 @@ def list_publishing_profile_xml_with_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore @@ -21246,13 +22001,12 @@ def list_publishing_profile_xml_with_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -21295,7 +22049,9 @@ def reset_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -21362,7 +22118,9 @@ def restart_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -21410,7 +22168,9 @@ def _restore_from_backup_blob_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21437,7 +22197,6 @@ def _restore_from_backup_blob_slot_initial( body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -21530,7 +22289,9 @@ def _restore_from_deleted_app_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21557,7 +22318,6 @@ def _restore_from_deleted_app_slot_initial( body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -21649,7 +22409,9 @@ def _restore_snapshot_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -21676,7 +22438,6 @@ def _restore_snapshot_slot_initial( body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -21784,14 +22545,17 @@ def list_site_extensions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21866,9 +22630,12 @@ def get_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_site_extension_slot.metadata['url'] # type: ignore @@ -21887,7 +22654,7 @@ def get_site_extension_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21917,9 +22684,12 @@ def _install_site_extension_slot_initial( ): # type: (...) -> Optional["models.SiteExtensionInfo"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore @@ -21938,7 +22708,7 @@ def _install_site_extension_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -22062,7 +22832,9 @@ def delete_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22125,16 +22897,19 @@ def list_slot_differences_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22154,7 +22929,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -22162,7 +22936,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -22200,7 +22973,9 @@ def _swap_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -22227,7 +23002,6 @@ def _swap_slot_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -22334,14 +23108,17 @@ def list_snapshots_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22413,14 +23190,17 @@ def list_snapshots_from_dr_secondary_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22493,9 +23273,12 @@ def get_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_source_control_slot.metadata['url'] # type: ignore @@ -22513,7 +23296,7 @@ def get_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22549,10 +23332,13 @@ def _create_or_update_source_control_slot_initial( ): # type: (...) -> "models.SiteSourceControl" cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore @@ -22571,13 +23357,12 @@ def _create_or_update_source_control_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -22699,7 +23484,9 @@ def delete_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22761,10 +23548,13 @@ def update_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control_slot.metadata['url'] # type: ignore @@ -22783,13 +23573,12 @@ def update_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -22838,7 +23627,9 @@ def start_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -22884,9 +23675,12 @@ def _start_network_trace_slot_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore @@ -22910,7 +23704,7 @@ def _start_network_trace_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23038,7 +23832,9 @@ def stop_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23096,7 +23892,9 @@ def stop_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23154,7 +23952,9 @@ def sync_repository_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23212,7 +24012,9 @@ def sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23271,14 +24073,17 @@ def list_triggered_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23354,9 +24159,12 @@ def get_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore @@ -23375,7 +24183,7 @@ def get_triggered_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23423,7 +24231,9 @@ def delete_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23486,14 +24296,17 @@ def list_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23572,9 +24385,12 @@ def get_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore @@ -23594,7 +24410,7 @@ def get_triggered_web_job_history_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23642,7 +24458,9 @@ def run_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -23708,14 +24526,17 @@ def list_usages_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23790,9 +24611,12 @@ def list_vnet_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections_slot.metadata['url'] # type: ignore @@ -23810,7 +24634,7 @@ def list_vnet_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23857,9 +24681,12 @@ def get_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_slot.metadata['url'] # type: ignore @@ -23878,7 +24705,7 @@ def get_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23929,10 +24756,13 @@ def create_or_update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore @@ -23952,13 +24782,12 @@ def create_or_update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -24003,7 +24832,9 @@ def delete_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -24070,10 +24901,13 @@ def update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_slot.metadata['url'] # type: ignore @@ -24093,13 +24927,12 @@ def update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -24147,9 +24980,12 @@ def get_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24169,7 +25005,7 @@ def get_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24223,10 +25059,13 @@ def create_or_update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24247,13 +25086,12 @@ def create_or_update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -24304,10 +25142,13 @@ def update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24328,13 +25169,12 @@ def update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -24376,14 +25216,17 @@ def list_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24459,9 +25302,12 @@ def get_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_web_job_slot.metadata['url'] # type: ignore @@ -24480,7 +25326,7 @@ def get_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24523,16 +25369,19 @@ def list_slot_differences_from_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24551,7 +25400,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -24559,7 +25407,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -24596,7 +25443,9 @@ def _swap_slot_with_production_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -24622,7 +25471,6 @@ def _swap_slot_with_production_initial( body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -24721,14 +25569,17 @@ def list_snapshots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24796,14 +25647,17 @@ def list_snapshots_from_dr_secondary( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24871,9 +25725,12 @@ def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -24890,7 +25747,7 @@ def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24925,10 +25782,13 @@ def _create_or_update_source_control_initial( ): # type: (...) -> "models.SiteSourceControl" cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore @@ -24946,13 +25806,12 @@ def _create_or_update_source_control_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -25065,7 +25924,9 @@ def delete_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25122,10 +25983,13 @@ def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -25143,13 +26007,12 @@ def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -25194,7 +26057,9 @@ def start( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25238,9 +26103,12 @@ def _start_network_trace_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self._start_network_trace_initial.metadata['url'] # type: ignore @@ -25263,7 +26131,7 @@ def _start_network_trace_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25383,7 +26251,9 @@ def stop( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25437,7 +26307,9 @@ def stop_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25491,7 +26363,9 @@ def sync_repository( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25545,7 +26419,9 @@ def sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25599,14 +26475,17 @@ def list_triggered_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25677,9 +26556,12 @@ def get_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job.metadata['url'] # type: ignore @@ -25697,7 +26579,7 @@ def get_triggered_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25741,7 +26623,9 @@ def delete_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -25799,14 +26683,17 @@ def list_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25880,9 +26767,12 @@ def get_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history.metadata['url'] # type: ignore @@ -25901,7 +26791,7 @@ def get_triggered_web_job_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25945,7 +26835,9 @@ def run_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -26006,14 +26898,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26083,9 +26978,12 @@ def list_vnet_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections.metadata['url'] # type: ignore @@ -26102,7 +27000,7 @@ def list_vnet_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26145,9 +27043,12 @@ def get_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection.metadata['url'] # type: ignore @@ -26165,7 +27066,7 @@ def get_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26212,10 +27113,13 @@ def create_or_update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore @@ -26234,13 +27138,12 @@ def create_or_update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -26281,7 +27184,9 @@ def delete_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -26343,10 +27248,13 @@ def update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection.metadata['url'] # type: ignore @@ -26365,13 +27273,12 @@ def update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -26415,9 +27322,12 @@ def get_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26436,7 +27346,7 @@ def get_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26486,10 +27396,13 @@ def create_or_update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26509,13 +27422,12 @@ def create_or_update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -26562,10 +27474,13 @@ def update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26585,13 +27500,12 @@ def update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -26629,14 +27543,17 @@ def list_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26707,9 +27624,12 @@ def get_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_web_job.metadata['url'] # type: ignore @@ -26727,7 +27647,7 @@ def get_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py index b7558171864d..b55d4da57c42 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -40,9 +40,12 @@ def get_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_publishing_user.metadata['url'] # type: ignore @@ -53,7 +56,7 @@ def get_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -90,10 +93,13 @@ def update_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_publishing_user.metadata['url'] # type: ignore @@ -105,13 +111,12 @@ def update_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') 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 @@ -143,14 +148,17 @@ def list_source_controls( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -209,9 +217,12 @@ def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -226,7 +237,7 @@ def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -266,10 +277,13 @@ def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -285,13 +299,12 @@ def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') 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 @@ -329,14 +342,17 @@ def list_billing_meters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -409,12 +425,15 @@ def check_name_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_name_availability.metadata['url'] # type: ignore @@ -430,13 +449,12 @@ def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') 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 @@ -468,9 +486,12 @@ def get_subscription_deployment_locations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore @@ -485,7 +506,7 @@ def get_subscription_deployment_locations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -534,14 +555,17 @@ def list_geo_regions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -612,16 +636,19 @@ def list_site_identifiers_assigned_to_host_name( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -638,7 +665,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -646,7 +672,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -689,14 +714,17 @@ def list_premier_add_on_offers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -756,9 +784,12 @@ def list_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" + accept = "application/json" # Construct URL url = self.list_skus.metadata['url'] # type: ignore @@ -773,7 +804,7 @@ def list_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -811,10 +842,13 @@ def verify_hosting_environment_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore @@ -830,13 +864,12 @@ def verify_hosting_environment_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') 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 @@ -874,7 +907,9 @@ def move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -899,7 +934,6 @@ def move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 @@ -933,10 +967,13 @@ def validate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate.metadata['url'] # type: ignore @@ -953,13 +990,12 @@ def validate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') 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 @@ -997,10 +1033,13 @@ def validate_container_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate_container_settings.metadata['url'] # type: ignore @@ -1017,13 +1056,12 @@ def validate_container_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_container_settings_request, 'ValidateContainerSettingsRequest') 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 @@ -1061,7 +1099,9 @@ def validate_move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" content_type = kwargs.pop("content_type", "application/json") @@ -1086,7 +1126,6 @@ def validate_move( body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py index 320f393eaad4..93ee893dbacc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2018-11-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json index 60ea13b904df..4e3b7f31681f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": false }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "certificates": "CertificatesOperations" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py index dc9bd8458e90..0cf6bc936e60 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py @@ -32,7 +32,6 @@ class WebSiteManagementClient(object): :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( @@ -50,6 +49,7 @@ def __init__( 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.certificates = CertificatesOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration.py index 4c156dabe8ec..34b940936229 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2018-11-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py similarity index 89% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py index 520547ef2222..4885d924323f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py @@ -15,8 +15,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import CertificatesOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import CertificatesOperations from .. import models @@ -24,13 +24,12 @@ class WebSiteManagementClient(object): """WebSite Management Client. :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.web.v2018_11_01.aio.operations_async.CertificatesOperations + :vartype certificates: azure.mgmt.web.v2018_11_01.aio.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). :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. """ def __init__( @@ -47,6 +46,7 @@ def __init__( 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.certificates = CertificatesOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/__init__.py similarity index 88% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/__init__.py index 9ca77d91ff12..d364847de656 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._certificates_operations_async import CertificatesOperations +from ._certificates_operations import CertificatesOperations __all__ = [ 'CertificatesOperations', diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py index 02932d5ed2df..7e44f2fd1352 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations_async/_certificates_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -258,10 +267,13 @@ async def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -279,13 +291,12 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -322,7 +333,9 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" @@ -378,10 +391,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -399,13 +415,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_paged_models.py deleted file mode 100644 index 596f67f1794d..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/models/_paged_models.py +++ /dev/null @@ -1,27 +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 msrest.paging import Paged - - -class CertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`Certificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Certificate]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificatePaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py index 17ed637ef12a..2fc2b1e1554d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -266,10 +275,13 @@ def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -287,13 +299,12 @@ def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -331,7 +342,9 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" @@ -388,10 +401,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -409,13 +425,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py index e4c16b761c60..ac656a9a822f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_configuration.py @@ -49,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2019-08-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json index dd60bcfe8d6d..438343922a39 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json @@ -7,7 +7,8 @@ "description": "WebSite Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, - "azure_arm": true + "azure_arm": true, + "has_lro_operations": true }, "global_parameters": { "sync_method": { @@ -46,7 +47,8 @@ "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "app_service_certificate_orders": "AppServiceCertificateOrdersOperations", @@ -259,6 +261,6 @@ "call": "resource_group_name, move_resource_envelope" } }, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py index c1b706667583..d2a9b010c694 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py @@ -93,6 +93,7 @@ def __init__( 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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py index cc8f3cf28fcb..fc106a4f3d78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._web_site_management_client_async import WebSiteManagementClient +from ._web_site_management_client import WebSiteManagementClient __all__ = ['WebSiteManagementClient'] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration.py similarity index 95% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration.py index 4610981e0e40..823ae878264f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_configuration.py @@ -46,8 +46,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2019-08-01" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-web/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py similarity index 78% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py index 3082f2d27363..987d8f2f4a39 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py @@ -15,23 +15,23 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import WebSiteManagementClientConfiguration -from .operations_async import AppServiceCertificateOrdersOperations -from .operations_async import CertificateRegistrationProviderOperations -from .operations_async import DomainsOperations -from .operations_async import TopLevelDomainsOperations -from .operations_async import DomainRegistrationProviderOperations -from .operations_async import CertificatesOperations -from .operations_async import DeletedWebAppsOperations -from .operations_async import DiagnosticsOperations -from .operations_async import ProviderOperations -from .operations_async import RecommendationsOperations -from .operations_async import WebSiteManagementClientOperationsMixin -from .operations_async import WebAppsOperations -from .operations_async import StaticSitesOperations -from .operations_async import AppServiceEnvironmentsOperations -from .operations_async import AppServicePlansOperations -from .operations_async import ResourceHealthMetadataOperations +from ._configuration import WebSiteManagementClientConfiguration +from .operations import AppServiceCertificateOrdersOperations +from .operations import CertificateRegistrationProviderOperations +from .operations import DomainsOperations +from .operations import TopLevelDomainsOperations +from .operations import DomainRegistrationProviderOperations +from .operations import CertificatesOperations +from .operations import DeletedWebAppsOperations +from .operations import DiagnosticsOperations +from .operations import ProviderOperations +from .operations import RecommendationsOperations +from .operations import WebSiteManagementClientOperationsMixin +from .operations import WebAppsOperations +from .operations import StaticSitesOperations +from .operations import AppServiceEnvironmentsOperations +from .operations import AppServicePlansOperations +from .operations import ResourceHealthMetadataOperations from .. import models @@ -39,35 +39,35 @@ class WebSiteManagementClient(WebSiteManagementClientOperationsMixin): """WebSite Management Client. :ivar app_service_certificate_orders: AppServiceCertificateOrdersOperations operations - :vartype app_service_certificate_orders: azure.mgmt.web.v2019_08_01.aio.operations_async.AppServiceCertificateOrdersOperations + :vartype app_service_certificate_orders: azure.mgmt.web.v2019_08_01.aio.operations.AppServiceCertificateOrdersOperations :ivar certificate_registration_provider: CertificateRegistrationProviderOperations operations - :vartype certificate_registration_provider: azure.mgmt.web.v2019_08_01.aio.operations_async.CertificateRegistrationProviderOperations + :vartype certificate_registration_provider: azure.mgmt.web.v2019_08_01.aio.operations.CertificateRegistrationProviderOperations :ivar domains: DomainsOperations operations - :vartype domains: azure.mgmt.web.v2019_08_01.aio.operations_async.DomainsOperations + :vartype domains: azure.mgmt.web.v2019_08_01.aio.operations.DomainsOperations :ivar top_level_domains: TopLevelDomainsOperations operations - :vartype top_level_domains: azure.mgmt.web.v2019_08_01.aio.operations_async.TopLevelDomainsOperations + :vartype top_level_domains: azure.mgmt.web.v2019_08_01.aio.operations.TopLevelDomainsOperations :ivar domain_registration_provider: DomainRegistrationProviderOperations operations - :vartype domain_registration_provider: azure.mgmt.web.v2019_08_01.aio.operations_async.DomainRegistrationProviderOperations + :vartype domain_registration_provider: azure.mgmt.web.v2019_08_01.aio.operations.DomainRegistrationProviderOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.web.v2019_08_01.aio.operations_async.CertificatesOperations + :vartype certificates: azure.mgmt.web.v2019_08_01.aio.operations.CertificatesOperations :ivar deleted_web_apps: DeletedWebAppsOperations operations - :vartype deleted_web_apps: azure.mgmt.web.v2019_08_01.aio.operations_async.DeletedWebAppsOperations + :vartype deleted_web_apps: azure.mgmt.web.v2019_08_01.aio.operations.DeletedWebAppsOperations :ivar diagnostics: DiagnosticsOperations operations - :vartype diagnostics: azure.mgmt.web.v2019_08_01.aio.operations_async.DiagnosticsOperations + :vartype diagnostics: azure.mgmt.web.v2019_08_01.aio.operations.DiagnosticsOperations :ivar provider: ProviderOperations operations - :vartype provider: azure.mgmt.web.v2019_08_01.aio.operations_async.ProviderOperations + :vartype provider: azure.mgmt.web.v2019_08_01.aio.operations.ProviderOperations :ivar recommendations: RecommendationsOperations operations - :vartype recommendations: azure.mgmt.web.v2019_08_01.aio.operations_async.RecommendationsOperations + :vartype recommendations: azure.mgmt.web.v2019_08_01.aio.operations.RecommendationsOperations :ivar web_apps: WebAppsOperations operations - :vartype web_apps: azure.mgmt.web.v2019_08_01.aio.operations_async.WebAppsOperations + :vartype web_apps: azure.mgmt.web.v2019_08_01.aio.operations.WebAppsOperations :ivar static_sites: StaticSitesOperations operations - :vartype static_sites: azure.mgmt.web.v2019_08_01.aio.operations_async.StaticSitesOperations + :vartype static_sites: azure.mgmt.web.v2019_08_01.aio.operations.StaticSitesOperations :ivar app_service_environments: AppServiceEnvironmentsOperations operations - :vartype app_service_environments: azure.mgmt.web.v2019_08_01.aio.operations_async.AppServiceEnvironmentsOperations + :vartype app_service_environments: azure.mgmt.web.v2019_08_01.aio.operations.AppServiceEnvironmentsOperations :ivar app_service_plans: AppServicePlansOperations operations - :vartype app_service_plans: azure.mgmt.web.v2019_08_01.aio.operations_async.AppServicePlansOperations + :vartype app_service_plans: azure.mgmt.web.v2019_08_01.aio.operations.AppServicePlansOperations :ivar resource_health_metadata: ResourceHealthMetadataOperations operations - :vartype resource_health_metadata: azure.mgmt.web.v2019_08_01.aio.operations_async.ResourceHealthMetadataOperations + :vartype resource_health_metadata: azure.mgmt.web.v2019_08_01.aio.operations.ResourceHealthMetadataOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). @@ -90,6 +90,7 @@ def __init__( 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.app_service_certificate_orders = AppServiceCertificateOrdersOperations( diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/__init__.py new file mode 100644 index 000000000000..8f414125deed --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/__init__.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_service_certificate_orders_operations import AppServiceCertificateOrdersOperations +from ._certificate_registration_provider_operations import CertificateRegistrationProviderOperations +from ._domains_operations import DomainsOperations +from ._top_level_domains_operations import TopLevelDomainsOperations +from ._domain_registration_provider_operations import DomainRegistrationProviderOperations +from ._certificates_operations import CertificatesOperations +from ._deleted_web_apps_operations import DeletedWebAppsOperations +from ._diagnostics_operations import DiagnosticsOperations +from ._provider_operations import ProviderOperations +from ._recommendations_operations import RecommendationsOperations +from ._web_site_management_client_operations import WebSiteManagementClientOperationsMixin +from ._web_apps_operations import WebAppsOperations +from ._static_sites_operations import StaticSitesOperations +from ._app_service_environments_operations import AppServiceEnvironmentsOperations +from ._app_service_plans_operations import AppServicePlansOperations +from ._resource_health_metadata_operations import ResourceHealthMetadataOperations + +__all__ = [ + 'AppServiceCertificateOrdersOperations', + 'CertificateRegistrationProviderOperations', + 'DomainsOperations', + 'TopLevelDomainsOperations', + 'DomainRegistrationProviderOperations', + 'CertificatesOperations', + 'DeletedWebAppsOperations', + 'DiagnosticsOperations', + 'ProviderOperations', + 'RecommendationsOperations', + 'WebSiteManagementClientOperationsMixin', + 'WebAppsOperations', + 'StaticSitesOperations', + 'AppServiceEnvironmentsOperations', + 'AppServicePlansOperations', + 'ResourceHealthMetadataOperations', +] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py index fb71809824fc..9863766b854f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_certificate_orders_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -126,10 +129,13 @@ async def validate_purchase_information( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate_purchase_information.metadata['url'] # type: ignore @@ -145,12 +151,12 @@ async def validate_purchase_information( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", 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_service_certificate_order, 'AppServiceCertificateOrder') 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 @@ -181,14 +187,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -254,9 +263,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -273,7 +285,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -300,10 +312,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServiceCertificateOrder": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -321,13 +336,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') 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 @@ -435,9 +449,12 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -454,6 +471,7 @@ async def delete( # 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) @@ -492,10 +510,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -513,13 +534,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') 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 @@ -560,14 +580,17 @@ def list_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -637,9 +660,12 @@ async def get_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_certificate.metadata['url'] # type: ignore @@ -657,7 +683,7 @@ async def get_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -685,10 +711,13 @@ async def _create_or_update_certificate_initial( **kwargs ) -> "models.AppServiceCertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore @@ -707,13 +736,12 @@ async def _create_or_update_certificate_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') 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 @@ -828,9 +856,12 @@ async def delete_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_certificate.metadata['url'] # type: ignore @@ -848,6 +879,7 @@ async def delete_certificate( # 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) @@ -889,10 +921,13 @@ async def update_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_certificate.metadata['url'] # type: ignore @@ -911,13 +946,12 @@ async def update_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') 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 @@ -961,10 +995,13 @@ async def reissue( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.reissue.metadata['url'] # type: ignore @@ -982,12 +1019,12 @@ async def reissue( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') 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 @@ -1024,10 +1061,13 @@ async def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.renew.metadata['url'] # type: ignore @@ -1045,12 +1085,12 @@ async def renew( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') 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 @@ -1084,9 +1124,12 @@ async def resend_email( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.resend_email.metadata['url'] # type: ignore @@ -1103,6 +1146,7 @@ async def resend_email( # 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) @@ -1141,10 +1185,13 @@ async def resend_request_emails( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.resend_request_emails.metadata['url'] # type: ignore @@ -1162,12 +1209,12 @@ async def resend_request_emails( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(name_identifier, 'NameIdentifier') 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 @@ -1204,10 +1251,13 @@ async def retrieve_site_seal( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.retrieve_site_seal.metadata['url'] # type: ignore @@ -1225,13 +1275,12 @@ async def retrieve_site_seal( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') 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 @@ -1268,9 +1317,12 @@ async def verify_domain_ownership( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.verify_domain_ownership.metadata['url'] # type: ignore @@ -1287,6 +1339,7 @@ async def verify_domain_ownership( # 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) @@ -1322,9 +1375,12 @@ async def retrieve_certificate_actions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_actions.metadata['url'] # type: ignore @@ -1341,7 +1397,7 @@ async def retrieve_certificate_actions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1380,9 +1436,12 @@ async def retrieve_certificate_email_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore @@ -1399,7 +1458,7 @@ async def retrieve_certificate_email_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py index 7035f240c3d0..7428624dceab 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_environments_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -126,14 +129,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -199,9 +205,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -218,7 +227,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -245,10 +254,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServiceEnvironmentResource": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -266,13 +278,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') 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 @@ -371,9 +382,12 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -392,6 +406,7 @@ async def _delete_initial( # 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) @@ -495,10 +510,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -516,13 +534,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') 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 @@ -566,14 +583,17 @@ def list_capacities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -640,9 +660,12 @@ async def get_vip_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vip_info.metadata['url'] # type: ignore @@ -659,7 +682,7 @@ async def get_vip_info( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -686,10 +709,13 @@ async def _change_vnet_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._change_vnet_initial.metadata['url'] # type: ignore @@ -707,13 +733,12 @@ async def _change_vnet_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') 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 @@ -762,16 +787,19 @@ async def begin_change_vnet( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -790,7 +818,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -798,7 +825,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -883,9 +909,12 @@ async def list_diagnostics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_diagnostics.metadata['url'] # type: ignore @@ -902,7 +931,7 @@ async def list_diagnostics( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -944,9 +973,12 @@ async def get_diagnostics_item( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostics_item.metadata['url'] # type: ignore @@ -964,7 +996,7 @@ async def get_diagnostics_item( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1004,14 +1036,17 @@ def get_inbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1078,14 +1113,17 @@ def list_multi_role_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1152,9 +1190,12 @@ async def get_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_multi_role_pool.metadata['url'] # type: ignore @@ -1171,7 +1212,7 @@ async def get_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1198,10 +1239,13 @@ async def _create_or_update_multi_role_pool_initial( **kwargs ) -> "models.WorkerPoolResource": cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore @@ -1219,13 +1263,12 @@ async def _create_or_update_multi_role_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1336,10 +1379,13 @@ async def update_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_multi_role_pool.metadata['url'] # type: ignore @@ -1357,13 +1403,12 @@ async def update_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1408,14 +1453,17 @@ def list_multi_role_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1483,14 +1531,17 @@ def list_multi_role_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1557,14 +1608,17 @@ def list_multi_role_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1631,14 +1685,17 @@ def list_multi_role_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1705,9 +1762,12 @@ async def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -1724,7 +1784,7 @@ async def list_operations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1764,14 +1824,17 @@ def get_outbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1838,9 +1901,12 @@ async def reboot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reboot.metadata['url'] # type: ignore @@ -1857,6 +1923,7 @@ async def reboot( # 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) @@ -1879,9 +1946,12 @@ async def _resume_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._resume_initial.metadata['url'] # type: ignore @@ -1898,7 +1968,7 @@ async def _resume_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1946,14 +2016,17 @@ async def begin_resume( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2056,14 +2129,17 @@ def list_app_service_plans( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2133,14 +2209,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2196,9 +2275,12 @@ async def _suspend_initial( **kwargs ) -> "models.WebAppCollection": cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._suspend_initial.metadata['url'] # type: ignore @@ -2215,7 +2297,7 @@ async def _suspend_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2263,14 +2345,17 @@ async def begin_suspend( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2379,14 +2464,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2455,14 +2543,17 @@ def list_worker_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2532,9 +2623,12 @@ async def get_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_worker_pool.metadata['url'] # type: ignore @@ -2552,7 +2646,7 @@ async def get_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2580,10 +2674,13 @@ async def _create_or_update_worker_pool_initial( **kwargs ) -> "models.WorkerPoolResource": cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore @@ -2602,13 +2699,12 @@ async def _create_or_update_worker_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2726,10 +2822,13 @@ async def update_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_worker_pool.metadata['url'] # type: ignore @@ -2748,13 +2847,12 @@ async def update_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2802,14 +2900,17 @@ def list_worker_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2881,14 +2982,17 @@ def list_web_worker_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2959,14 +3063,17 @@ def list_worker_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3037,14 +3144,17 @@ def list_web_worker_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py index f7bf2e477dcb..a11456ac78d6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_app_service_plans_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -133,14 +136,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,9 +212,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -225,7 +234,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -254,10 +263,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.AppServicePlan": cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -275,13 +287,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') 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 @@ -389,9 +400,12 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -408,6 +422,7 @@ async def delete( # 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) @@ -446,10 +461,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -467,13 +485,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') 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 @@ -514,9 +531,12 @@ async def list_capabilities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_capabilities.metadata['url'] # type: ignore @@ -533,7 +553,7 @@ async def list_capabilities( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -578,9 +598,12 @@ async def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -599,7 +622,7 @@ async def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -644,9 +667,12 @@ async def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_hybrid_connection.metadata['url'] # type: ignore @@ -665,6 +691,7 @@ async def delete_hybrid_connection( # 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) @@ -706,9 +733,12 @@ async def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -727,7 +757,7 @@ async def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -772,14 +802,17 @@ def list_web_apps_by_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -848,9 +881,12 @@ async def get_hybrid_connection_plan_limit( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore @@ -867,7 +903,7 @@ async def get_hybrid_connection_plan_limit( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -906,14 +942,17 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -985,9 +1024,12 @@ async def restart_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.restart_web_apps.metadata['url'] # type: ignore @@ -1006,6 +1048,7 @@ async def restart_web_apps( # 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) @@ -1053,14 +1096,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1133,9 +1179,12 @@ async def get_server_farm_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_server_farm_skus.metadata['url'] # type: ignore @@ -1152,7 +1201,7 @@ async def get_server_farm_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1195,14 +1244,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1271,9 +1323,12 @@ async def list_vnets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_vnets.metadata['url'] # type: ignore @@ -1290,7 +1345,7 @@ async def list_vnets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1332,9 +1387,12 @@ async def get_vnet_from_server_farm( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore @@ -1352,7 +1410,7 @@ async def get_vnet_from_server_farm( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1399,9 +1457,12 @@ async def get_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_gateway.metadata['url'] # type: ignore @@ -1420,7 +1481,7 @@ async def get_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1468,10 +1529,13 @@ async def update_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_gateway.metadata['url'] # type: ignore @@ -1491,13 +1555,12 @@ async def update_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -1538,9 +1601,12 @@ async def list_routes_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_routes_for_vnet.metadata['url'] # type: ignore @@ -1558,7 +1624,7 @@ async def list_routes_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1603,9 +1669,12 @@ async def get_route_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_route_for_vnet.metadata['url'] # type: ignore @@ -1624,7 +1693,7 @@ async def get_route_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1674,10 +1743,13 @@ async def create_or_update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_route.metadata['url'] # type: ignore @@ -1697,13 +1769,12 @@ async def create_or_update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1748,9 +1819,12 @@ async def delete_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_vnet_route.metadata['url'] # type: ignore @@ -1769,6 +1843,7 @@ async def delete_vnet_route( # 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) @@ -1813,10 +1888,13 @@ async def update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_route.metadata['url'] # type: ignore @@ -1836,13 +1914,12 @@ async def update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1884,9 +1961,12 @@ async def reboot_worker( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reboot_worker.metadata['url'] # type: ignore @@ -1904,6 +1984,7 @@ async def reboot_worker( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py index a2630a2addbb..bf565827d14a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificate_registration_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -56,14 +56,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py index 7c4b86ec7a3a..c257d116228a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_certificates_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -258,10 +267,13 @@ async def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -279,13 +291,12 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -322,9 +333,12 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -341,6 +355,7 @@ async def delete( # 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) @@ -379,10 +394,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -400,13 +418,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py index 79f534337ead..ec53f7cb54f3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_deleted_web_apps_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def list_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get_deleted_web_app_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get_deleted_web_app_by_location( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py index 95bc752dc353..b9238d11cd66 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_diagnostics_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py @@ -10,7 +10,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -62,14 +62,17 @@ def list_hosting_environment_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -148,9 +151,12 @@ async def get_hosting_environment_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore @@ -174,7 +180,7 @@ async def get_hosting_environment_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -213,14 +219,17 @@ def list_site_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -299,9 +308,12 @@ async def get_site_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response.metadata['url'] # type: ignore @@ -325,7 +337,7 @@ async def get_site_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -364,14 +376,17 @@ def list_site_diagnostic_categories( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -441,9 +456,12 @@ async def get_site_diagnostic_category( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category.metadata['url'] # type: ignore @@ -461,7 +479,7 @@ async def get_site_diagnostic_category( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -503,14 +521,17 @@ def list_site_analyses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -584,9 +605,12 @@ async def get_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_analysis.metadata['url'] # type: ignore @@ -605,7 +629,7 @@ async def get_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -659,9 +683,12 @@ async def execute_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis.metadata['url'] # type: ignore @@ -686,7 +713,7 @@ async def execute_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -728,14 +755,17 @@ def list_site_detectors( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -809,9 +839,12 @@ async def get_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector.metadata['url'] # type: ignore @@ -830,7 +863,7 @@ async def get_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -884,9 +917,12 @@ async def execute_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_detector.metadata['url'] # type: ignore @@ -911,7 +947,7 @@ async def execute_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -953,14 +989,17 @@ def list_site_detector_responses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1043,9 +1082,12 @@ async def get_site_detector_response_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response_slot.metadata['url'] # type: ignore @@ -1070,7 +1112,7 @@ async def get_site_detector_response_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1112,14 +1154,17 @@ def list_site_diagnostic_categories_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1193,9 +1238,12 @@ async def get_site_diagnostic_category_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore @@ -1214,7 +1262,7 @@ async def get_site_diagnostic_category_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1259,14 +1307,17 @@ def list_site_analyses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1344,9 +1395,12 @@ async def get_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_analysis_slot.metadata['url'] # type: ignore @@ -1366,7 +1420,7 @@ async def get_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1423,9 +1477,12 @@ async def execute_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis_slot.metadata['url'] # type: ignore @@ -1451,7 +1508,7 @@ async def execute_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1496,14 +1553,17 @@ def list_site_detectors_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1581,9 +1641,12 @@ async def get_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector_slot.metadata['url'] # type: ignore @@ -1603,7 +1666,7 @@ async def get_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1660,9 +1723,12 @@ async def execute_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_detector_slot.metadata['url'] # type: ignore @@ -1688,7 +1754,7 @@ async def execute_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py index 44b01ffe35f5..0fce19ff293c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domain_registration_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -56,14 +56,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py index 453197e3ddac..13348757fb92 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_domains_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -60,10 +60,13 @@ async def check_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailabilityCheckResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_availability.metadata['url'] # type: ignore @@ -79,13 +82,12 @@ async def check_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') 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 @@ -116,14 +118,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -182,9 +187,12 @@ async def get_control_center_sso_request( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_control_center_sso_request.metadata['url'] # type: ignore @@ -199,7 +207,7 @@ async def get_control_center_sso_request( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -235,16 +243,19 @@ def list_recommendations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -261,7 +272,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -269,7 +279,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -314,14 +323,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -387,9 +399,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -406,7 +421,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -433,10 +448,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Domain": cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -454,13 +472,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') 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 @@ -572,9 +589,12 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -593,6 +613,7 @@ async def delete( # 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) @@ -631,10 +652,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -652,13 +676,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') 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 @@ -699,14 +722,17 @@ def list_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -776,9 +802,12 @@ async def get_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ownership_identifier.metadata['url'] # type: ignore @@ -796,7 +825,7 @@ async def get_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -842,10 +871,13 @@ async def create_or_update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore @@ -864,13 +896,12 @@ async def create_or_update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -910,9 +941,12 @@ async def delete_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_ownership_identifier.metadata['url'] # type: ignore @@ -930,6 +964,7 @@ async def delete_ownership_identifier( # 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) @@ -972,10 +1007,13 @@ async def update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ownership_identifier.metadata['url'] # type: ignore @@ -994,13 +1032,12 @@ async def update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -1037,9 +1074,12 @@ async def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.renew.metadata['url'] # type: ignore @@ -1056,6 +1096,7 @@ async def renew( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py index f4b2a8fddb21..2f0864fa7ff3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_provider_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -58,14 +58,17 @@ def get_available_stacks( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -123,14 +126,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -188,14 +194,17 @@ def get_available_stacks_on_prem( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py index 30ce944fed3d..c73b80e71ae8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_recommendations_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -64,14 +64,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -134,9 +137,12 @@ async def reset_all_filters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_all_filters.metadata['url'] # type: ignore @@ -151,6 +157,7 @@ async def reset_all_filters( # 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) @@ -184,9 +191,12 @@ async def disable_recommendation_for_subscription( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore @@ -202,6 +212,7 @@ async def disable_recommendation_for_subscription( # 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) @@ -246,14 +257,17 @@ def list_history_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -332,14 +346,17 @@ def list_recommended_rules_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -413,9 +430,12 @@ async def disable_all_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_all_for_hosting_environment.metadata['url'] # type: ignore @@ -433,6 +453,7 @@ async def disable_all_for_hosting_environment( # 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) @@ -471,9 +492,12 @@ async def reset_all_filters_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_all_filters_for_hosting_environment.metadata['url'] # type: ignore @@ -491,6 +515,7 @@ async def reset_all_filters_for_hosting_environment( # 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) @@ -537,9 +562,12 @@ async def get_rule_details_by_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore @@ -561,7 +589,7 @@ async def get_rule_details_by_hosting_environment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -606,9 +634,12 @@ async def disable_recommendation_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_recommendation_for_hosting_environment.metadata['url'] # type: ignore @@ -627,6 +658,7 @@ async def disable_recommendation_for_hosting_environment( # 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) @@ -671,14 +703,17 @@ def list_history_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -757,14 +792,17 @@ def list_recommended_rules_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -835,9 +873,12 @@ async def disable_all_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_all_for_web_app.metadata['url'] # type: ignore @@ -854,6 +895,7 @@ async def disable_all_for_web_app( # 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) @@ -889,9 +931,12 @@ async def reset_all_filters_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore @@ -908,6 +953,7 @@ async def reset_all_filters_for_web_app( # 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) @@ -954,9 +1000,12 @@ async def get_rule_details_by_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore @@ -978,7 +1027,7 @@ async def get_rule_details_by_web_app( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1020,9 +1069,12 @@ async def disable_recommendation_for_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_recommendation_for_site.metadata['url'] # type: ignore @@ -1040,6 +1092,7 @@ async def disable_recommendation_for_site( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py index 18c1fa7a6b5c..a32147c7e94b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_resource_health_metadata_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -125,14 +128,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -199,14 +205,17 @@ def list_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -273,9 +282,12 @@ async def get_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_by_site.metadata['url'] # type: ignore @@ -292,7 +304,7 @@ async def get_by_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -335,14 +347,17 @@ def list_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -413,9 +428,12 @@ async def get_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_by_site_slot.metadata['url'] # type: ignore @@ -433,7 +451,7 @@ async def get_by_site_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py index dd01139c5fbe..b245b8e238a2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_static_sites_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,14 +127,17 @@ def get_static_sites_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -197,9 +203,12 @@ async def get_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_static_site.metadata['url'] # type: ignore @@ -216,7 +225,7 @@ async def get_static_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -259,10 +268,13 @@ async def create_or_update_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_static_site.metadata['url'] # type: ignore @@ -280,13 +292,12 @@ async def create_or_update_static_site( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_envelope, 'StaticSiteARMResource') 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 @@ -327,9 +338,12 @@ async def delete_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site.metadata['url'] # type: ignore @@ -346,6 +360,7 @@ async def delete_static_site( # 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) @@ -385,10 +400,13 @@ async def update_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_static_site.metadata['url'] # type: ignore @@ -406,13 +424,12 @@ async def update_static_site( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_envelope, 'StaticSitePatchResource') 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 @@ -456,14 +473,17 @@ def list_static_site_users( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -537,9 +557,12 @@ async def delete_static_site_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site_user.metadata['url'] # type: ignore @@ -558,6 +581,7 @@ async def delete_static_site_user( # 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) @@ -603,10 +627,13 @@ async def update_static_site_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_static_site_user.metadata['url'] # type: ignore @@ -626,13 +653,12 @@ async def update_static_site_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_user_envelope, 'StaticSiteUserARMResource') 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 @@ -669,14 +695,17 @@ def get_static_site_builds( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -746,9 +775,12 @@ async def get_static_site_build( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_static_site_build.metadata['url'] # type: ignore @@ -766,7 +798,7 @@ async def get_static_site_build( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -808,9 +840,12 @@ async def delete_static_site_build( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site_build.metadata['url'] # type: ignore @@ -828,6 +863,7 @@ async def delete_static_site_build( # 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) @@ -869,10 +905,13 @@ async def create_or_update_static_site_build_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_static_site_build_function_app_settings.metadata['url'] # type: ignore @@ -891,13 +930,12 @@ async def create_or_update_static_site_build_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -941,14 +979,17 @@ def list_static_site_build_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1019,9 +1060,12 @@ async def list_static_site_build_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_static_site_build_function_app_settings.metadata['url'] # type: ignore @@ -1039,7 +1083,7 @@ async def list_static_site_build_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1085,10 +1129,13 @@ async def create_or_update_static_site_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_static_site_function_app_settings.metadata['url'] # type: ignore @@ -1106,13 +1153,12 @@ async def create_or_update_static_site_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1156,10 +1202,13 @@ async def create_user_roles_invitation_link( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserInvitationResponseResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_user_roles_invitation_link.metadata['url'] # type: ignore @@ -1177,13 +1226,12 @@ async def create_user_roles_invitation_link( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_user_roles_invitation_envelope, 'StaticSiteUserInvitationRequestResource') 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 @@ -1220,14 +1268,17 @@ def list_static_site_custom_domains( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1298,9 +1349,12 @@ async def create_or_update_static_site_custom_domain( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.create_or_update_static_site_custom_domain.metadata['url'] # type: ignore @@ -1318,7 +1372,7 @@ async def create_or_update_static_site_custom_domain( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -1364,9 +1418,12 @@ async def delete_static_site_custom_domain( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site_custom_domain.metadata['url'] # type: ignore @@ -1384,6 +1441,7 @@ async def delete_static_site_custom_domain( # 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) @@ -1422,9 +1480,12 @@ async def validate_custom_domain_can_be_added_to_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.validate_custom_domain_can_be_added_to_static_site.metadata['url'] # type: ignore @@ -1442,6 +1503,7 @@ async def validate_custom_domain_can_be_added_to_static_site( # 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) @@ -1477,9 +1539,12 @@ async def detach_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.detach_static_site.metadata['url'] # type: ignore @@ -1496,6 +1561,7 @@ async def detach_static_site( # 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) @@ -1531,14 +1597,17 @@ def list_static_site_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1605,9 +1674,12 @@ async def list_static_site_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_static_site_function_app_settings.metadata['url'] # type: ignore @@ -1624,7 +1696,7 @@ async def list_static_site_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1667,9 +1739,12 @@ async def list_static_site_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_static_site_secrets.metadata['url'] # type: ignore @@ -1686,7 +1761,7 @@ async def list_static_site_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1728,10 +1803,13 @@ async def reset_static_site_api_key( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.reset_static_site_api_key.metadata['url'] # type: ignore @@ -1749,12 +1827,12 @@ async def reset_static_site_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reset_properties_envelope, 'StaticSiteResetPropertiesARMResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py similarity index 92% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py index 4fd66a015cb0..adad11ae3114 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_top_level_domains_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -124,9 +127,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -142,7 +148,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -181,16 +187,19 @@ def list_agreements( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -208,7 +217,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -216,7 +224,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py similarity index 93% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py index 0d6329ebb2b1..90d63057efec 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_apps_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -57,14 +57,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -205,9 +211,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -224,7 +233,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -253,10 +262,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Site": cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -274,13 +286,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -397,9 +408,12 @@ async def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -420,6 +434,7 @@ async def delete( # 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) @@ -460,10 +475,13 @@ async def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -481,13 +499,12 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -531,9 +548,12 @@ async def analyze_custom_hostname( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname.metadata['url'] # type: ignore @@ -552,7 +572,7 @@ async def analyze_custom_hostname( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -594,10 +614,13 @@ async def apply_slot_config_to_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.apply_slot_config_to_production.metadata['url'] # type: ignore @@ -615,12 +638,12 @@ async def apply_slot_config_to_production( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -658,10 +681,13 @@ async def backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup.metadata['url'] # type: ignore @@ -679,13 +705,12 @@ async def backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -722,14 +747,17 @@ def list_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -799,9 +827,12 @@ async def get_backup_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status.metadata['url'] # type: ignore @@ -819,7 +850,7 @@ async def get_backup_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -861,9 +892,12 @@ async def delete_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup.metadata['url'] # type: ignore @@ -881,6 +915,7 @@ async def delete_backup( # 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) @@ -924,10 +959,13 @@ async def list_backup_status_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets.metadata['url'] # type: ignore @@ -946,13 +984,12 @@ async def list_backup_status_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -978,10 +1015,13 @@ async def _restore_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_initial.metadata['url'] # type: ignore @@ -1000,12 +1040,12 @@ async def _restore_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -1108,9 +1148,12 @@ async def get_basic_publishing_credentials_policies( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_basic_publishing_credentials_policies.metadata['url'] # type: ignore @@ -1127,7 +1170,7 @@ async def get_basic_publishing_credentials_policies( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1166,9 +1209,12 @@ async def get_ftp_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ftp_allowed.metadata['url'] # type: ignore @@ -1185,7 +1231,7 @@ async def get_ftp_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1227,10 +1273,13 @@ async def update_ftp_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ftp_allowed.metadata['url'] # type: ignore @@ -1248,13 +1297,12 @@ async def update_ftp_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') 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 @@ -1291,9 +1339,12 @@ async def get_scm_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_scm_allowed.metadata['url'] # type: ignore @@ -1310,7 +1361,7 @@ async def get_scm_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1352,10 +1403,13 @@ async def update_scm_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_scm_allowed.metadata['url'] # type: ignore @@ -1373,13 +1427,12 @@ async def update_scm_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') 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 @@ -1416,14 +1469,17 @@ def list_configurations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1493,10 +1549,13 @@ async def update_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings.metadata['url'] # type: ignore @@ -1514,13 +1573,12 @@ async def update_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1557,9 +1615,12 @@ async def list_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings.metadata['url'] # type: ignore @@ -1576,7 +1637,7 @@ async def list_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1618,10 +1679,13 @@ async def update_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings.metadata['url'] # type: ignore @@ -1639,13 +1703,12 @@ async def update_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -1682,9 +1745,12 @@ async def get_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings.metadata['url'] # type: ignore @@ -1701,7 +1767,7 @@ async def get_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1743,10 +1809,13 @@ async def update_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts.metadata['url'] # type: ignore @@ -1764,13 +1833,12 @@ async def update_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -1807,9 +1875,12 @@ async def list_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts.metadata['url'] # type: ignore @@ -1826,7 +1897,7 @@ async def list_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1868,10 +1939,13 @@ async def update_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration.metadata['url'] # type: ignore @@ -1889,13 +1963,12 @@ async def update_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1932,9 +2005,12 @@ async def delete_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup_configuration.metadata['url'] # type: ignore @@ -1951,6 +2027,7 @@ async def delete_backup_configuration( # 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) @@ -1986,9 +2063,12 @@ async def get_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration.metadata['url'] # type: ignore @@ -2005,7 +2085,7 @@ async def get_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2044,9 +2124,12 @@ async def get_app_settings_key_vault_references( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_app_settings_key_vault_references.metadata['url'] # type: ignore @@ -2063,7 +2146,7 @@ async def get_app_settings_key_vault_references( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2105,9 +2188,12 @@ async def get_app_setting_key_vault_reference( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_app_setting_key_vault_reference.metadata['url'] # type: ignore @@ -2125,7 +2211,7 @@ async def get_app_setting_key_vault_reference( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2167,10 +2253,13 @@ async def update_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings.metadata['url'] # type: ignore @@ -2188,13 +2277,12 @@ async def update_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -2231,9 +2319,12 @@ async def list_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings.metadata['url'] # type: ignore @@ -2250,7 +2341,7 @@ async def list_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2289,9 +2380,12 @@ async def get_diagnostic_logs_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore @@ -2308,7 +2402,7 @@ async def get_diagnostic_logs_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2351,10 +2445,13 @@ async def update_diagnostic_logs_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore @@ -2372,13 +2469,12 @@ async def update_diagnostic_logs_config( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -2418,10 +2514,13 @@ async def update_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata.metadata['url'] # type: ignore @@ -2439,13 +2538,12 @@ async def update_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -2482,9 +2580,12 @@ async def list_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_metadata.metadata['url'] # type: ignore @@ -2501,7 +2602,7 @@ async def list_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2527,9 +2628,12 @@ async def _list_publishing_credentials_initial( **kwargs ) -> "models.User": cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore @@ -2546,7 +2650,7 @@ async def _list_publishing_credentials_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2651,10 +2755,13 @@ async def update_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings.metadata['url'] # type: ignore @@ -2672,13 +2779,12 @@ async def update_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -2715,9 +2821,12 @@ async def list_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings.metadata['url'] # type: ignore @@ -2734,7 +2843,7 @@ async def list_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2774,9 +2883,12 @@ async def list_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_slot_configuration_names.metadata['url'] # type: ignore @@ -2793,7 +2905,7 @@ async def list_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2836,10 +2948,13 @@ async def update_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot_configuration_names.metadata['url'] # type: ignore @@ -2857,13 +2972,12 @@ async def update_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') 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 @@ -2901,9 +3015,12 @@ async def get_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration.metadata['url'] # type: ignore @@ -2920,7 +3037,7 @@ async def get_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2962,10 +3079,13 @@ async def create_or_update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration.metadata['url'] # type: ignore @@ -2983,13 +3103,12 @@ async def create_or_update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -3029,10 +3148,13 @@ async def update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration.metadata['url'] # type: ignore @@ -3050,13 +3172,12 @@ async def update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -3094,14 +3215,17 @@ def list_configuration_snapshot_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3171,9 +3295,12 @@ async def get_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot.metadata['url'] # type: ignore @@ -3191,7 +3318,7 @@ async def get_configuration_snapshot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3233,9 +3360,12 @@ async def recover_site_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore @@ -3253,6 +3383,7 @@ async def recover_site_configuration_snapshot( # 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) @@ -3288,9 +3419,12 @@ async def get_web_site_container_logs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs.metadata['url'] # type: ignore @@ -3307,7 +3441,7 @@ async def get_web_site_container_logs( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -3347,9 +3481,12 @@ async def get_container_logs_zip( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip.metadata['url'] # type: ignore @@ -3366,7 +3503,7 @@ async def get_container_logs_zip( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -3406,14 +3543,17 @@ def list_continuous_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3483,9 +3623,12 @@ async def get_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job.metadata['url'] # type: ignore @@ -3503,7 +3646,7 @@ async def get_continuous_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3547,9 +3690,12 @@ async def delete_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_continuous_web_job.metadata['url'] # type: ignore @@ -3567,6 +3713,7 @@ async def delete_continuous_web_job( # 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) @@ -3605,9 +3752,12 @@ async def start_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_continuous_web_job.metadata['url'] # type: ignore @@ -3625,6 +3775,7 @@ async def start_continuous_web_job( # 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) @@ -3663,9 +3814,12 @@ async def stop_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_continuous_web_job.metadata['url'] # type: ignore @@ -3683,6 +3837,7 @@ async def stop_continuous_web_job( # 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) @@ -3718,14 +3873,17 @@ def list_deployments( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3795,9 +3953,12 @@ async def get_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_deployment.metadata['url'] # type: ignore @@ -3815,7 +3976,7 @@ async def get_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3860,10 +4021,13 @@ async def create_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment.metadata['url'] # type: ignore @@ -3882,13 +4046,12 @@ async def create_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -3928,9 +4091,12 @@ async def delete_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_deployment.metadata['url'] # type: ignore @@ -3948,6 +4114,7 @@ async def delete_deployment( # 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) @@ -3987,9 +4154,12 @@ async def list_deployment_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log.metadata['url'] # type: ignore @@ -4007,7 +4177,7 @@ async def list_deployment_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4051,10 +4221,13 @@ async def discover_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup.metadata['url'] # type: ignore @@ -4072,13 +4245,12 @@ async def discover_backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -4115,14 +4287,17 @@ def list_domain_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4192,9 +4367,12 @@ async def get_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4212,7 +4390,7 @@ async def get_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4258,10 +4436,13 @@ async def create_or_update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4280,13 +4461,12 @@ async def create_or_update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -4326,9 +4506,12 @@ async def delete_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4346,6 +4529,7 @@ async def delete_domain_ownership_identifier( # 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) @@ -4388,10 +4572,13 @@ async def update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4410,13 +4597,12 @@ async def update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -4453,9 +4639,12 @@ async def get_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status.metadata['url'] # type: ignore @@ -4472,7 +4661,7 @@ async def get_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4499,10 +4688,13 @@ async def _create_ms_deploy_operation_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -4520,13 +4712,12 @@ async def _create_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -4632,9 +4823,12 @@ async def get_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log.metadata['url'] # type: ignore @@ -4651,7 +4845,7 @@ async def get_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4692,14 +4886,17 @@ def list_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4766,9 +4963,12 @@ async def get_functions_admin_token( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token.metadata['url'] # type: ignore @@ -4785,7 +4985,7 @@ async def get_functions_admin_token( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4827,9 +5027,12 @@ async def get_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_function.metadata['url'] # type: ignore @@ -4847,7 +5050,7 @@ async def get_function( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4877,10 +5080,13 @@ async def _create_function_initial( **kwargs ) -> "models.FunctionEnvelope": cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_function_initial.metadata['url'] # type: ignore @@ -4899,13 +5105,12 @@ async def _create_function_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -5016,9 +5221,12 @@ async def delete_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_function.metadata['url'] # type: ignore @@ -5036,6 +5244,7 @@ async def delete_function( # 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) @@ -5080,10 +5289,13 @@ async def create_or_update_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret.metadata['url'] # type: ignore @@ -5103,13 +5315,12 @@ async def create_or_update_function_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -5156,9 +5367,12 @@ async def delete_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_function_secret.metadata['url'] # type: ignore @@ -5177,6 +5391,7 @@ async def delete_function_secret( # 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) @@ -5215,9 +5430,12 @@ async def list_function_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_keys.metadata['url'] # type: ignore @@ -5235,7 +5453,7 @@ async def list_function_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5277,9 +5495,12 @@ async def list_function_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets.metadata['url'] # type: ignore @@ -5297,7 +5518,7 @@ async def list_function_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5336,9 +5557,12 @@ async def list_host_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_host_keys.metadata['url'] # type: ignore @@ -5355,7 +5579,7 @@ async def list_host_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5394,9 +5618,12 @@ async def list_sync_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_status.metadata['url'] # type: ignore @@ -5413,6 +5640,7 @@ async def list_sync_status( # 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) @@ -5448,9 +5676,12 @@ async def sync_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_functions.metadata['url'] # type: ignore @@ -5467,6 +5698,7 @@ async def sync_functions( # 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) @@ -5511,10 +5743,13 @@ async def create_or_update_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret.metadata['url'] # type: ignore @@ -5534,13 +5769,12 @@ async def create_or_update_host_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -5587,9 +5821,12 @@ async def delete_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_secret.metadata['url'] # type: ignore @@ -5608,6 +5845,7 @@ async def delete_host_secret( # 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) @@ -5643,14 +5881,17 @@ def list_host_name_bindings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5720,9 +5961,12 @@ async def get_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding.metadata['url'] # type: ignore @@ -5740,7 +5984,7 @@ async def get_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5786,10 +6030,13 @@ async def create_or_update_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore @@ -5808,13 +6055,12 @@ async def create_or_update_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -5854,9 +6100,12 @@ async def delete_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_name_binding.metadata['url'] # type: ignore @@ -5874,6 +6123,7 @@ async def delete_host_name_binding( # 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) @@ -5915,9 +6165,12 @@ async def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -5936,7 +6189,7 @@ async def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5984,10 +6237,13 @@ async def create_or_update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore @@ -6007,13 +6263,12 @@ async def create_or_update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -6056,9 +6311,12 @@ async def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_hybrid_connection.metadata['url'] # type: ignore @@ -6077,6 +6335,7 @@ async def delete_hybrid_connection( # 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) @@ -6121,10 +6380,13 @@ async def update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection.metadata['url'] # type: ignore @@ -6144,13 +6406,12 @@ async def update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -6187,9 +6448,12 @@ async def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections.metadata['url'] # type: ignore @@ -6206,7 +6470,7 @@ async def list_hybrid_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6246,9 +6510,12 @@ async def list_relay_service_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections.metadata['url'] # type: ignore @@ -6265,7 +6532,7 @@ async def list_relay_service_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6307,9 +6574,12 @@ async def get_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection.metadata['url'] # type: ignore @@ -6327,7 +6597,7 @@ async def get_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6373,10 +6643,13 @@ async def create_or_update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore @@ -6395,13 +6668,12 @@ async def create_or_update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6441,9 +6713,12 @@ async def delete_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_relay_service_connection.metadata['url'] # type: ignore @@ -6461,6 +6736,7 @@ async def delete_relay_service_connection( # 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) @@ -6503,10 +6779,13 @@ async def update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection.metadata['url'] # type: ignore @@ -6525,13 +6804,12 @@ async def update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6568,14 +6846,17 @@ def list_instance_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6645,9 +6926,12 @@ async def get_instance_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_info.metadata['url'] # type: ignore @@ -6665,7 +6949,7 @@ async def get_instance_info( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6707,9 +6991,12 @@ async def get_instance_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore @@ -6727,7 +7014,7 @@ async def get_instance_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6755,10 +7042,13 @@ async def _create_instance_ms_deploy_operation_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -6777,13 +7067,12 @@ async def _create_instance_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -6896,9 +7185,12 @@ async def get_instance_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore @@ -6916,7 +7208,7 @@ async def get_instance_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6962,14 +7254,17 @@ def list_instance_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7045,9 +7340,12 @@ async def get_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process.metadata['url'] # type: ignore @@ -7066,7 +7364,7 @@ async def get_instance_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7115,9 +7413,12 @@ async def delete_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_instance_process.metadata['url'] # type: ignore @@ -7136,6 +7437,7 @@ async def delete_instance_process( # 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) @@ -7179,9 +7481,12 @@ async def get_instance_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump.metadata['url'] # type: ignore @@ -7200,7 +7505,7 @@ async def get_instance_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -7249,14 +7554,17 @@ def list_instance_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7336,9 +7644,12 @@ async def get_instance_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module.metadata['url'] # type: ignore @@ -7358,7 +7669,7 @@ async def get_instance_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7407,14 +7718,17 @@ def list_instance_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7483,9 +7797,12 @@ async def is_cloneable( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable.metadata['url'] # type: ignore @@ -7502,7 +7819,7 @@ async def is_cloneable( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7541,14 +7858,17 @@ def list_site_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7615,9 +7935,12 @@ async def list_sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers.metadata['url'] # type: ignore @@ -7634,7 +7957,7 @@ async def list_sync_function_triggers( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7662,10 +7985,13 @@ async def _migrate_storage_initial( **kwargs ) -> "models.StorageMigrationResponse": cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_storage_initial.metadata['url'] # type: ignore @@ -7684,13 +8010,12 @@ async def _migrate_storage_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') 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 @@ -7786,10 +8111,13 @@ async def _migrate_my_sql_initial( **kwargs ) -> "models.Operation": cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_my_sql_initial.metadata['url'] # type: ignore @@ -7807,13 +8135,12 @@ async def _migrate_my_sql_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') 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 @@ -7918,9 +8245,12 @@ async def get_migrate_my_sql_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore @@ -7937,7 +8267,7 @@ async def get_migrate_my_sql_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7976,9 +8306,12 @@ async def get_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -7995,7 +8328,7 @@ async def get_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8041,10 +8374,13 @@ async def create_or_update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -8062,13 +8398,12 @@ async def create_or_update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -8105,9 +8440,12 @@ async def delete_swift_virtual_network( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_swift_virtual_network.metadata['url'] # type: ignore @@ -8124,6 +8462,7 @@ async def delete_swift_virtual_network( # 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) @@ -8166,10 +8505,13 @@ async def update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -8187,13 +8529,12 @@ async def update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -8233,9 +8574,12 @@ async def list_network_features( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_network_features.metadata['url'] # type: ignore @@ -8253,7 +8597,7 @@ async def list_network_features( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8298,9 +8642,12 @@ async def get_network_trace_operation( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation.metadata['url'] # type: ignore @@ -8318,7 +8665,7 @@ async def get_network_trace_operation( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8370,9 +8717,12 @@ async def start_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace.metadata['url'] # type: ignore @@ -8395,7 +8745,7 @@ async def start_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8424,9 +8774,12 @@ async def _start_web_site_network_trace_operation_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore @@ -8449,7 +8802,7 @@ async def _start_web_site_network_trace_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8567,9 +8920,12 @@ async def stop_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace.metadata['url'] # type: ignore @@ -8586,6 +8942,7 @@ async def stop_web_site_network_trace( # 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) @@ -8625,9 +8982,12 @@ async def get_network_traces( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces.metadata['url'] # type: ignore @@ -8645,7 +9005,7 @@ async def get_network_traces( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8688,9 +9048,12 @@ async def get_network_trace_operation_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore @@ -8708,7 +9071,7 @@ async def get_network_trace_operation_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8755,9 +9118,12 @@ async def get_network_traces_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces_v2.metadata['url'] # type: ignore @@ -8775,7 +9141,7 @@ async def get_network_traces_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8815,9 +9181,12 @@ async def generate_new_site_publishing_password( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore @@ -8834,6 +9203,7 @@ async def generate_new_site_publishing_password( # 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) @@ -8874,14 +9244,17 @@ def list_perf_mon_counters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -8950,9 +9323,12 @@ async def get_site_php_error_log_flag( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore @@ -8969,7 +9345,7 @@ async def get_site_php_error_log_flag( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9008,9 +9384,12 @@ async def list_premier_add_ons( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons.metadata['url'] # type: ignore @@ -9027,7 +9406,7 @@ async def list_premier_add_ons( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9069,9 +9448,12 @@ async def get_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on.metadata['url'] # type: ignore @@ -9089,7 +9471,7 @@ async def get_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9134,10 +9516,13 @@ async def add_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on.metadata['url'] # type: ignore @@ -9156,13 +9541,12 @@ async def add_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -9202,9 +9586,12 @@ async def delete_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_premier_add_on.metadata['url'] # type: ignore @@ -9222,6 +9609,7 @@ async def delete_premier_add_on( # 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) @@ -9263,10 +9651,13 @@ async def update_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on.metadata['url'] # type: ignore @@ -9285,13 +9676,12 @@ async def update_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -9329,9 +9719,12 @@ async def get_private_access( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_access.metadata['url'] # type: ignore @@ -9348,7 +9741,7 @@ async def get_private_access( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9391,10 +9784,13 @@ async def put_private_access_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet.metadata['url'] # type: ignore @@ -9412,13 +9808,12 @@ async def put_private_access_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -9456,14 +9851,17 @@ def list_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9534,9 +9932,12 @@ async def get_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process.metadata['url'] # type: ignore @@ -9554,7 +9955,7 @@ async def get_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9599,9 +10000,12 @@ async def delete_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_process.metadata['url'] # type: ignore @@ -9619,6 +10023,7 @@ async def delete_process( # 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) @@ -9658,9 +10063,12 @@ async def get_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump.metadata['url'] # type: ignore @@ -9678,7 +10086,7 @@ async def get_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -9723,14 +10131,17 @@ def list_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9805,9 +10216,12 @@ async def get_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_module.metadata['url'] # type: ignore @@ -9826,7 +10240,7 @@ async def get_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9871,14 +10285,17 @@ def list_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9946,14 +10363,17 @@ def list_public_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10023,9 +10443,12 @@ async def get_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate.metadata['url'] # type: ignore @@ -10043,7 +10466,7 @@ async def get_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10089,10 +10512,13 @@ async def create_or_update_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate.metadata['url'] # type: ignore @@ -10111,13 +10537,12 @@ async def create_or_update_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -10157,9 +10582,12 @@ async def delete_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_public_certificate.metadata['url'] # type: ignore @@ -10177,6 +10605,7 @@ async def delete_public_certificate( # 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) @@ -10216,10 +10645,13 @@ async def list_publishing_profile_xml_with_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore @@ -10237,13 +10669,12 @@ async def list_publishing_profile_xml_with_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -10281,9 +10712,12 @@ async def reset_production_slot_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_production_slot_config.metadata['url'] # type: ignore @@ -10300,6 +10734,7 @@ async def reset_production_slot_config( # 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) @@ -10343,9 +10778,12 @@ async def restart( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.restart.metadata['url'] # type: ignore @@ -10366,6 +10804,7 @@ async def restart( # 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) @@ -10389,10 +10828,13 @@ async def _restore_from_backup_blob_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_backup_blob_initial.metadata['url'] # type: ignore @@ -10410,12 +10852,12 @@ async def _restore_from_backup_blob_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10501,10 +10943,13 @@ async def _restore_from_deleted_app_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_deleted_app_initial.metadata['url'] # type: ignore @@ -10522,12 +10967,12 @@ async def _restore_from_deleted_app_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -10613,10 +11058,13 @@ async def _restore_snapshot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_snapshot_initial.metadata['url'] # type: ignore @@ -10634,12 +11082,12 @@ async def _restore_snapshot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -10738,14 +11186,17 @@ def list_site_extensions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10815,9 +11266,12 @@ async def get_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension.metadata['url'] # type: ignore @@ -10835,7 +11289,7 @@ async def get_site_extension( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10864,9 +11318,12 @@ async def _install_site_extension_initial( **kwargs ) -> Optional["models.SiteExtensionInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_initial.metadata['url'] # type: ignore @@ -10884,7 +11341,7 @@ async def _install_site_extension_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -10998,9 +11455,12 @@ async def delete_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_site_extension.metadata['url'] # type: ignore @@ -11018,6 +11478,7 @@ async def delete_site_extension( # 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) @@ -11041,10 +11502,13 @@ async def _copy_production_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._copy_production_slot_initial.metadata['url'] # type: ignore @@ -11062,12 +11526,12 @@ async def _copy_production_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') 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 @@ -11166,14 +11630,17 @@ def list_slots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11243,9 +11710,12 @@ async def get_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_slot.metadata['url'] # type: ignore @@ -11263,7 +11733,7 @@ async def get_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11293,10 +11763,13 @@ async def _create_or_update_slot_initial( **kwargs ) -> "models.Site": cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_slot_initial.metadata['url'] # type: ignore @@ -11315,13 +11788,12 @@ async def _create_or_update_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -11448,9 +11920,12 @@ async def delete_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_slot.metadata['url'] # type: ignore @@ -11472,6 +11947,7 @@ async def delete_slot( # 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) @@ -11516,10 +11992,13 @@ async def update_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot.metadata['url'] # type: ignore @@ -11538,13 +12017,12 @@ async def update_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -11591,9 +12069,12 @@ async def analyze_custom_hostname_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore @@ -11613,7 +12094,7 @@ async def analyze_custom_hostname_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11659,10 +12140,13 @@ async def apply_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore @@ -11681,12 +12165,12 @@ async def apply_slot_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -11728,10 +12212,13 @@ async def backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup_slot.metadata['url'] # type: ignore @@ -11750,13 +12237,12 @@ async def backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -11797,14 +12283,17 @@ def list_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11879,9 +12368,12 @@ async def get_backup_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status_slot.metadata['url'] # type: ignore @@ -11900,7 +12392,7 @@ async def get_backup_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11946,9 +12438,12 @@ async def delete_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup_slot.metadata['url'] # type: ignore @@ -11967,6 +12462,7 @@ async def delete_backup_slot( # 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) @@ -12013,10 +12509,13 @@ async def list_backup_status_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore @@ -12036,13 +12535,12 @@ async def list_backup_status_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -12069,10 +12567,13 @@ async def _restore_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_slot_initial.metadata['url'] # type: ignore @@ -12092,12 +12593,12 @@ async def _restore_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -12208,14 +12709,17 @@ def list_configurations_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12290,10 +12794,13 @@ async def update_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings_slot.metadata['url'] # type: ignore @@ -12312,13 +12819,12 @@ async def update_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -12359,9 +12865,12 @@ async def list_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings_slot.metadata['url'] # type: ignore @@ -12379,7 +12888,7 @@ async def list_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12424,10 +12933,13 @@ async def update_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings_slot.metadata['url'] # type: ignore @@ -12446,13 +12958,12 @@ async def update_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -12493,9 +13004,12 @@ async def get_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings_slot.metadata['url'] # type: ignore @@ -12513,7 +13027,7 @@ async def get_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12559,10 +13073,13 @@ async def update_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12581,13 +13098,12 @@ async def update_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -12628,9 +13144,12 @@ async def list_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12648,7 +13167,7 @@ async def list_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12694,10 +13213,13 @@ async def update_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration_slot.metadata['url'] # type: ignore @@ -12716,13 +13238,12 @@ async def update_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -12763,9 +13284,12 @@ async def delete_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore @@ -12783,6 +13307,7 @@ async def delete_backup_configuration_slot( # 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) @@ -12822,9 +13347,12 @@ async def get_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration_slot.metadata['url'] # type: ignore @@ -12842,7 +13370,7 @@ async def get_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12888,10 +13416,13 @@ async def update_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings_slot.metadata['url'] # type: ignore @@ -12910,13 +13441,12 @@ async def update_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -12957,9 +13487,12 @@ async def list_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings_slot.metadata['url'] # type: ignore @@ -12977,7 +13510,7 @@ async def list_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13020,9 +13553,12 @@ async def get_diagnostic_logs_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore @@ -13040,7 +13576,7 @@ async def get_diagnostic_logs_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13087,10 +13623,13 @@ async def update_diagnostic_logs_config_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore @@ -13109,13 +13648,12 @@ async def update_diagnostic_logs_config_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -13159,10 +13697,13 @@ async def update_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata_slot.metadata['url'] # type: ignore @@ -13181,13 +13722,12 @@ async def update_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -13228,9 +13768,12 @@ async def list_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_metadata_slot.metadata['url'] # type: ignore @@ -13248,7 +13791,7 @@ async def list_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13275,9 +13818,12 @@ async def _list_publishing_credentials_slot_initial( **kwargs ) -> "models.User": cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore @@ -13295,7 +13841,7 @@ async def _list_publishing_credentials_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13408,10 +13954,13 @@ async def update_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings_slot.metadata['url'] # type: ignore @@ -13430,13 +13979,12 @@ async def update_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -13476,9 +14024,12 @@ async def list_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings_slot.metadata['url'] # type: ignore @@ -13496,7 +14047,7 @@ async def list_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13540,9 +14091,12 @@ async def get_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_slot.metadata['url'] # type: ignore @@ -13560,7 +14114,7 @@ async def get_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13606,10 +14160,13 @@ async def create_or_update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore @@ -13628,13 +14185,12 @@ async def create_or_update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13678,10 +14234,13 @@ async def update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration_slot.metadata['url'] # type: ignore @@ -13700,13 +14259,12 @@ async def update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13748,14 +14306,17 @@ def list_configuration_snapshot_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -13830,9 +14391,12 @@ async def get_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -13851,7 +14415,7 @@ async def get_configuration_snapshot_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13897,9 +14461,12 @@ async def recover_site_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -13918,6 +14485,7 @@ async def recover_site_configuration_snapshot_slot( # 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) @@ -13956,9 +14524,12 @@ async def get_web_site_container_logs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore @@ -13976,7 +14547,7 @@ async def get_web_site_container_logs_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -14019,9 +14590,12 @@ async def get_container_logs_zip_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore @@ -14039,7 +14613,7 @@ async def get_container_logs_zip_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -14083,14 +14657,17 @@ def list_continuous_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14165,9 +14742,12 @@ async def get_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14186,7 +14766,7 @@ async def get_continuous_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14234,9 +14814,12 @@ async def delete_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14255,6 +14838,7 @@ async def delete_continuous_web_job_slot( # 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) @@ -14297,9 +14881,12 @@ async def start_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14318,6 +14905,7 @@ async def start_continuous_web_job_slot( # 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) @@ -14360,9 +14948,12 @@ async def stop_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14381,6 +14972,7 @@ async def stop_continuous_web_job_slot( # 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) @@ -14420,14 +15012,17 @@ def list_deployments_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14502,9 +15097,12 @@ async def get_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_deployment_slot.metadata['url'] # type: ignore @@ -14523,7 +15121,7 @@ async def get_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14572,10 +15170,13 @@ async def create_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment_slot.metadata['url'] # type: ignore @@ -14595,13 +15196,12 @@ async def create_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -14645,9 +15245,12 @@ async def delete_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_deployment_slot.metadata['url'] # type: ignore @@ -14666,6 +15269,7 @@ async def delete_deployment_slot( # 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) @@ -14709,9 +15313,12 @@ async def list_deployment_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log_slot.metadata['url'] # type: ignore @@ -14730,7 +15337,7 @@ async def list_deployment_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14778,10 +15385,13 @@ async def discover_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup_slot.metadata['url'] # type: ignore @@ -14800,13 +15410,12 @@ async def discover_backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -14847,14 +15456,17 @@ def list_domain_ownership_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14929,9 +15541,12 @@ async def get_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -14950,7 +15565,7 @@ async def get_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15000,10 +15615,13 @@ async def create_or_update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15023,13 +15641,12 @@ async def create_or_update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -15073,9 +15690,12 @@ async def delete_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15094,6 +15714,7 @@ async def delete_domain_ownership_identifier_slot( # 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) @@ -15140,10 +15761,13 @@ async def update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15163,13 +15787,12 @@ async def update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -15209,9 +15832,12 @@ async def get_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -15229,7 +15855,7 @@ async def get_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15257,10 +15883,13 @@ async def _create_ms_deploy_operation_slot_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -15279,13 +15908,12 @@ async def _create_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -15398,9 +16026,12 @@ async def get_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -15418,7 +16049,7 @@ async def get_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15462,14 +16093,17 @@ def list_instance_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15540,9 +16174,12 @@ async def get_functions_admin_token_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore @@ -15560,7 +16197,7 @@ async def get_functions_admin_token_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15605,9 +16242,12 @@ async def get_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_function_slot.metadata['url'] # type: ignore @@ -15626,7 +16266,7 @@ async def get_instance_function_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15657,10 +16297,13 @@ async def _create_instance_function_slot_initial( **kwargs ) -> "models.FunctionEnvelope": cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore @@ -15680,13 +16323,12 @@ async def _create_instance_function_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -15804,9 +16446,12 @@ async def delete_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_instance_function_slot.metadata['url'] # type: ignore @@ -15825,6 +16470,7 @@ async def delete_instance_function_slot( # 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) @@ -15872,10 +16518,13 @@ async def create_or_update_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore @@ -15896,13 +16545,12 @@ async def create_or_update_function_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -15952,9 +16600,12 @@ async def delete_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_function_secret_slot.metadata['url'] # type: ignore @@ -15974,6 +16625,7 @@ async def delete_function_secret_slot( # 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) @@ -16015,9 +16667,12 @@ async def list_function_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_keys_slot.metadata['url'] # type: ignore @@ -16036,7 +16691,7 @@ async def list_function_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16081,9 +16736,12 @@ async def list_function_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets_slot.metadata['url'] # type: ignore @@ -16102,7 +16760,7 @@ async def list_function_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16144,9 +16802,12 @@ async def list_host_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_host_keys_slot.metadata['url'] # type: ignore @@ -16164,7 +16825,7 @@ async def list_host_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16206,9 +16867,12 @@ async def list_sync_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_status_slot.metadata['url'] # type: ignore @@ -16226,6 +16890,7 @@ async def list_sync_status_slot( # 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) @@ -16264,9 +16929,12 @@ async def sync_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_functions_slot.metadata['url'] # type: ignore @@ -16284,6 +16952,7 @@ async def sync_functions_slot( # 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) @@ -16331,10 +17000,13 @@ async def create_or_update_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore @@ -16355,13 +17027,12 @@ async def create_or_update_host_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -16411,9 +17082,12 @@ async def delete_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_secret_slot.metadata['url'] # type: ignore @@ -16433,6 +17107,7 @@ async def delete_host_secret_slot( # 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) @@ -16472,14 +17147,17 @@ def list_host_name_bindings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16554,9 +17232,12 @@ async def get_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding_slot.metadata['url'] # type: ignore @@ -16575,7 +17256,7 @@ async def get_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16625,10 +17306,13 @@ async def create_or_update_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore @@ -16648,13 +17332,12 @@ async def create_or_update_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -16698,9 +17381,12 @@ async def delete_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore @@ -16719,6 +17405,7 @@ async def delete_host_name_binding_slot( # 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) @@ -16763,9 +17450,12 @@ async def get_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16785,7 +17475,7 @@ async def get_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16836,10 +17526,13 @@ async def create_or_update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16860,13 +17553,12 @@ async def create_or_update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -16912,9 +17604,12 @@ async def delete_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore @@ -16934,6 +17629,7 @@ async def delete_hybrid_connection_slot( # 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) @@ -16981,10 +17677,13 @@ async def update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -17005,13 +17704,12 @@ async def update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -17051,9 +17749,12 @@ async def list_hybrid_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore @@ -17071,7 +17772,7 @@ async def list_hybrid_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17115,9 +17816,12 @@ async def list_relay_service_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore @@ -17135,7 +17839,7 @@ async def list_relay_service_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17181,9 +17885,12 @@ async def get_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17202,7 +17909,7 @@ async def get_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17252,10 +17959,13 @@ async def create_or_update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17275,13 +17985,12 @@ async def create_or_update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17325,9 +18034,12 @@ async def delete_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17346,6 +18058,7 @@ async def delete_relay_service_connection_slot( # 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) @@ -17392,10 +18105,13 @@ async def update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17415,13 +18131,12 @@ async def update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17462,14 +18177,17 @@ def list_instance_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17544,9 +18262,12 @@ async def get_instance_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_info_slot.metadata['url'] # type: ignore @@ -17565,7 +18286,7 @@ async def get_instance_info_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17610,9 +18331,12 @@ async def get_instance_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -17631,7 +18355,7 @@ async def get_instance_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17660,10 +18384,13 @@ async def _create_instance_ms_deploy_operation_slot_initial( **kwargs ) -> Optional["models.MSDeployStatus"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -17683,13 +18410,12 @@ async def _create_instance_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -17809,9 +18535,12 @@ async def get_instance_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -17830,7 +18559,7 @@ async def get_instance_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17880,14 +18609,17 @@ def list_instance_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17968,9 +18700,12 @@ async def get_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_slot.metadata['url'] # type: ignore @@ -17990,7 +18725,7 @@ async def get_instance_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18043,9 +18778,12 @@ async def delete_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_instance_process_slot.metadata['url'] # type: ignore @@ -18065,6 +18803,7 @@ async def delete_instance_process_slot( # 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) @@ -18112,9 +18851,12 @@ async def get_instance_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore @@ -18134,7 +18876,7 @@ async def get_instance_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -18187,14 +18929,17 @@ def list_instance_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18279,9 +19024,12 @@ async def get_instance_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module_slot.metadata['url'] # type: ignore @@ -18302,7 +19050,7 @@ async def get_instance_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18355,14 +19103,17 @@ def list_instance_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18436,9 +19187,12 @@ async def is_cloneable_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable_slot.metadata['url'] # type: ignore @@ -18456,7 +19210,7 @@ async def is_cloneable_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18499,14 +19253,17 @@ def list_site_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18577,9 +19334,12 @@ async def list_sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore @@ -18597,7 +19357,7 @@ async def list_sync_function_triggers_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18640,9 +19400,12 @@ async def get_migrate_my_sql_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore @@ -18660,7 +19423,7 @@ async def get_migrate_my_sql_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18703,9 +19466,12 @@ async def get_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18723,7 +19489,7 @@ async def get_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18773,10 +19539,13 @@ async def create_or_update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18795,13 +19564,12 @@ async def create_or_update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -18842,9 +19610,12 @@ async def delete_swift_virtual_network_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_swift_virtual_network_slot.metadata['url'] # type: ignore @@ -18862,6 +19633,7 @@ async def delete_swift_virtual_network_slot( # 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) @@ -18908,10 +19680,13 @@ async def update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -18930,13 +19705,12 @@ async def update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -18980,9 +19754,12 @@ async def list_network_features_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_network_features_slot.metadata['url'] # type: ignore @@ -19001,7 +19778,7 @@ async def list_network_features_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19050,9 +19827,12 @@ async def get_network_trace_operation_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore @@ -19071,7 +19851,7 @@ async def get_network_trace_operation_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19126,9 +19906,12 @@ async def start_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -19152,7 +19935,7 @@ async def start_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19182,9 +19965,12 @@ async def _start_web_site_network_trace_operation_slot_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore @@ -19208,7 +19994,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19333,9 +20119,12 @@ async def stop_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -19353,6 +20142,7 @@ async def stop_web_site_network_trace_slot( # 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) @@ -19396,9 +20186,12 @@ async def get_network_traces_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot.metadata['url'] # type: ignore @@ -19417,7 +20210,7 @@ async def get_network_traces_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19464,9 +20257,12 @@ async def get_network_trace_operation_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore @@ -19485,7 +20281,7 @@ async def get_network_trace_operation_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19536,9 +20332,12 @@ async def get_network_traces_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore @@ -19557,7 +20356,7 @@ async def get_network_traces_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19601,9 +20400,12 @@ async def generate_new_site_publishing_password_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore @@ -19621,6 +20423,7 @@ async def generate_new_site_publishing_password_slot( # 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) @@ -19664,14 +20467,17 @@ def list_perf_mon_counters_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -19744,9 +20550,12 @@ async def get_site_php_error_log_flag_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore @@ -19764,7 +20573,7 @@ async def get_site_php_error_log_flag_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19807,9 +20616,12 @@ async def list_premier_add_ons_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore @@ -19827,7 +20639,7 @@ async def list_premier_add_ons_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19873,9 +20685,12 @@ async def get_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on_slot.metadata['url'] # type: ignore @@ -19894,7 +20709,7 @@ async def get_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19943,10 +20758,13 @@ async def add_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on_slot.metadata['url'] # type: ignore @@ -19966,13 +20784,12 @@ async def add_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -20016,9 +20833,12 @@ async def delete_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore @@ -20037,6 +20857,7 @@ async def delete_premier_add_on_slot( # 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) @@ -20082,10 +20903,13 @@ async def update_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on_slot.metadata['url'] # type: ignore @@ -20105,13 +20929,12 @@ async def update_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -20152,9 +20975,12 @@ async def get_private_access_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_access_slot.metadata['url'] # type: ignore @@ -20172,7 +20998,7 @@ async def get_private_access_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20218,10 +21044,13 @@ async def put_private_access_vnet_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore @@ -20240,13 +21069,12 @@ async def put_private_access_vnet_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -20286,9 +21114,12 @@ async def get_private_endpoint_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_endpoint_connection.metadata['url'] # type: ignore @@ -20306,7 +21137,7 @@ async def get_private_endpoint_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20334,10 +21165,13 @@ async def _approve_or_reject_private_endpoint_connection_initial( **kwargs ) -> "models.PrivateEndpointConnectionResource": cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._approve_or_reject_private_endpoint_connection_initial.metadata['url'] # type: ignore @@ -20356,13 +21190,12 @@ async def _approve_or_reject_private_endpoint_connection_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(private_endpoint_wrapper, 'PrivateLinkConnectionApprovalRequestResource') 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 @@ -20462,9 +21295,12 @@ async def _delete_private_endpoint_connection_initial( **kwargs ) -> object: cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._delete_private_endpoint_connection_initial.metadata['url'] # type: ignore @@ -20482,7 +21318,7 @@ async def _delete_private_endpoint_connection_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20595,9 +21431,12 @@ async def get_private_link_resources( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesWrapper"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_link_resources.metadata['url'] # type: ignore @@ -20614,7 +21453,7 @@ async def get_private_link_resources( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20658,14 +21497,17 @@ def list_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20741,9 +21583,12 @@ async def get_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_slot.metadata['url'] # type: ignore @@ -20762,7 +21607,7 @@ async def get_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20811,9 +21656,12 @@ async def delete_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_process_slot.metadata['url'] # type: ignore @@ -20832,6 +21680,7 @@ async def delete_process_slot( # 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) @@ -20875,9 +21724,12 @@ async def get_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump_slot.metadata['url'] # type: ignore @@ -20896,7 +21748,7 @@ async def get_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -20945,14 +21797,17 @@ def list_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21032,9 +21887,12 @@ async def get_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_module_slot.metadata['url'] # type: ignore @@ -21054,7 +21912,7 @@ async def get_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21103,14 +21961,17 @@ def list_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21183,14 +22044,17 @@ def list_public_certificates_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21265,9 +22129,12 @@ async def get_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate_slot.metadata['url'] # type: ignore @@ -21286,7 +22153,7 @@ async def get_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21336,10 +22203,13 @@ async def create_or_update_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore @@ -21359,13 +22229,12 @@ async def create_or_update_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -21409,9 +22278,12 @@ async def delete_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_public_certificate_slot.metadata['url'] # type: ignore @@ -21430,6 +22302,7 @@ async def delete_public_certificate_slot( # 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) @@ -21473,10 +22346,13 @@ async def list_publishing_profile_xml_with_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore @@ -21495,13 +22371,12 @@ async def list_publishing_profile_xml_with_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -21543,9 +22418,12 @@ async def reset_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore @@ -21563,6 +22441,7 @@ async def reset_slot_configuration_slot( # 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) @@ -21610,9 +22489,12 @@ async def restart_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.restart_slot.metadata['url'] # type: ignore @@ -21634,6 +22516,7 @@ async def restart_slot( # 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) @@ -21658,10 +22541,13 @@ async def _restore_from_backup_blob_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_backup_blob_slot_initial.metadata['url'] # type: ignore @@ -21680,12 +22566,12 @@ async def _restore_from_backup_blob_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -21777,10 +22663,13 @@ async def _restore_from_deleted_app_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_deleted_app_slot_initial.metadata['url'] # type: ignore @@ -21799,12 +22688,12 @@ async def _restore_from_deleted_app_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -21895,10 +22784,13 @@ async def _restore_snapshot_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_snapshot_slot_initial.metadata['url'] # type: ignore @@ -21917,12 +22809,12 @@ async def _restore_snapshot_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -22029,14 +22921,17 @@ def list_site_extensions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22111,9 +23006,12 @@ async def get_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension_slot.metadata['url'] # type: ignore @@ -22132,7 +23030,7 @@ async def get_site_extension_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22162,9 +23060,12 @@ async def _install_site_extension_slot_initial( **kwargs ) -> Optional["models.SiteExtensionInfo"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore @@ -22183,7 +23084,7 @@ async def _install_site_extension_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -22306,9 +23207,12 @@ async def delete_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_site_extension_slot.metadata['url'] # type: ignore @@ -22327,6 +23231,7 @@ async def delete_site_extension_slot( # 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) @@ -22351,10 +23256,13 @@ async def _copy_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._copy_slot_initial.metadata['url'] # type: ignore @@ -22373,12 +23281,12 @@ async def _copy_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') 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 @@ -22489,16 +23397,19 @@ def list_slot_differences_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22518,7 +23429,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -22526,7 +23436,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -22563,10 +23472,13 @@ async def _swap_slot_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._swap_slot_initial.metadata['url'] # type: ignore @@ -22585,12 +23497,12 @@ async def _swap_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -22696,14 +23608,17 @@ def list_snapshots_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22774,14 +23689,17 @@ def list_snapshots_from_dr_secondary_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22853,9 +23771,12 @@ async def get_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_source_control_slot.metadata['url'] # type: ignore @@ -22873,7 +23794,7 @@ async def get_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22908,10 +23829,13 @@ async def _create_or_update_source_control_slot_initial( **kwargs ) -> "models.SiteSourceControl": cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore @@ -22930,13 +23854,12 @@ async def _create_or_update_source_control_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -23056,9 +23979,12 @@ async def delete_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_source_control_slot.metadata['url'] # type: ignore @@ -23076,6 +24002,7 @@ async def delete_source_control_slot( # 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) @@ -23118,10 +24045,13 @@ async def update_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control_slot.metadata['url'] # type: ignore @@ -23140,13 +24070,12 @@ async def update_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -23194,9 +24123,12 @@ async def start_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_slot.metadata['url'] # type: ignore @@ -23214,6 +24146,7 @@ async def start_slot( # 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) @@ -23240,9 +24173,12 @@ async def _start_network_trace_slot_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore @@ -23266,7 +24202,7 @@ async def _start_network_trace_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23392,9 +24328,12 @@ async def stop_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_slot.metadata['url'] # type: ignore @@ -23412,6 +24351,7 @@ async def stop_slot( # 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) @@ -23450,9 +24390,12 @@ async def stop_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_network_trace_slot.metadata['url'] # type: ignore @@ -23470,6 +24413,7 @@ async def stop_network_trace_slot( # 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) @@ -23508,9 +24452,12 @@ async def sync_repository_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_repository_slot.metadata['url'] # type: ignore @@ -23528,6 +24475,7 @@ async def sync_repository_slot( # 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) @@ -23566,9 +24514,12 @@ async def sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_function_triggers_slot.metadata['url'] # type: ignore @@ -23586,6 +24537,7 @@ async def sync_function_triggers_slot( # 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) @@ -23625,14 +24577,17 @@ def list_triggered_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23707,9 +24662,12 @@ async def get_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore @@ -23728,7 +24686,7 @@ async def get_triggered_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23776,9 +24734,12 @@ async def delete_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore @@ -23797,6 +24758,7 @@ async def delete_triggered_web_job_slot( # 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) @@ -23839,14 +24801,17 @@ def list_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23926,9 +24891,12 @@ async def get_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore @@ -23948,7 +24916,7 @@ async def get_triggered_web_job_history_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23996,9 +24964,12 @@ async def run_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore @@ -24017,6 +24988,7 @@ async def run_triggered_web_job_slot( # 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) @@ -24062,14 +25034,17 @@ def list_usages_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24143,9 +25118,12 @@ async def list_vnet_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections_slot.metadata['url'] # type: ignore @@ -24163,7 +25141,7 @@ async def list_vnet_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24209,9 +25187,12 @@ async def get_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_slot.metadata['url'] # type: ignore @@ -24230,7 +25211,7 @@ async def get_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24280,10 +25261,13 @@ async def create_or_update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore @@ -24303,13 +25287,12 @@ async def create_or_update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -24354,9 +25337,12 @@ async def delete_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore @@ -24375,6 +25361,7 @@ async def delete_vnet_connection_slot( # 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) @@ -24421,10 +25408,13 @@ async def update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_slot.metadata['url'] # type: ignore @@ -24444,13 +25434,12 @@ async def update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -24497,9 +25486,12 @@ async def get_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24519,7 +25511,7 @@ async def get_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24573,10 +25565,13 @@ async def create_or_update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24597,13 +25592,12 @@ async def create_or_update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -24653,10 +25647,13 @@ async def update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24677,13 +25674,12 @@ async def update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -24724,14 +25720,17 @@ def list_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24806,9 +25805,12 @@ async def get_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_web_job_slot.metadata['url'] # type: ignore @@ -24827,7 +25829,7 @@ async def get_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24869,16 +25871,19 @@ def list_slot_differences_from_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24897,7 +25902,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -24905,7 +25909,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -24941,10 +25944,13 @@ async def _swap_slot_with_production_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore @@ -24962,12 +25968,12 @@ async def _swap_slot_with_production_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -25065,14 +26071,17 @@ def list_snapshots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25139,14 +26148,17 @@ def list_snapshots_from_dr_secondary( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25213,9 +26225,12 @@ async def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -25232,7 +26247,7 @@ async def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25266,10 +26281,13 @@ async def _create_or_update_source_control_initial( **kwargs ) -> "models.SiteSourceControl": cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore @@ -25287,13 +26305,12 @@ async def _create_or_update_source_control_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -25404,9 +26421,12 @@ async def delete_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_source_control.metadata['url'] # type: ignore @@ -25423,6 +26443,7 @@ async def delete_source_control( # 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) @@ -25461,10 +26482,13 @@ async def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -25482,13 +26506,12 @@ async def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -25532,9 +26555,12 @@ async def start( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start.metadata['url'] # type: ignore @@ -25551,6 +26577,7 @@ async def start( # 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) @@ -25576,9 +26603,12 @@ async def _start_network_trace_initial( **kwargs ) -> List["models.NetworkTrace"]: cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_network_trace_initial.metadata['url'] # type: ignore @@ -25601,7 +26631,7 @@ async def _start_network_trace_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25719,9 +26749,12 @@ async def stop( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop.metadata['url'] # type: ignore @@ -25738,6 +26771,7 @@ async def stop( # 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) @@ -25773,9 +26807,12 @@ async def stop_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_network_trace.metadata['url'] # type: ignore @@ -25792,6 +26829,7 @@ async def stop_network_trace( # 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) @@ -25827,9 +26865,12 @@ async def sync_repository( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_repository.metadata['url'] # type: ignore @@ -25846,6 +26887,7 @@ async def sync_repository( # 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) @@ -25881,9 +26923,12 @@ async def sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_function_triggers.metadata['url'] # type: ignore @@ -25900,6 +26945,7 @@ async def sync_function_triggers( # 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) @@ -25935,14 +26981,17 @@ def list_triggered_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26012,9 +27061,12 @@ async def get_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job.metadata['url'] # type: ignore @@ -26032,7 +27084,7 @@ async def get_triggered_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26076,9 +27128,12 @@ async def delete_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_triggered_web_job.metadata['url'] # type: ignore @@ -26096,6 +27151,7 @@ async def delete_triggered_web_job( # 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) @@ -26134,14 +27190,17 @@ def list_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26216,9 +27275,12 @@ async def get_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history.metadata['url'] # type: ignore @@ -26237,7 +27299,7 @@ async def get_triggered_web_job_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26281,9 +27343,12 @@ async def run_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.run_triggered_web_job.metadata['url'] # type: ignore @@ -26301,6 +27366,7 @@ async def run_triggered_web_job( # 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) @@ -26342,14 +27408,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26418,9 +27487,12 @@ async def list_vnet_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections.metadata['url'] # type: ignore @@ -26437,7 +27509,7 @@ async def list_vnet_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26479,9 +27551,12 @@ async def get_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection.metadata['url'] # type: ignore @@ -26499,7 +27574,7 @@ async def get_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26545,10 +27620,13 @@ async def create_or_update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore @@ -26567,13 +27645,12 @@ async def create_or_update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -26614,9 +27691,12 @@ async def delete_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_vnet_connection.metadata['url'] # type: ignore @@ -26634,6 +27714,7 @@ async def delete_vnet_connection( # 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) @@ -26676,10 +27757,13 @@ async def update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection.metadata['url'] # type: ignore @@ -26698,13 +27782,12 @@ async def update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -26747,9 +27830,12 @@ async def get_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26768,7 +27854,7 @@ async def get_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26818,10 +27904,13 @@ async def create_or_update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26841,13 +27930,12 @@ async def create_or_update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -26893,10 +27981,13 @@ async def update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -26916,13 +28007,12 @@ async def update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -26959,14 +28049,17 @@ def list_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -27036,9 +28129,12 @@ async def get_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_web_job.metadata['url'] # type: ignore @@ -27056,7 +28152,7 @@ async def get_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py similarity index 91% rename from sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py rename to sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py index dab54cc131fc..0684240059ac 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/_web_site_management_client_operations_async.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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.mgmt.core.exceptions import ARMErrorFormat @@ -35,9 +35,12 @@ async def get_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_publishing_user.metadata['url'] # type: ignore @@ -48,7 +51,7 @@ async def get_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -84,10 +87,13 @@ async def update_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_publishing_user.metadata['url'] # type: ignore @@ -99,13 +105,12 @@ async def update_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') 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 @@ -136,14 +141,17 @@ def list_source_controls( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -201,9 +209,12 @@ async def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -218,7 +229,7 @@ async def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -257,10 +268,13 @@ async def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -276,13 +290,12 @@ async def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') 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 @@ -319,14 +332,17 @@ def list_billing_meters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -398,12 +414,15 @@ async def check_name_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_name_availability.metadata['url'] # type: ignore @@ -419,13 +438,12 @@ async def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') 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 @@ -456,9 +474,12 @@ async def get_subscription_deployment_locations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore @@ -473,7 +494,7 @@ async def get_subscription_deployment_locations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -521,14 +542,17 @@ def list_geo_regions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -598,16 +622,19 @@ def list_site_identifiers_assigned_to_host_name( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -624,7 +651,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -632,7 +658,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request async def extract_data(pipeline_response): @@ -674,14 +699,17 @@ def list_premier_add_on_offers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -740,9 +768,12 @@ async def list_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_skus.metadata['url'] # type: ignore @@ -757,7 +788,7 @@ async def list_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -794,10 +825,13 @@ async def verify_hosting_environment_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore @@ -813,13 +847,12 @@ async def verify_hosting_environment_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') 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 @@ -856,10 +889,13 @@ async def move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.move.metadata['url'] # type: ignore @@ -876,12 +912,12 @@ async def move( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 @@ -915,10 +951,13 @@ async def validate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate.metadata['url'] # type: ignore @@ -935,13 +974,12 @@ async def validate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') 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 @@ -978,10 +1016,13 @@ async def validate_move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate_move.metadata['url'] # type: ignore @@ -998,12 +1039,12 @@ async def validate_move( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py deleted file mode 100644 index 812a44e55525..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations_async/__init__.py +++ /dev/null @@ -1,43 +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_service_certificate_orders_operations_async import AppServiceCertificateOrdersOperations -from ._certificate_registration_provider_operations_async import CertificateRegistrationProviderOperations -from ._domains_operations_async import DomainsOperations -from ._top_level_domains_operations_async import TopLevelDomainsOperations -from ._domain_registration_provider_operations_async import DomainRegistrationProviderOperations -from ._certificates_operations_async import CertificatesOperations -from ._deleted_web_apps_operations_async import DeletedWebAppsOperations -from ._diagnostics_operations_async import DiagnosticsOperations -from ._provider_operations_async import ProviderOperations -from ._recommendations_operations_async import RecommendationsOperations -from ._web_site_management_client_operations_async import WebSiteManagementClientOperationsMixin -from ._web_apps_operations_async import WebAppsOperations -from ._static_sites_operations_async import StaticSitesOperations -from ._app_service_environments_operations_async import AppServiceEnvironmentsOperations -from ._app_service_plans_operations_async import AppServicePlansOperations -from ._resource_health_metadata_operations_async import ResourceHealthMetadataOperations - -__all__ = [ - 'AppServiceCertificateOrdersOperations', - 'CertificateRegistrationProviderOperations', - 'DomainsOperations', - 'TopLevelDomainsOperations', - 'DomainRegistrationProviderOperations', - 'CertificatesOperations', - 'DeletedWebAppsOperations', - 'DiagnosticsOperations', - 'ProviderOperations', - 'RecommendationsOperations', - 'WebSiteManagementClientOperationsMixin', - 'WebAppsOperations', - 'StaticSitesOperations', - 'AppServiceEnvironmentsOperations', - 'AppServicePlansOperations', - 'ResourceHealthMetadataOperations', -] diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_paged_models.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_paged_models.py deleted file mode 100644 index 3f4af4dd5898..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_paged_models.py +++ /dev/null @@ -1,781 +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 msrest.paging import Paged - - -class AppServiceCertificateOrderPaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceCertificateOrder ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceCertificateOrder]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceCertificateOrderPaged, self).__init__(*args, **kwargs) -class AppServiceCertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceCertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceCertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceCertificateResourcePaged, self).__init__(*args, **kwargs) -class CsmOperationDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmOperationDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmOperationDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmOperationDescriptionPaged, self).__init__(*args, **kwargs) -class DomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`Domain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Domain]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainPaged, self).__init__(*args, **kwargs) -class NameIdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`NameIdentifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[NameIdentifier]'} - } - - def __init__(self, *args, **kwargs): - - super(NameIdentifierPaged, self).__init__(*args, **kwargs) -class DomainOwnershipIdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`DomainOwnershipIdentifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DomainOwnershipIdentifier]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainOwnershipIdentifierPaged, self).__init__(*args, **kwargs) -class TopLevelDomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`TopLevelDomain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TopLevelDomain]'} - } - - def __init__(self, *args, **kwargs): - - super(TopLevelDomainPaged, self).__init__(*args, **kwargs) -class TldLegalAgreementPaged(Paged): - """ - A paging container for iterating over a list of :class:`TldLegalAgreement ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TldLegalAgreement]'} - } - - def __init__(self, *args, **kwargs): - - super(TldLegalAgreementPaged, self).__init__(*args, **kwargs) -class CertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`Certificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Certificate]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificatePaged, self).__init__(*args, **kwargs) -class DeletedSitePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSite ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSite]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSitePaged, self).__init__(*args, **kwargs) -class DetectorResponsePaged(Paged): - """ - A paging container for iterating over a list of :class:`DetectorResponse ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DetectorResponse]'} - } - - def __init__(self, *args, **kwargs): - - super(DetectorResponsePaged, self).__init__(*args, **kwargs) -class DiagnosticCategoryPaged(Paged): - """ - A paging container for iterating over a list of :class:`DiagnosticCategory ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DiagnosticCategory]'} - } - - def __init__(self, *args, **kwargs): - - super(DiagnosticCategoryPaged, self).__init__(*args, **kwargs) -class AnalysisDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`AnalysisDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AnalysisDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(AnalysisDefinitionPaged, self).__init__(*args, **kwargs) -class DetectorDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`DetectorDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DetectorDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(DetectorDefinitionPaged, self).__init__(*args, **kwargs) -class ApplicationStackResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`ApplicationStackResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ApplicationStackResource]'} - } - - def __init__(self, *args, **kwargs): - - super(ApplicationStackResourcePaged, self).__init__(*args, **kwargs) -class RecommendationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Recommendation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Recommendation]'} - } - - def __init__(self, *args, **kwargs): - - super(RecommendationPaged, self).__init__(*args, **kwargs) -class SourceControlPaged(Paged): - """ - A paging container for iterating over a list of :class:`SourceControl ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SourceControl]'} - } - - def __init__(self, *args, **kwargs): - - super(SourceControlPaged, self).__init__(*args, **kwargs) -class BillingMeterPaged(Paged): - """ - A paging container for iterating over a list of :class:`BillingMeter ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BillingMeter]'} - } - - def __init__(self, *args, **kwargs): - - super(BillingMeterPaged, self).__init__(*args, **kwargs) -class GeoRegionPaged(Paged): - """ - A paging container for iterating over a list of :class:`GeoRegion ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[GeoRegion]'} - } - - def __init__(self, *args, **kwargs): - - super(GeoRegionPaged, self).__init__(*args, **kwargs) -class IdentifierPaged(Paged): - """ - A paging container for iterating over a list of :class:`Identifier ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Identifier]'} - } - - def __init__(self, *args, **kwargs): - - super(IdentifierPaged, self).__init__(*args, **kwargs) -class PremierAddOnOfferPaged(Paged): - """ - A paging container for iterating over a list of :class:`PremierAddOnOffer ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PremierAddOnOffer]'} - } - - def __init__(self, *args, **kwargs): - - super(PremierAddOnOfferPaged, self).__init__(*args, **kwargs) -class SitePaged(Paged): - """ - A paging container for iterating over a list of :class:`Site ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Site]'} - } - - def __init__(self, *args, **kwargs): - - super(SitePaged, self).__init__(*args, **kwargs) -class BackupItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`BackupItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupItem]'} - } - - def __init__(self, *args, **kwargs): - - super(BackupItemPaged, self).__init__(*args, **kwargs) -class SiteConfigResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteConfigResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteConfigResource]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteConfigResourcePaged, self).__init__(*args, **kwargs) -class SiteConfigurationSnapshotInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteConfigurationSnapshotInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteConfigurationSnapshotInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteConfigurationSnapshotInfoPaged, self).__init__(*args, **kwargs) -class ContinuousWebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`ContinuousWebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ContinuousWebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(ContinuousWebJobPaged, self).__init__(*args, **kwargs) -class DeploymentPaged(Paged): - """ - A paging container for iterating over a list of :class:`Deployment ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Deployment]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentPaged, self).__init__(*args, **kwargs) -class FunctionEnvelopePaged(Paged): - """ - A paging container for iterating over a list of :class:`FunctionEnvelope ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[FunctionEnvelope]'} - } - - def __init__(self, *args, **kwargs): - - super(FunctionEnvelopePaged, self).__init__(*args, **kwargs) -class HostNameBindingPaged(Paged): - """ - A paging container for iterating over a list of :class:`HostNameBinding ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[HostNameBinding]'} - } - - def __init__(self, *args, **kwargs): - - super(HostNameBindingPaged, self).__init__(*args, **kwargs) -class SiteInstancePaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteInstance ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteInstance]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteInstancePaged, self).__init__(*args, **kwargs) -class ProcessInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessInfoPaged, self).__init__(*args, **kwargs) -class ProcessModuleInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessModuleInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessModuleInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessModuleInfoPaged, self).__init__(*args, **kwargs) -class ProcessThreadInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProcessThreadInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProcessThreadInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(ProcessThreadInfoPaged, self).__init__(*args, **kwargs) -class PerfMonResponsePaged(Paged): - """ - A paging container for iterating over a list of :class:`PerfMonResponse ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PerfMonResponse]'} - } - - def __init__(self, *args, **kwargs): - - super(PerfMonResponsePaged, self).__init__(*args, **kwargs) -class PublicCertificatePaged(Paged): - """ - A paging container for iterating over a list of :class:`PublicCertificate ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PublicCertificate]'} - } - - def __init__(self, *args, **kwargs): - - super(PublicCertificatePaged, self).__init__(*args, **kwargs) -class SiteExtensionInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SiteExtensionInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SiteExtensionInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SiteExtensionInfoPaged, self).__init__(*args, **kwargs) -class SlotDifferencePaged(Paged): - """ - A paging container for iterating over a list of :class:`SlotDifference ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SlotDifference]'} - } - - def __init__(self, *args, **kwargs): - - super(SlotDifferencePaged, self).__init__(*args, **kwargs) -class SnapshotPaged(Paged): - """ - A paging container for iterating over a list of :class:`Snapshot ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Snapshot]'} - } - - def __init__(self, *args, **kwargs): - - super(SnapshotPaged, self).__init__(*args, **kwargs) -class TriggeredWebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`TriggeredWebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TriggeredWebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(TriggeredWebJobPaged, self).__init__(*args, **kwargs) -class TriggeredJobHistoryPaged(Paged): - """ - A paging container for iterating over a list of :class:`TriggeredJobHistory ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TriggeredJobHistory]'} - } - - def __init__(self, *args, **kwargs): - - super(TriggeredJobHistoryPaged, self).__init__(*args, **kwargs) -class CsmUsageQuotaPaged(Paged): - """ - A paging container for iterating over a list of :class:`CsmUsageQuota ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CsmUsageQuota]'} - } - - def __init__(self, *args, **kwargs): - - super(CsmUsageQuotaPaged, self).__init__(*args, **kwargs) -class WebJobPaged(Paged): - """ - A paging container for iterating over a list of :class:`WebJob ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[WebJob]'} - } - - def __init__(self, *args, **kwargs): - - super(WebJobPaged, self).__init__(*args, **kwargs) -class StaticSiteARMResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`StaticSiteARMResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StaticSiteARMResource]'} - } - - def __init__(self, *args, **kwargs): - - super(StaticSiteARMResourcePaged, self).__init__(*args, **kwargs) -class StaticSiteUserARMResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`StaticSiteUserARMResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StaticSiteUserARMResource]'} - } - - def __init__(self, *args, **kwargs): - - super(StaticSiteUserARMResourcePaged, self).__init__(*args, **kwargs) -class StaticSiteBuildARMResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`StaticSiteBuildARMResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StaticSiteBuildARMResource]'} - } - - def __init__(self, *args, **kwargs): - - super(StaticSiteBuildARMResourcePaged, self).__init__(*args, **kwargs) -class StaticSiteFunctionOverviewARMResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`StaticSiteFunctionOverviewARMResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StaticSiteFunctionOverviewARMResource]'} - } - - def __init__(self, *args, **kwargs): - - super(StaticSiteFunctionOverviewARMResourcePaged, self).__init__(*args, **kwargs) -class StaticSiteCustomDomainOverviewARMResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`StaticSiteCustomDomainOverviewARMResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StaticSiteCustomDomainOverviewARMResource]'} - } - - def __init__(self, *args, **kwargs): - - super(StaticSiteCustomDomainOverviewARMResourcePaged, self).__init__(*args, **kwargs) -class AppServiceEnvironmentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServiceEnvironmentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServiceEnvironmentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServiceEnvironmentResourcePaged, self).__init__(*args, **kwargs) -class StampCapacityPaged(Paged): - """ - A paging container for iterating over a list of :class:`StampCapacity ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StampCapacity]'} - } - - def __init__(self, *args, **kwargs): - - super(StampCapacityPaged, self).__init__(*args, **kwargs) -class InboundEnvironmentEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`InboundEnvironmentEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[InboundEnvironmentEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(InboundEnvironmentEndpointPaged, self).__init__(*args, **kwargs) -class WorkerPoolResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`WorkerPoolResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[WorkerPoolResource]'} - } - - def __init__(self, *args, **kwargs): - - super(WorkerPoolResourcePaged, self).__init__(*args, **kwargs) -class ResourceMetricDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceMetricDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceMetricDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceMetricDefinitionPaged, self).__init__(*args, **kwargs) -class SkuInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`SkuInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SkuInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(SkuInfoPaged, self).__init__(*args, **kwargs) -class UsagePaged(Paged): - """ - A paging container for iterating over a list of :class:`Usage ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Usage]'} - } - - def __init__(self, *args, **kwargs): - - super(UsagePaged, self).__init__(*args, **kwargs) -class OutboundEnvironmentEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`OutboundEnvironmentEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(OutboundEnvironmentEndpointPaged, self).__init__(*args, **kwargs) -class AppServicePlanPaged(Paged): - """ - A paging container for iterating over a list of :class:`AppServicePlan ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppServicePlan]'} - } - - def __init__(self, *args, **kwargs): - - super(AppServicePlanPaged, self).__init__(*args, **kwargs) -class StrPaged(Paged): - """ - A paging container for iterating over a list of str object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[str]'} - } - - def __init__(self, *args, **kwargs): - - super(StrPaged, self).__init__(*args, **kwargs) -class HybridConnectionPaged(Paged): - """ - A paging container for iterating over a list of :class:`HybridConnection ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[HybridConnection]'} - } - - def __init__(self, *args, **kwargs): - - super(HybridConnectionPaged, self).__init__(*args, **kwargs) -class ResourceHealthMetadataPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceHealthMetadata ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceHealthMetadata]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceHealthMetadataPaged, self).__init__(*args, **kwargs) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py index 01d9f13179d7..72963351af67 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -132,10 +135,13 @@ def validate_purchase_information( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate_purchase_information.metadata['url'] # type: ignore @@ -151,12 +157,12 @@ def validate_purchase_information( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", 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_service_certificate_order, 'AppServiceCertificateOrder') 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 @@ -188,14 +194,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrderCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -262,9 +271,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -281,7 +293,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -309,10 +321,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServiceCertificateOrder" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -330,13 +345,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrder') 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 @@ -446,9 +460,12 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -465,6 +482,7 @@ def delete( # 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) @@ -504,10 +522,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateOrder"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -525,13 +546,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_distinguished_name, 'AppServiceCertificateOrderPatchResource') 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 @@ -573,14 +593,17 @@ def list_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -651,9 +674,12 @@ def get_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_certificate.metadata['url'] # type: ignore @@ -671,7 +697,7 @@ def get_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -700,10 +726,13 @@ def _create_or_update_certificate_initial( ): # type: (...) -> "models.AppServiceCertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_certificate_initial.metadata['url'] # type: ignore @@ -722,13 +751,12 @@ def _create_or_update_certificate_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificateResource') 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 @@ -845,9 +873,12 @@ def delete_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_certificate.metadata['url'] # type: ignore @@ -865,6 +896,7 @@ def delete_certificate( # 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) @@ -907,10 +939,13 @@ def update_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceCertificateResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_certificate.metadata['url'] # type: ignore @@ -929,13 +964,12 @@ def update_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key_vault_certificate, 'AppServiceCertificatePatchResource') 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 @@ -980,10 +1014,13 @@ def reissue( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.reissue.metadata['url'] # type: ignore @@ -1001,12 +1038,12 @@ def reissue( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reissue_certificate_order_request, 'ReissueCertificateOrderRequest') 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 @@ -1044,10 +1081,13 @@ def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.renew.metadata['url'] # type: ignore @@ -1065,12 +1105,12 @@ def renew( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(renew_certificate_order_request, 'RenewCertificateOrderRequest') 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 @@ -1105,9 +1145,12 @@ def resend_email( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.resend_email.metadata['url'] # type: ignore @@ -1124,6 +1167,7 @@ def resend_email( # 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) @@ -1163,10 +1207,13 @@ def resend_request_emails( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.resend_request_emails.metadata['url'] # type: ignore @@ -1184,12 +1231,12 @@ def resend_request_emails( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(name_identifier, 'NameIdentifier') 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 @@ -1227,10 +1274,13 @@ def retrieve_site_seal( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSeal"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.retrieve_site_seal.metadata['url'] # type: ignore @@ -1248,13 +1298,12 @@ def retrieve_site_seal( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_seal_request, 'SiteSealRequest') 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 @@ -1292,9 +1341,12 @@ def verify_domain_ownership( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.verify_domain_ownership.metadata['url'] # type: ignore @@ -1311,6 +1363,7 @@ def verify_domain_ownership( # 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) @@ -1347,9 +1400,12 @@ def retrieve_certificate_actions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateOrderAction"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_actions.metadata['url'] # type: ignore @@ -1366,7 +1422,7 @@ def retrieve_certificate_actions( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1406,9 +1462,12 @@ def retrieve_certificate_email_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.CertificateEmail"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.retrieve_certificate_email_history.metadata['url'] # type: ignore @@ -1425,7 +1484,7 @@ def retrieve_certificate_email_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py index d4f22f651f54..efdf6a6da0ef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -132,14 +135,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,9 +212,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -225,7 +234,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -253,10 +262,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServiceEnvironmentResource" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -274,13 +286,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource') 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 @@ -381,9 +392,12 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -402,6 +416,7 @@ def _delete_initial( # 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) @@ -507,10 +522,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServiceEnvironmentResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -528,13 +546,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource') 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 @@ -579,14 +596,17 @@ def list_capacities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StampCapacityCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -654,9 +674,12 @@ def get_vip_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AddressResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vip_info.metadata['url'] # type: ignore @@ -673,7 +696,7 @@ def get_vip_info( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -701,10 +724,13 @@ def _change_vnet_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._change_vnet_initial.metadata['url'] # type: ignore @@ -722,13 +748,12 @@ def _change_vnet_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') 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 @@ -778,16 +803,19 @@ def begin_change_vnet( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -806,7 +834,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -814,7 +841,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(vnet_info, 'VirtualNetworkProfile') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -900,9 +926,12 @@ def list_diagnostics( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.HostingEnvironmentDiagnostics"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_diagnostics.metadata['url'] # type: ignore @@ -919,7 +948,7 @@ def list_diagnostics( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -962,9 +991,12 @@ def get_diagnostics_item( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostingEnvironmentDiagnostics"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostics_item.metadata['url'] # type: ignore @@ -982,7 +1014,7 @@ def get_diagnostics_item( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1023,14 +1055,17 @@ def get_inbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.InboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1098,14 +1133,17 @@ def list_multi_role_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1173,9 +1211,12 @@ def get_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_multi_role_pool.metadata['url'] # type: ignore @@ -1192,7 +1233,7 @@ def get_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1220,10 +1261,13 @@ def _create_or_update_multi_role_pool_initial( ): # type: (...) -> "models.WorkerPoolResource" cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_multi_role_pool_initial.metadata['url'] # type: ignore @@ -1241,13 +1285,12 @@ def _create_or_update_multi_role_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1360,10 +1403,13 @@ def update_multi_role_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_multi_role_pool.metadata['url'] # type: ignore @@ -1381,13 +1427,12 @@ def update_multi_role_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource') 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 @@ -1433,14 +1478,17 @@ def list_multi_role_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1509,14 +1557,17 @@ def list_multi_role_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1584,14 +1635,17 @@ def list_multi_role_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1659,14 +1713,17 @@ def list_multi_role_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1734,9 +1791,12 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Operation"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -1753,7 +1813,7 @@ def list_operations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1794,14 +1854,17 @@ def get_outbound_network_dependencies_endpoints( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OutboundEnvironmentEndpointCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1869,9 +1932,12 @@ def reboot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reboot.metadata['url'] # type: ignore @@ -1888,6 +1954,7 @@ def reboot( # 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) @@ -1911,9 +1978,12 @@ def _resume_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._resume_initial.metadata['url'] # type: ignore @@ -1930,7 +2000,7 @@ def _resume_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1979,14 +2049,17 @@ def begin_resume( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2090,14 +2163,17 @@ def list_app_service_plans( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2168,14 +2244,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2232,9 +2311,12 @@ def _suspend_initial( ): # type: (...) -> "models.WebAppCollection" cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._suspend_initial.metadata['url'] # type: ignore @@ -2251,7 +2333,7 @@ def _suspend_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2300,14 +2382,17 @@ def begin_suspend( :raises ~azure.core.exceptions.HttpResponseError: """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2417,14 +2502,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2494,14 +2582,17 @@ def list_worker_pools( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2572,9 +2663,12 @@ def get_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_worker_pool.metadata['url'] # type: ignore @@ -2592,7 +2686,7 @@ def get_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2621,10 +2715,13 @@ def _create_or_update_worker_pool_initial( ): # type: (...) -> "models.WorkerPoolResource" cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_worker_pool_initial.metadata['url'] # type: ignore @@ -2643,13 +2740,12 @@ def _create_or_update_worker_pool_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2769,10 +2865,13 @@ def update_worker_pool( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WorkerPoolResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_worker_pool.metadata['url'] # type: ignore @@ -2791,13 +2890,12 @@ def update_worker_pool( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource') 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 @@ -2846,14 +2944,17 @@ def list_worker_pool_instance_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -2926,14 +3027,17 @@ def list_web_worker_metric_definitions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceMetricDefinitionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3005,14 +3109,17 @@ def list_worker_pool_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3084,14 +3191,17 @@ def list_web_worker_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.UsageCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py index 48c54091515f..ce41a1cc9c01 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -139,14 +142,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlanCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -213,9 +219,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AppServicePlan"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -232,7 +241,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -262,10 +271,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.AppServicePlan" cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -283,13 +295,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlan') 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 @@ -399,9 +410,12 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -418,6 +432,7 @@ def delete( # 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) @@ -457,10 +472,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AppServicePlan"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -478,13 +496,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource') 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 @@ -526,9 +543,12 @@ def list_capabilities( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.Capability"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_capabilities.metadata['url'] # type: ignore @@ -545,7 +565,7 @@ def list_capabilities( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -591,9 +611,12 @@ def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -612,7 +635,7 @@ def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -658,9 +681,12 @@ def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_hybrid_connection.metadata['url'] # type: ignore @@ -679,6 +705,7 @@ def delete_hybrid_connection( # 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) @@ -721,9 +748,12 @@ def list_hybrid_connection_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connection_keys.metadata['url'] # type: ignore @@ -742,7 +772,7 @@ def list_hybrid_connection_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -788,14 +818,17 @@ def list_web_apps_by_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -865,9 +898,12 @@ def get_hybrid_connection_plan_limit( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionLimits"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_plan_limit.metadata['url'] # type: ignore @@ -884,7 +920,7 @@ def get_hybrid_connection_plan_limit( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -924,14 +960,17 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnectionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1004,9 +1043,12 @@ def restart_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.restart_web_apps.metadata['url'] # type: ignore @@ -1025,6 +1067,7 @@ def restart_web_apps( # 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) @@ -1073,14 +1116,17 @@ def list_web_apps( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1154,9 +1200,12 @@ def get_server_farm_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_server_farm_skus.metadata['url'] # type: ignore @@ -1173,7 +1222,7 @@ def get_server_farm_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1217,14 +1266,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1294,9 +1346,12 @@ def list_vnets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_vnets.metadata['url'] # type: ignore @@ -1313,7 +1368,7 @@ def list_vnets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1356,9 +1411,12 @@ def get_vnet_from_server_farm( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_from_server_farm.metadata['url'] # type: ignore @@ -1376,7 +1434,7 @@ def get_vnet_from_server_farm( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1424,9 +1482,12 @@ def get_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_gateway.metadata['url'] # type: ignore @@ -1445,7 +1506,7 @@ def get_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1494,10 +1555,13 @@ def update_vnet_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_gateway.metadata['url'] # type: ignore @@ -1517,13 +1581,12 @@ def update_vnet_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -1565,9 +1628,12 @@ def list_routes_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_routes_for_vnet.metadata['url'] # type: ignore @@ -1585,7 +1651,7 @@ def list_routes_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1631,9 +1697,12 @@ def get_route_for_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["models.VnetRoute"]]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_route_for_vnet.metadata['url'] # type: ignore @@ -1652,7 +1721,7 @@ def get_route_for_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1703,10 +1772,13 @@ def create_or_update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_route.metadata['url'] # type: ignore @@ -1726,13 +1798,12 @@ def create_or_update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1778,9 +1849,12 @@ def delete_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_vnet_route.metadata['url'] # type: ignore @@ -1799,6 +1873,7 @@ def delete_vnet_route( # 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) @@ -1844,10 +1919,13 @@ def update_vnet_route( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetRoute"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_route.metadata['url'] # type: ignore @@ -1867,13 +1945,12 @@ def update_vnet_route( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(route, 'VnetRoute') 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 @@ -1916,9 +1993,12 @@ def reboot_worker( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reboot_worker.metadata['url'] # type: ignore @@ -1936,6 +2016,7 @@ def reboot_worker( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py index 9b5600e243ad..26c3580feac1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -61,14 +61,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py index 73faf7c1b7f0..3707d6570ed4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -266,10 +275,13 @@ def create_or_update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -287,13 +299,12 @@ def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'Certificate') 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 @@ -331,9 +342,12 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -350,6 +364,7 @@ def delete( # 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) @@ -389,10 +404,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Certificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -410,13 +428,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_envelope, 'CertificatePatchResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py index bcf458372363..ffa47d43acc9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def list_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedWebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get_deleted_web_app_by_location( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSite"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_deleted_web_app_by_location.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get_deleted_web_app_by_location( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py index f282883b06d2..b6a7ccb95610 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -67,14 +67,17 @@ def list_hosting_environment_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -154,9 +157,12 @@ def get_hosting_environment_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hosting_environment_detector_response.metadata['url'] # type: ignore @@ -180,7 +186,7 @@ def get_hosting_environment_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -220,14 +226,17 @@ def list_site_detector_responses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -307,9 +316,12 @@ def get_site_detector_response( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response.metadata['url'] # type: ignore @@ -333,7 +345,7 @@ def get_site_detector_response( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -373,14 +385,17 @@ def list_site_diagnostic_categories( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -451,9 +466,12 @@ def get_site_diagnostic_category( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category.metadata['url'] # type: ignore @@ -471,7 +489,7 @@ def get_site_diagnostic_category( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -514,14 +532,17 @@ def list_site_analyses( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -596,9 +617,12 @@ def get_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_analysis.metadata['url'] # type: ignore @@ -617,7 +641,7 @@ def get_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -672,9 +696,12 @@ def execute_site_analysis( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis.metadata['url'] # type: ignore @@ -699,7 +726,7 @@ def execute_site_analysis( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -742,14 +769,17 @@ def list_site_detectors( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -824,9 +854,12 @@ def get_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector.metadata['url'] # type: ignore @@ -845,7 +878,7 @@ def get_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -900,9 +933,12 @@ def execute_site_detector( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_detector.metadata['url'] # type: ignore @@ -927,7 +963,7 @@ def execute_site_detector( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -970,14 +1006,17 @@ def list_site_detector_responses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponseCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1061,9 +1100,12 @@ def get_site_detector_response_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector_response_slot.metadata['url'] # type: ignore @@ -1088,7 +1130,7 @@ def get_site_detector_response_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1131,14 +1173,17 @@ def list_site_diagnostic_categories_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1213,9 +1258,12 @@ def get_site_diagnostic_category_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticCategory"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_diagnostic_category_slot.metadata['url'] # type: ignore @@ -1234,7 +1282,7 @@ def get_site_diagnostic_category_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1280,14 +1328,17 @@ def list_site_analyses_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysisCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1366,9 +1417,12 @@ def get_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AnalysisDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_analysis_slot.metadata['url'] # type: ignore @@ -1388,7 +1442,7 @@ def get_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1446,9 +1500,12 @@ def execute_site_analysis_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticAnalysis"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_analysis_slot.metadata['url'] # type: ignore @@ -1474,7 +1531,7 @@ def execute_site_analysis_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1520,14 +1577,17 @@ def list_site_detectors_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1606,9 +1666,12 @@ def get_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DetectorDefinition"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_detector_slot.metadata['url'] # type: ignore @@ -1628,7 +1691,7 @@ def get_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1686,9 +1749,12 @@ def execute_site_detector_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticDetectorResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.execute_site_detector_slot.metadata['url'] # type: ignore @@ -1714,7 +1780,7 @@ def execute_site_detector_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py index 9ea7d555a1f1..5815d07c9e87 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -61,14 +61,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py index 35f482d73544..f97c4354291a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -65,10 +65,13 @@ def check_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainAvailabilityCheckResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_availability.metadata['url'] # type: ignore @@ -84,13 +87,12 @@ def check_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(identifier, 'NameIdentifier') 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 @@ -122,14 +124,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -189,9 +194,12 @@ def get_control_center_sso_request( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainControlCenterSsoRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_control_center_sso_request.metadata['url'] # type: ignore @@ -206,7 +214,7 @@ def get_control_center_sso_request( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -243,16 +251,19 @@ def list_recommendations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -269,7 +280,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -277,7 +287,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(parameters, 'DomainRecommendationSearchParameters') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -323,14 +332,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -397,9 +409,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -416,7 +431,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -444,10 +459,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Domain" cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -465,13 +483,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'Domain') 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 @@ -585,9 +602,12 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -606,6 +626,7 @@ def delete( # 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) @@ -645,10 +666,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -666,13 +690,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain, 'DomainPatchResource') 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 @@ -714,14 +737,17 @@ def list_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -792,9 +818,12 @@ def get_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ownership_identifier.metadata['url'] # type: ignore @@ -812,7 +841,7 @@ def get_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -859,10 +888,13 @@ def create_or_update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_ownership_identifier.metadata['url'] # type: ignore @@ -881,13 +913,12 @@ def create_or_update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -928,9 +959,12 @@ def delete_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_ownership_identifier.metadata['url'] # type: ignore @@ -948,6 +982,7 @@ def delete_ownership_identifier( # 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) @@ -991,10 +1026,13 @@ def update_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DomainOwnershipIdentifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ownership_identifier.metadata['url'] # type: ignore @@ -1013,13 +1051,12 @@ def update_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'DomainOwnershipIdentifier') 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 @@ -1057,9 +1094,12 @@ def renew( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.renew.metadata['url'] # type: ignore @@ -1076,6 +1116,7 @@ def renew( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py index 9b5b90ffadab..5e31ca4e57a3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -63,14 +63,17 @@ def get_available_stacks( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -129,14 +132,17 @@ def list_operations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmOperationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -195,14 +201,17 @@ def get_available_stacks_on_prem( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationStackCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py index a8ff1276a2c2..382a34cb5322 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -69,14 +69,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -140,9 +143,12 @@ def reset_all_filters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_all_filters.metadata['url'] # type: ignore @@ -157,6 +163,7 @@ def reset_all_filters( # 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) @@ -191,9 +198,12 @@ def disable_recommendation_for_subscription( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_recommendation_for_subscription.metadata['url'] # type: ignore @@ -209,6 +219,7 @@ def disable_recommendation_for_subscription( # 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) @@ -254,14 +265,17 @@ def list_history_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -341,14 +355,17 @@ def list_recommended_rules_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -423,9 +440,12 @@ def disable_all_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_all_for_hosting_environment.metadata['url'] # type: ignore @@ -443,6 +463,7 @@ def disable_all_for_hosting_environment( # 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) @@ -482,9 +503,12 @@ def reset_all_filters_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_all_filters_for_hosting_environment.metadata['url'] # type: ignore @@ -502,6 +526,7 @@ def reset_all_filters_for_hosting_environment( # 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) @@ -549,9 +574,12 @@ def get_rule_details_by_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_hosting_environment.metadata['url'] # type: ignore @@ -573,7 +601,7 @@ def get_rule_details_by_hosting_environment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -619,9 +647,12 @@ def disable_recommendation_for_hosting_environment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_recommendation_for_hosting_environment.metadata['url'] # type: ignore @@ -640,6 +671,7 @@ def disable_recommendation_for_hosting_environment( # 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) @@ -685,14 +717,17 @@ def list_history_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -772,14 +807,17 @@ def list_recommended_rules_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -851,9 +889,12 @@ def disable_all_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_all_for_web_app.metadata['url'] # type: ignore @@ -870,6 +911,7 @@ def disable_all_for_web_app( # 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) @@ -906,9 +948,12 @@ def reset_all_filters_for_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_all_filters_for_web_app.metadata['url'] # type: ignore @@ -925,6 +970,7 @@ def reset_all_filters_for_web_app( # 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) @@ -972,9 +1018,12 @@ def get_rule_details_by_web_app( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RecommendationRule"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_rule_details_by_web_app.metadata['url'] # type: ignore @@ -996,7 +1045,7 @@ def get_rule_details_by_web_app( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1039,9 +1088,12 @@ def disable_recommendation_for_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.disable_recommendation_for_site.metadata['url'] # type: ignore @@ -1059,6 +1111,7 @@ def disable_recommendation_for_site( # 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py index 985da1e8d448..a6df2f5e6fb0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -131,14 +134,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -206,14 +212,17 @@ def list_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -281,9 +290,12 @@ def get_by_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_by_site.metadata['url'] # type: ignore @@ -300,7 +312,7 @@ def get_by_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -344,14 +356,17 @@ def list_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadataCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -423,9 +438,12 @@ def get_by_site_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceHealthMetadata"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_by_site_slot.metadata['url'] # type: ignore @@ -443,7 +461,7 @@ def get_by_site_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py index 0b0467b3acfd..b822a996b484 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,14 +133,17 @@ def get_static_sites_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -204,9 +210,12 @@ def get_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_static_site.metadata['url'] # type: ignore @@ -223,7 +232,7 @@ def get_static_site( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -267,10 +276,13 @@ def create_or_update_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_static_site.metadata['url'] # type: ignore @@ -288,13 +300,12 @@ def create_or_update_static_site( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_envelope, 'StaticSiteARMResource') 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 @@ -336,9 +347,12 @@ def delete_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site.metadata['url'] # type: ignore @@ -355,6 +369,7 @@ def delete_static_site( # 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) @@ -395,10 +410,13 @@ def update_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_static_site.metadata['url'] # type: ignore @@ -416,13 +434,12 @@ def update_static_site( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_envelope, 'StaticSitePatchResource') 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 @@ -467,14 +484,17 @@ def list_static_site_users( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -549,9 +569,12 @@ def delete_static_site_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site_user.metadata['url'] # type: ignore @@ -570,6 +593,7 @@ def delete_static_site_user( # 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) @@ -616,10 +640,13 @@ def update_static_site_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_static_site_user.metadata['url'] # type: ignore @@ -639,13 +666,12 @@ def update_static_site_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_user_envelope, 'StaticSiteUserARMResource') 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 @@ -683,14 +709,17 @@ def get_static_site_builds( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -761,9 +790,12 @@ def get_static_site_build( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteBuildARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_static_site_build.metadata['url'] # type: ignore @@ -781,7 +813,7 @@ def get_static_site_build( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -824,9 +856,12 @@ def delete_static_site_build( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site_build.metadata['url'] # type: ignore @@ -844,6 +879,7 @@ def delete_static_site_build( # 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) @@ -886,10 +922,13 @@ def create_or_update_static_site_build_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_static_site_build_function_app_settings.metadata['url'] # type: ignore @@ -908,13 +947,12 @@ def create_or_update_static_site_build_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -959,14 +997,17 @@ def list_static_site_build_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1038,9 +1079,12 @@ def list_static_site_build_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_static_site_build_function_app_settings.metadata['url'] # type: ignore @@ -1058,7 +1102,7 @@ def list_static_site_build_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1105,10 +1149,13 @@ def create_or_update_static_site_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_static_site_function_app_settings.metadata['url'] # type: ignore @@ -1126,13 +1173,12 @@ def create_or_update_static_site_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1177,10 +1223,13 @@ def create_user_roles_invitation_link( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteUserInvitationResponseResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_user_roles_invitation_link.metadata['url'] # type: ignore @@ -1198,13 +1247,12 @@ def create_user_roles_invitation_link( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(static_site_user_roles_invitation_envelope, 'StaticSiteUserInvitationRequestResource') 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 @@ -1242,14 +1290,17 @@ def list_static_site_custom_domains( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1321,9 +1372,12 @@ def create_or_update_static_site_custom_domain( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteCustomDomainOverviewARMResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.create_or_update_static_site_custom_domain.metadata['url'] # type: ignore @@ -1341,7 +1395,7 @@ def create_or_update_static_site_custom_domain( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -1388,9 +1442,12 @@ def delete_static_site_custom_domain( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_static_site_custom_domain.metadata['url'] # type: ignore @@ -1408,6 +1465,7 @@ def delete_static_site_custom_domain( # 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) @@ -1447,9 +1505,12 @@ def validate_custom_domain_can_be_added_to_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.validate_custom_domain_can_be_added_to_static_site.metadata['url'] # type: ignore @@ -1467,6 +1528,7 @@ def validate_custom_domain_can_be_added_to_static_site( # 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) @@ -1503,9 +1565,12 @@ def detach_static_site( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.detach_static_site.metadata['url'] # type: ignore @@ -1522,6 +1587,7 @@ def detach_static_site( # 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) @@ -1558,14 +1624,17 @@ def list_static_site_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StaticSiteFunctionOverviewCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1633,9 +1702,12 @@ def list_static_site_function_app_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_static_site_function_app_settings.metadata['url'] # type: ignore @@ -1652,7 +1724,7 @@ def list_static_site_function_app_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1696,9 +1768,12 @@ def list_static_site_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_static_site_secrets.metadata['url'] # type: ignore @@ -1715,7 +1790,7 @@ def list_static_site_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1758,10 +1833,13 @@ def reset_static_site_api_key( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.reset_static_site_api_key.metadata['url'] # type: ignore @@ -1779,12 +1857,12 @@ def reset_static_site_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(reset_properties_envelope, 'StaticSiteResetPropertiesARMResource') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py index 3bd7c9ff86de..025c78edd001 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomainCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,9 +133,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TopLevelDomain"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -148,7 +154,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -188,16 +194,19 @@ def list_agreements( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TldLegalAgreementCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -215,7 +224,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -223,7 +231,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(agreement_option, 'TopLevelDomainAgreementOption') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py index e2142a687d71..faa5ded44b03 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -136,14 +139,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -212,9 +218,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -231,7 +240,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -261,10 +270,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Site" cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -282,13 +294,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -407,9 +418,12 @@ def delete( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -430,6 +444,7 @@ def delete( # 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) @@ -471,10 +486,13 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -492,13 +510,12 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -543,9 +560,12 @@ def analyze_custom_hostname( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname.metadata['url'] # type: ignore @@ -564,7 +584,7 @@ def analyze_custom_hostname( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -607,10 +627,13 @@ def apply_slot_config_to_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.apply_slot_config_to_production.metadata['url'] # type: ignore @@ -628,12 +651,12 @@ def apply_slot_config_to_production( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -672,10 +695,13 @@ def backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup.metadata['url'] # type: ignore @@ -693,13 +719,12 @@ def backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -737,14 +762,17 @@ def list_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -815,9 +843,12 @@ def get_backup_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status.metadata['url'] # type: ignore @@ -835,7 +866,7 @@ def get_backup_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -878,9 +909,12 @@ def delete_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup.metadata['url'] # type: ignore @@ -898,6 +932,7 @@ def delete_backup( # 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) @@ -942,10 +977,13 @@ def list_backup_status_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets.metadata['url'] # type: ignore @@ -964,13 +1002,12 @@ def list_backup_status_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -997,10 +1034,13 @@ def _restore_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_initial.metadata['url'] # type: ignore @@ -1019,12 +1059,12 @@ def _restore_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -1129,9 +1169,12 @@ def get_basic_publishing_credentials_policies( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_basic_publishing_credentials_policies.metadata['url'] # type: ignore @@ -1148,7 +1191,7 @@ def get_basic_publishing_credentials_policies( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1188,9 +1231,12 @@ def get_ftp_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ftp_allowed.metadata['url'] # type: ignore @@ -1207,7 +1253,7 @@ def get_ftp_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1250,10 +1296,13 @@ def update_ftp_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_ftp_allowed.metadata['url'] # type: ignore @@ -1271,13 +1320,12 @@ def update_ftp_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') 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 @@ -1315,9 +1363,12 @@ def get_scm_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_scm_allowed.metadata['url'] # type: ignore @@ -1334,7 +1385,7 @@ def get_scm_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1377,10 +1428,13 @@ def update_scm_allowed( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmPublishingCredentialsPoliciesEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_scm_allowed.metadata['url'] # type: ignore @@ -1398,13 +1452,12 @@ def update_scm_allowed( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(csm_publishing_access_policies_entity, 'CsmPublishingCredentialsPoliciesEntity') 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 @@ -1442,14 +1495,17 @@ def list_configurations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1520,10 +1576,13 @@ def update_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings.metadata['url'] # type: ignore @@ -1541,13 +1600,12 @@ def update_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -1585,9 +1643,12 @@ def list_application_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings.metadata['url'] # type: ignore @@ -1604,7 +1665,7 @@ def list_application_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1647,10 +1708,13 @@ def update_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings.metadata['url'] # type: ignore @@ -1668,13 +1732,12 @@ def update_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -1712,9 +1775,12 @@ def get_auth_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings.metadata['url'] # type: ignore @@ -1731,7 +1797,7 @@ def get_auth_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1774,10 +1840,13 @@ def update_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts.metadata['url'] # type: ignore @@ -1795,13 +1864,12 @@ def update_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -1839,9 +1907,12 @@ def list_azure_storage_accounts( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts.metadata['url'] # type: ignore @@ -1858,7 +1929,7 @@ def list_azure_storage_accounts( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -1901,10 +1972,13 @@ def update_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration.metadata['url'] # type: ignore @@ -1922,13 +1996,12 @@ def update_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -1966,9 +2039,12 @@ def delete_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup_configuration.metadata['url'] # type: ignore @@ -1985,6 +2061,7 @@ def delete_backup_configuration( # 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) @@ -2021,9 +2098,12 @@ def get_backup_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration.metadata['url'] # type: ignore @@ -2040,7 +2120,7 @@ def get_backup_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2080,9 +2160,12 @@ def get_app_settings_key_vault_references( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_app_settings_key_vault_references.metadata['url'] # type: ignore @@ -2099,7 +2182,7 @@ def get_app_settings_key_vault_references( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2142,9 +2225,12 @@ def get_app_setting_key_vault_reference( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVaultReferenceResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_app_setting_key_vault_reference.metadata['url'] # type: ignore @@ -2162,7 +2248,7 @@ def get_app_setting_key_vault_reference( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2205,10 +2291,13 @@ def update_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings.metadata['url'] # type: ignore @@ -2226,13 +2315,12 @@ def update_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -2270,9 +2358,12 @@ def list_connection_strings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings.metadata['url'] # type: ignore @@ -2289,7 +2380,7 @@ def list_connection_strings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2329,9 +2420,12 @@ def get_diagnostic_logs_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration.metadata['url'] # type: ignore @@ -2348,7 +2442,7 @@ def get_diagnostic_logs_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2392,10 +2486,13 @@ def update_diagnostic_logs_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config.metadata['url'] # type: ignore @@ -2413,13 +2510,12 @@ def update_diagnostic_logs_config( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -2460,10 +2556,13 @@ def update_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata.metadata['url'] # type: ignore @@ -2481,13 +2580,12 @@ def update_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -2525,9 +2623,12 @@ def list_metadata( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_metadata.metadata['url'] # type: ignore @@ -2544,7 +2645,7 @@ def list_metadata( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2571,9 +2672,12 @@ def _list_publishing_credentials_initial( ): # type: (...) -> "models.User" cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_initial.metadata['url'] # type: ignore @@ -2590,7 +2694,7 @@ def _list_publishing_credentials_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2697,10 +2801,13 @@ def update_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings.metadata['url'] # type: ignore @@ -2718,13 +2825,12 @@ def update_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -2762,9 +2868,12 @@ def list_site_push_settings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings.metadata['url'] # type: ignore @@ -2781,7 +2890,7 @@ def list_site_push_settings( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2822,9 +2931,12 @@ def list_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_slot_configuration_names.metadata['url'] # type: ignore @@ -2841,7 +2953,7 @@ def list_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -2885,10 +2997,13 @@ def update_slot_configuration_names( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotConfigNamesResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot_configuration_names.metadata['url'] # type: ignore @@ -2906,13 +3021,12 @@ def update_slot_configuration_names( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_config_names, 'SlotConfigNamesResource') 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 @@ -2951,9 +3065,12 @@ def get_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration.metadata['url'] # type: ignore @@ -2970,7 +3087,7 @@ def get_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3013,10 +3130,13 @@ def create_or_update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration.metadata['url'] # type: ignore @@ -3034,13 +3154,12 @@ def create_or_update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -3081,10 +3200,13 @@ def update_configuration( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration.metadata['url'] # type: ignore @@ -3102,13 +3224,12 @@ def update_configuration( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -3147,14 +3268,17 @@ def list_configuration_snapshot_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3225,9 +3349,12 @@ def get_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot.metadata['url'] # type: ignore @@ -3245,7 +3372,7 @@ def get_configuration_snapshot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3288,9 +3415,12 @@ def recover_site_configuration_snapshot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.recover_site_configuration_snapshot.metadata['url'] # type: ignore @@ -3308,6 +3438,7 @@ def recover_site_configuration_snapshot( # 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) @@ -3344,9 +3475,12 @@ def get_web_site_container_logs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs.metadata['url'] # type: ignore @@ -3363,7 +3497,7 @@ def get_web_site_container_logs( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -3404,9 +3538,12 @@ def get_container_logs_zip( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip.metadata['url'] # type: ignore @@ -3423,7 +3560,7 @@ def get_container_logs_zip( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -3464,14 +3601,17 @@ def list_continuous_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3542,9 +3682,12 @@ def get_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job.metadata['url'] # type: ignore @@ -3562,7 +3705,7 @@ def get_continuous_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3607,9 +3750,12 @@ def delete_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_continuous_web_job.metadata['url'] # type: ignore @@ -3627,6 +3773,7 @@ def delete_continuous_web_job( # 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) @@ -3666,9 +3813,12 @@ def start_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_continuous_web_job.metadata['url'] # type: ignore @@ -3686,6 +3836,7 @@ def start_continuous_web_job( # 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) @@ -3725,9 +3876,12 @@ def stop_continuous_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_continuous_web_job.metadata['url'] # type: ignore @@ -3745,6 +3899,7 @@ def stop_continuous_web_job( # 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) @@ -3781,14 +3936,17 @@ def list_deployments( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -3859,9 +4017,12 @@ def get_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_deployment.metadata['url'] # type: ignore @@ -3879,7 +4040,7 @@ def get_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -3925,10 +4086,13 @@ def create_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment.metadata['url'] # type: ignore @@ -3947,13 +4111,12 @@ def create_deployment( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -3994,9 +4157,12 @@ def delete_deployment( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_deployment.metadata['url'] # type: ignore @@ -4014,6 +4180,7 @@ def delete_deployment( # 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) @@ -4054,9 +4221,12 @@ def list_deployment_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log.metadata['url'] # type: ignore @@ -4074,7 +4244,7 @@ def list_deployment_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4119,10 +4289,13 @@ def discover_backup( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup.metadata['url'] # type: ignore @@ -4140,13 +4313,12 @@ def discover_backup( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -4184,14 +4356,17 @@ def list_domain_ownership_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4262,9 +4437,12 @@ def get_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4282,7 +4460,7 @@ def get_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4329,10 +4507,13 @@ def create_or_update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4351,13 +4532,12 @@ def create_or_update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -4398,9 +4578,12 @@ def delete_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4418,6 +4601,7 @@ def delete_domain_ownership_identifier( # 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) @@ -4461,10 +4645,13 @@ def update_domain_ownership_identifier( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier.metadata['url'] # type: ignore @@ -4483,13 +4670,12 @@ def update_domain_ownership_identifier( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -4527,9 +4713,12 @@ def get_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status.metadata['url'] # type: ignore @@ -4546,7 +4735,7 @@ def get_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4574,10 +4763,13 @@ def _create_ms_deploy_operation_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -4595,13 +4787,12 @@ def _create_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -4709,9 +4900,12 @@ def get_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log.metadata['url'] # type: ignore @@ -4728,7 +4922,7 @@ def get_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4770,14 +4964,17 @@ def list_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -4845,9 +5042,12 @@ def get_functions_admin_token( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token.metadata['url'] # type: ignore @@ -4864,7 +5064,7 @@ def get_functions_admin_token( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4907,9 +5107,12 @@ def get_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_function.metadata['url'] # type: ignore @@ -4927,7 +5130,7 @@ def get_function( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -4958,10 +5161,13 @@ def _create_function_initial( ): # type: (...) -> "models.FunctionEnvelope" cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_function_initial.metadata['url'] # type: ignore @@ -4980,13 +5186,12 @@ def _create_function_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -5099,9 +5304,12 @@ def delete_function( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_function.metadata['url'] # type: ignore @@ -5119,6 +5327,7 @@ def delete_function( # 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) @@ -5164,10 +5373,13 @@ def create_or_update_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret.metadata['url'] # type: ignore @@ -5187,13 +5399,12 @@ def create_or_update_function_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -5241,9 +5452,12 @@ def delete_function_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_function_secret.metadata['url'] # type: ignore @@ -5262,6 +5476,7 @@ def delete_function_secret( # 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) @@ -5301,9 +5516,12 @@ def list_function_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_keys.metadata['url'] # type: ignore @@ -5321,7 +5539,7 @@ def list_function_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5364,9 +5582,12 @@ def list_function_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets.metadata['url'] # type: ignore @@ -5384,7 +5605,7 @@ def list_function_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5424,9 +5645,12 @@ def list_host_keys( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_host_keys.metadata['url'] # type: ignore @@ -5443,7 +5667,7 @@ def list_host_keys( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5483,9 +5707,12 @@ def list_sync_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_status.metadata['url'] # type: ignore @@ -5502,6 +5729,7 @@ def list_sync_status( # 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) @@ -5538,9 +5766,12 @@ def sync_functions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_functions.metadata['url'] # type: ignore @@ -5557,6 +5788,7 @@ def sync_functions( # 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) @@ -5602,10 +5834,13 @@ def create_or_update_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret.metadata['url'] # type: ignore @@ -5625,13 +5860,12 @@ def create_or_update_host_secret( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -5679,9 +5913,12 @@ def delete_host_secret( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_secret.metadata['url'] # type: ignore @@ -5700,6 +5937,7 @@ def delete_host_secret( # 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) @@ -5736,14 +5974,17 @@ def list_host_name_bindings( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -5814,9 +6055,12 @@ def get_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding.metadata['url'] # type: ignore @@ -5834,7 +6078,7 @@ def get_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -5881,10 +6125,13 @@ def create_or_update_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding.metadata['url'] # type: ignore @@ -5903,13 +6150,12 @@ def create_or_update_host_name_binding( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -5950,9 +6196,12 @@ def delete_host_name_binding( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_name_binding.metadata['url'] # type: ignore @@ -5970,6 +6219,7 @@ def delete_host_name_binding( # 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) @@ -6012,9 +6262,12 @@ def get_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection.metadata['url'] # type: ignore @@ -6033,7 +6286,7 @@ def get_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6082,10 +6335,13 @@ def create_or_update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection.metadata['url'] # type: ignore @@ -6105,13 +6361,12 @@ def create_or_update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -6155,9 +6410,12 @@ def delete_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_hybrid_connection.metadata['url'] # type: ignore @@ -6176,6 +6434,7 @@ def delete_hybrid_connection( # 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) @@ -6221,10 +6480,13 @@ def update_hybrid_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection.metadata['url'] # type: ignore @@ -6244,13 +6506,12 @@ def update_hybrid_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -6288,9 +6549,12 @@ def list_hybrid_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections.metadata['url'] # type: ignore @@ -6307,7 +6571,7 @@ def list_hybrid_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6348,9 +6612,12 @@ def list_relay_service_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections.metadata['url'] # type: ignore @@ -6367,7 +6634,7 @@ def list_relay_service_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6410,9 +6677,12 @@ def get_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection.metadata['url'] # type: ignore @@ -6430,7 +6700,7 @@ def get_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6477,10 +6747,13 @@ def create_or_update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection.metadata['url'] # type: ignore @@ -6499,13 +6772,12 @@ def create_or_update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6546,9 +6818,12 @@ def delete_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_relay_service_connection.metadata['url'] # type: ignore @@ -6566,6 +6841,7 @@ def delete_relay_service_connection( # 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) @@ -6609,10 +6885,13 @@ def update_relay_service_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection.metadata['url'] # type: ignore @@ -6631,13 +6910,12 @@ def update_relay_service_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -6675,14 +6953,17 @@ def list_instance_identifiers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -6753,9 +7034,12 @@ def get_instance_info( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_info.metadata['url'] # type: ignore @@ -6773,7 +7057,7 @@ def get_instance_info( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6816,9 +7100,12 @@ def get_instance_ms_deploy_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status.metadata['url'] # type: ignore @@ -6836,7 +7123,7 @@ def get_instance_ms_deploy_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -6865,10 +7152,13 @@ def _create_instance_ms_deploy_operation_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_initial.metadata['url'] # type: ignore @@ -6887,13 +7177,12 @@ def _create_instance_ms_deploy_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -7008,9 +7297,12 @@ def get_instance_ms_deploy_log( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log.metadata['url'] # type: ignore @@ -7028,7 +7320,7 @@ def get_instance_ms_deploy_log( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7075,14 +7367,17 @@ def list_instance_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7159,9 +7454,12 @@ def get_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process.metadata['url'] # type: ignore @@ -7180,7 +7478,7 @@ def get_instance_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7230,9 +7528,12 @@ def delete_instance_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_instance_process.metadata['url'] # type: ignore @@ -7251,6 +7552,7 @@ def delete_instance_process( # 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) @@ -7295,9 +7597,12 @@ def get_instance_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump.metadata['url'] # type: ignore @@ -7316,7 +7621,7 @@ def get_instance_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -7366,14 +7671,17 @@ def list_instance_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7454,9 +7762,12 @@ def get_instance_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module.metadata['url'] # type: ignore @@ -7476,7 +7787,7 @@ def get_instance_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7526,14 +7837,17 @@ def list_instance_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7603,9 +7917,12 @@ def is_cloneable( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable.metadata['url'] # type: ignore @@ -7622,7 +7939,7 @@ def is_cloneable( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7662,14 +7979,17 @@ def list_site_backups( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -7737,9 +8057,12 @@ def list_sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers.metadata['url'] # type: ignore @@ -7756,7 +8079,7 @@ def list_sync_function_triggers( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -7785,10 +8108,13 @@ def _migrate_storage_initial( ): # type: (...) -> "models.StorageMigrationResponse" cls = kwargs.pop('cls', None) # type: ClsType["models.StorageMigrationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_storage_initial.metadata['url'] # type: ignore @@ -7807,13 +8133,12 @@ def _migrate_storage_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_options, 'StorageMigrationOptions') 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 @@ -7911,10 +8236,13 @@ def _migrate_my_sql_initial( ): # type: (...) -> "models.Operation" cls = kwargs.pop('cls', None) # type: ClsType["models.Operation"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._migrate_my_sql_initial.metadata['url'] # type: ignore @@ -7932,13 +8260,12 @@ def _migrate_my_sql_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(migration_request_envelope, 'MigrateMySqlRequest') 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 @@ -8045,9 +8372,12 @@ def get_migrate_my_sql_status( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status.metadata['url'] # type: ignore @@ -8064,7 +8394,7 @@ def get_migrate_my_sql_status( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8104,9 +8434,12 @@ def get_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -8123,7 +8456,7 @@ def get_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8170,10 +8503,13 @@ def create_or_update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -8191,13 +8527,12 @@ def create_or_update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -8235,9 +8570,12 @@ def delete_swift_virtual_network( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_swift_virtual_network.metadata['url'] # type: ignore @@ -8254,6 +8592,7 @@ def delete_swift_virtual_network( # 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) @@ -8297,10 +8636,13 @@ def update_swift_virtual_network_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection.metadata['url'] # type: ignore @@ -8318,13 +8660,12 @@ def update_swift_virtual_network_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -8365,9 +8706,12 @@ def list_network_features( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_network_features.metadata['url'] # type: ignore @@ -8385,7 +8729,7 @@ def list_network_features( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8431,9 +8775,12 @@ def get_network_trace_operation( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation.metadata['url'] # type: ignore @@ -8451,7 +8798,7 @@ def get_network_trace_operation( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8504,9 +8851,12 @@ def start_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace.metadata['url'] # type: ignore @@ -8529,7 +8879,7 @@ def start_web_site_network_trace( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8559,9 +8909,12 @@ def _start_web_site_network_trace_operation_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_initial.metadata['url'] # type: ignore @@ -8584,7 +8937,7 @@ def _start_web_site_network_trace_operation_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8704,9 +9057,12 @@ def stop_web_site_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace.metadata['url'] # type: ignore @@ -8723,6 +9079,7 @@ def stop_web_site_network_trace( # 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) @@ -8763,9 +9120,12 @@ def get_network_traces( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces.metadata['url'] # type: ignore @@ -8783,7 +9143,7 @@ def get_network_traces( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8827,9 +9187,12 @@ def get_network_trace_operation_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_v2.metadata['url'] # type: ignore @@ -8847,7 +9210,7 @@ def get_network_trace_operation_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8895,9 +9258,12 @@ def get_network_traces_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces_v2.metadata['url'] # type: ignore @@ -8915,7 +9281,7 @@ def get_network_traces_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -8956,9 +9322,12 @@ def generate_new_site_publishing_password( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.generate_new_site_publishing_password.metadata['url'] # type: ignore @@ -8975,6 +9344,7 @@ def generate_new_site_publishing_password( # 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) @@ -9016,14 +9386,17 @@ def list_perf_mon_counters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9093,9 +9466,12 @@ def get_site_php_error_log_flag( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag.metadata['url'] # type: ignore @@ -9112,7 +9488,7 @@ def get_site_php_error_log_flag( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9152,9 +9528,12 @@ def list_premier_add_ons( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons.metadata['url'] # type: ignore @@ -9171,7 +9550,7 @@ def list_premier_add_ons( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9214,9 +9593,12 @@ def get_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on.metadata['url'] # type: ignore @@ -9234,7 +9616,7 @@ def get_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9280,10 +9662,13 @@ def add_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on.metadata['url'] # type: ignore @@ -9302,13 +9687,12 @@ def add_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -9349,9 +9733,12 @@ def delete_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_premier_add_on.metadata['url'] # type: ignore @@ -9369,6 +9756,7 @@ def delete_premier_add_on( # 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) @@ -9411,10 +9799,13 @@ def update_premier_add_on( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on.metadata['url'] # type: ignore @@ -9433,13 +9824,12 @@ def update_premier_add_on( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -9478,9 +9868,12 @@ def get_private_access( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_access.metadata['url'] # type: ignore @@ -9497,7 +9890,7 @@ def get_private_access( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9541,10 +9934,13 @@ def put_private_access_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet.metadata['url'] # type: ignore @@ -9562,13 +9958,12 @@ def put_private_access_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -9607,14 +10002,17 @@ def list_processes( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9686,9 +10084,12 @@ def get_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process.metadata['url'] # type: ignore @@ -9706,7 +10107,7 @@ def get_process( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -9752,9 +10153,12 @@ def delete_process( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_process.metadata['url'] # type: ignore @@ -9772,6 +10176,7 @@ def delete_process( # 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) @@ -9812,9 +10217,12 @@ def get_process_dump( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump.metadata['url'] # type: ignore @@ -9832,7 +10240,7 @@ def get_process_dump( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -9878,14 +10286,17 @@ def list_process_modules( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -9961,9 +10372,12 @@ def get_process_module( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_module.metadata['url'] # type: ignore @@ -9982,7 +10396,7 @@ def get_process_module( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10028,14 +10442,17 @@ def list_process_threads( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10104,14 +10521,17 @@ def list_public_certificates( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10182,9 +10602,12 @@ def get_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate.metadata['url'] # type: ignore @@ -10202,7 +10625,7 @@ def get_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -10249,10 +10672,13 @@ def create_or_update_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate.metadata['url'] # type: ignore @@ -10271,13 +10697,12 @@ def create_or_update_public_certificate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -10318,9 +10743,12 @@ def delete_public_certificate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_public_certificate.metadata['url'] # type: ignore @@ -10338,6 +10766,7 @@ def delete_public_certificate( # 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) @@ -10378,10 +10807,13 @@ def list_publishing_profile_xml_with_secrets( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets.metadata['url'] # type: ignore @@ -10399,13 +10831,12 @@ def list_publishing_profile_xml_with_secrets( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -10444,9 +10875,12 @@ def reset_production_slot_config( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_production_slot_config.metadata['url'] # type: ignore @@ -10463,6 +10897,7 @@ def reset_production_slot_config( # 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) @@ -10507,9 +10942,12 @@ def restart( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.restart.metadata['url'] # type: ignore @@ -10530,6 +10968,7 @@ def restart( # 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) @@ -10554,10 +10993,13 @@ def _restore_from_backup_blob_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_backup_blob_initial.metadata['url'] # type: ignore @@ -10575,12 +11017,12 @@ def _restore_from_backup_blob_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -10668,10 +11110,13 @@ def _restore_from_deleted_app_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_deleted_app_initial.metadata['url'] # type: ignore @@ -10689,12 +11134,12 @@ def _restore_from_deleted_app_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -10782,10 +11227,13 @@ def _restore_snapshot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_snapshot_initial.metadata['url'] # type: ignore @@ -10803,12 +11251,12 @@ def _restore_snapshot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -10909,14 +11357,17 @@ def list_site_extensions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -10987,9 +11438,12 @@ def get_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension.metadata['url'] # type: ignore @@ -11007,7 +11461,7 @@ def get_site_extension( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11037,9 +11491,12 @@ def _install_site_extension_initial( ): # type: (...) -> Optional["models.SiteExtensionInfo"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_initial.metadata['url'] # type: ignore @@ -11057,7 +11514,7 @@ def _install_site_extension_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -11173,9 +11630,12 @@ def delete_site_extension( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_site_extension.metadata['url'] # type: ignore @@ -11193,6 +11653,7 @@ def delete_site_extension( # 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) @@ -11217,10 +11678,13 @@ def _copy_production_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._copy_production_slot_initial.metadata['url'] # type: ignore @@ -11238,12 +11702,12 @@ def _copy_production_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') 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 @@ -11344,14 +11808,17 @@ def list_slots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -11422,9 +11889,12 @@ def get_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Site"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_slot.metadata['url'] # type: ignore @@ -11442,7 +11912,7 @@ def get_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11473,10 +11943,13 @@ def _create_or_update_slot_initial( ): # type: (...) -> "models.Site" cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_slot_initial.metadata['url'] # type: ignore @@ -11495,13 +11968,12 @@ def _create_or_update_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'Site') 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 @@ -11630,9 +12102,12 @@ def delete_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_slot.metadata['url'] # type: ignore @@ -11654,6 +12129,7 @@ def delete_slot( # 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) @@ -11699,10 +12175,13 @@ def update_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Site"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_slot.metadata['url'] # type: ignore @@ -11721,13 +12200,12 @@ def update_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_envelope, 'SitePatchResource') 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 @@ -11775,9 +12253,12 @@ def analyze_custom_hostname_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CustomHostnameAnalysisResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.analyze_custom_hostname_slot.metadata['url'] # type: ignore @@ -11797,7 +12278,7 @@ def analyze_custom_hostname_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -11844,10 +12325,13 @@ def apply_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.apply_slot_configuration_slot.metadata['url'] # type: ignore @@ -11866,12 +12350,12 @@ def apply_slot_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -11914,10 +12398,13 @@ def backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.backup_slot.metadata['url'] # type: ignore @@ -11936,13 +12423,12 @@ def backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -11984,14 +12470,17 @@ def list_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12067,9 +12556,12 @@ def get_backup_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_status_slot.metadata['url'] # type: ignore @@ -12088,7 +12580,7 @@ def get_backup_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12135,9 +12627,12 @@ def delete_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup_slot.metadata['url'] # type: ignore @@ -12156,6 +12651,7 @@ def delete_backup_slot( # 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) @@ -12203,10 +12699,13 @@ def list_backup_status_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItem"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.list_backup_status_secrets_slot.metadata['url'] # type: ignore @@ -12226,13 +12725,12 @@ def list_backup_status_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -12260,10 +12758,13 @@ def _restore_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_slot_initial.metadata['url'] # type: ignore @@ -12283,12 +12784,12 @@ def _restore_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -12401,14 +12902,17 @@ def list_configurations_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -12484,10 +12988,13 @@ def update_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_application_settings_slot.metadata['url'] # type: ignore @@ -12506,13 +13013,12 @@ def update_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(app_settings, 'StringDictionary') 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 @@ -12554,9 +13060,12 @@ def list_application_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_application_settings_slot.metadata['url'] # type: ignore @@ -12574,7 +13083,7 @@ def list_application_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12620,10 +13129,13 @@ def update_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_auth_settings_slot.metadata['url'] # type: ignore @@ -12642,13 +13154,12 @@ def update_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_auth_settings, 'SiteAuthSettings') 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 @@ -12690,9 +13201,12 @@ def get_auth_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteAuthSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_auth_settings_slot.metadata['url'] # type: ignore @@ -12710,7 +13224,7 @@ def get_auth_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12757,10 +13271,13 @@ def update_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12779,13 +13296,12 @@ def update_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_storage_accounts, 'AzureStoragePropertyDictionaryResource') 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 @@ -12827,9 +13343,12 @@ def list_azure_storage_accounts_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.AzureStoragePropertyDictionaryResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_azure_storage_accounts_slot.metadata['url'] # type: ignore @@ -12847,7 +13366,7 @@ def list_azure_storage_accounts_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -12894,10 +13413,13 @@ def update_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_backup_configuration_slot.metadata['url'] # type: ignore @@ -12916,13 +13438,12 @@ def update_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'BackupRequest') 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 @@ -12964,9 +13485,12 @@ def delete_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_backup_configuration_slot.metadata['url'] # type: ignore @@ -12984,6 +13508,7 @@ def delete_backup_configuration_slot( # 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) @@ -13024,9 +13549,12 @@ def get_backup_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_backup_configuration_slot.metadata['url'] # type: ignore @@ -13044,7 +13572,7 @@ def get_backup_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13091,10 +13619,13 @@ def update_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_connection_strings_slot.metadata['url'] # type: ignore @@ -13113,13 +13644,12 @@ def update_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_strings, 'ConnectionStringDictionary') 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 @@ -13161,9 +13691,12 @@ def list_connection_strings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConnectionStringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_connection_strings_slot.metadata['url'] # type: ignore @@ -13181,7 +13714,7 @@ def list_connection_strings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13225,9 +13758,12 @@ def get_diagnostic_logs_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_diagnostic_logs_configuration_slot.metadata['url'] # type: ignore @@ -13245,7 +13781,7 @@ def get_diagnostic_logs_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13293,10 +13829,13 @@ def update_diagnostic_logs_config_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteLogsConfig"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_diagnostic_logs_config_slot.metadata['url'] # type: ignore @@ -13315,13 +13854,12 @@ def update_diagnostic_logs_config_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_logs_config, 'SiteLogsConfig') 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 @@ -13366,10 +13904,13 @@ def update_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_metadata_slot.metadata['url'] # type: ignore @@ -13388,13 +13929,12 @@ def update_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(metadata, 'StringDictionary') 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 @@ -13436,9 +13976,12 @@ def list_metadata_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_metadata_slot.metadata['url'] # type: ignore @@ -13456,7 +13999,7 @@ def list_metadata_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13484,9 +14027,12 @@ def _list_publishing_credentials_slot_initial( ): # type: (...) -> "models.User" cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._list_publishing_credentials_slot_initial.metadata['url'] # type: ignore @@ -13504,7 +14050,7 @@ def _list_publishing_credentials_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13619,10 +14165,13 @@ def update_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_site_push_settings_slot.metadata['url'] # type: ignore @@ -13641,13 +14190,12 @@ def update_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(push_settings, 'PushSettings') 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 @@ -13688,9 +14236,12 @@ def list_site_push_settings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PushSettings"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_site_push_settings_slot.metadata['url'] # type: ignore @@ -13708,7 +14259,7 @@ def list_site_push_settings_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13753,9 +14304,12 @@ def get_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_slot.metadata['url'] # type: ignore @@ -13773,7 +14327,7 @@ def get_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -13820,10 +14374,13 @@ def create_or_update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_configuration_slot.metadata['url'] # type: ignore @@ -13842,13 +14399,12 @@ def create_or_update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13893,10 +14449,13 @@ def update_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_configuration_slot.metadata['url'] # type: ignore @@ -13915,13 +14474,12 @@ def update_configuration_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_config, 'SiteConfigResource') 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 @@ -13964,14 +14522,17 @@ def list_configuration_snapshot_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigurationSnapshotInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14047,9 +14608,12 @@ def get_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteConfigResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -14068,7 +14632,7 @@ def get_configuration_snapshot_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14115,9 +14679,12 @@ def recover_site_configuration_snapshot_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.recover_site_configuration_snapshot_slot.metadata['url'] # type: ignore @@ -14136,6 +14703,7 @@ def recover_site_configuration_snapshot_slot( # 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) @@ -14175,9 +14743,12 @@ def get_web_site_container_logs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/octet-stream" # Construct URL url = self.get_web_site_container_logs_slot.metadata['url'] # type: ignore @@ -14195,7 +14766,7 @@ def get_web_site_container_logs_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/octet-stream' + 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=True, **kwargs) @@ -14239,9 +14810,12 @@ def get_container_logs_zip_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/zip" # Construct URL url = self.get_container_logs_zip_slot.metadata['url'] # type: ignore @@ -14259,7 +14833,7 @@ def get_container_logs_zip_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/zip' + 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=True, **kwargs) @@ -14304,14 +14878,17 @@ def list_continuous_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ContinuousWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14387,9 +14964,12 @@ def get_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ContinuousWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14408,7 +14988,7 @@ def get_continuous_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14457,9 +15037,12 @@ def delete_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14478,6 +15061,7 @@ def delete_continuous_web_job_slot( # 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) @@ -14521,9 +15105,12 @@ def start_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14542,6 +15129,7 @@ def start_continuous_web_job_slot( # 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) @@ -14585,9 +15173,12 @@ def stop_continuous_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_continuous_web_job_slot.metadata['url'] # type: ignore @@ -14606,6 +15197,7 @@ def stop_continuous_web_job_slot( # 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) @@ -14646,14 +15238,17 @@ def list_deployments_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -14729,9 +15324,12 @@ def get_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_deployment_slot.metadata['url'] # type: ignore @@ -14750,7 +15348,7 @@ def get_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -14800,10 +15398,13 @@ def create_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_deployment_slot.metadata['url'] # type: ignore @@ -14823,13 +15424,12 @@ def create_deployment_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment, 'Deployment') 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 @@ -14874,9 +15474,12 @@ def delete_deployment_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_deployment_slot.metadata['url'] # type: ignore @@ -14895,6 +15498,7 @@ def delete_deployment_slot( # 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) @@ -14939,9 +15543,12 @@ def list_deployment_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Deployment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_deployment_log_slot.metadata['url'] # type: ignore @@ -14960,7 +15567,7 @@ def list_deployment_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15009,10 +15616,13 @@ def discover_backup_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RestoreRequest"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.discover_backup_slot.metadata['url'] # type: ignore @@ -15031,13 +15641,12 @@ def discover_backup_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -15079,14 +15688,17 @@ def list_domain_ownership_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15162,9 +15774,12 @@ def get_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15183,7 +15798,7 @@ def get_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15234,10 +15849,13 @@ def create_or_update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15257,13 +15875,12 @@ def create_or_update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -15308,9 +15925,12 @@ def delete_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15329,6 +15949,7 @@ def delete_domain_ownership_identifier_slot( # 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) @@ -15376,10 +15997,13 @@ def update_domain_ownership_identifier_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Identifier"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_domain_ownership_identifier_slot.metadata['url'] # type: ignore @@ -15399,13 +16023,12 @@ def update_domain_ownership_identifier_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(domain_ownership_identifier, 'Identifier') 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 @@ -15446,9 +16069,12 @@ def get_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -15466,7 +16092,7 @@ def get_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15495,10 +16121,13 @@ def _create_ms_deploy_operation_slot_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -15517,13 +16146,12 @@ def _create_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -15638,9 +16266,12 @@ def get_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -15658,7 +16289,7 @@ def get_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15703,14 +16334,17 @@ def list_instance_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelopeCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -15782,9 +16416,12 @@ def get_functions_admin_token_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_functions_admin_token_slot.metadata['url'] # type: ignore @@ -15802,7 +16439,7 @@ def get_functions_admin_token_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15848,9 +16485,12 @@ def get_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.FunctionEnvelope"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_function_slot.metadata['url'] # type: ignore @@ -15869,7 +16509,7 @@ def get_instance_function_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -15901,10 +16541,13 @@ def _create_instance_function_slot_initial( ): # type: (...) -> "models.FunctionEnvelope" cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionEnvelope"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_function_slot_initial.metadata['url'] # type: ignore @@ -15924,13 +16567,12 @@ def _create_instance_function_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(function_envelope, 'FunctionEnvelope') 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 @@ -16050,9 +16692,12 @@ def delete_instance_function_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_instance_function_slot.metadata['url'] # type: ignore @@ -16071,6 +16716,7 @@ def delete_instance_function_slot( # 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) @@ -16119,10 +16765,13 @@ def create_or_update_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_function_secret_slot.metadata['url'] # type: ignore @@ -16143,13 +16792,12 @@ def create_or_update_function_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -16200,9 +16848,12 @@ def delete_function_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_function_secret_slot.metadata['url'] # type: ignore @@ -16222,6 +16873,7 @@ def delete_function_secret_slot( # 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) @@ -16264,9 +16916,12 @@ def list_function_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.StringDictionary"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_keys_slot.metadata['url'] # type: ignore @@ -16285,7 +16940,7 @@ def list_function_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16331,9 +16986,12 @@ def list_function_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_function_secrets_slot.metadata['url'] # type: ignore @@ -16352,7 +17010,7 @@ def list_function_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16395,9 +17053,12 @@ def list_host_keys_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_host_keys_slot.metadata['url'] # type: ignore @@ -16415,7 +17076,7 @@ def list_host_keys_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16458,9 +17119,12 @@ def list_sync_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_status_slot.metadata['url'] # type: ignore @@ -16478,6 +17142,7 @@ def list_sync_status_slot( # 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) @@ -16517,9 +17182,12 @@ def sync_functions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_functions_slot.metadata['url'] # type: ignore @@ -16537,6 +17205,7 @@ def sync_functions_slot( # 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) @@ -16585,10 +17254,13 @@ def create_or_update_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.KeyInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_secret_slot.metadata['url'] # type: ignore @@ -16609,13 +17281,12 @@ def create_or_update_host_secret_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(key, 'KeyInfo') 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 @@ -16666,9 +17337,12 @@ def delete_host_secret_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_secret_slot.metadata['url'] # type: ignore @@ -16688,6 +17362,7 @@ def delete_host_secret_slot( # 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) @@ -16728,14 +17403,17 @@ def list_host_name_bindings_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBindingCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -16811,9 +17489,12 @@ def get_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_host_name_binding_slot.metadata['url'] # type: ignore @@ -16832,7 +17513,7 @@ def get_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -16883,10 +17564,13 @@ def create_or_update_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HostNameBinding"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_host_name_binding_slot.metadata['url'] # type: ignore @@ -16906,13 +17590,12 @@ def create_or_update_host_name_binding_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(host_name_binding, 'HostNameBinding') 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 @@ -16957,9 +17640,12 @@ def delete_host_name_binding_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_host_name_binding_slot.metadata['url'] # type: ignore @@ -16978,6 +17664,7 @@ def delete_host_name_binding_slot( # 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) @@ -17023,9 +17710,12 @@ def get_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_hybrid_connection_slot.metadata['url'] # type: ignore @@ -17045,7 +17735,7 @@ def get_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17097,10 +17787,13 @@ def create_or_update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -17121,13 +17814,12 @@ def create_or_update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -17174,9 +17866,12 @@ def delete_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_hybrid_connection_slot.metadata['url'] # type: ignore @@ -17196,6 +17891,7 @@ def delete_hybrid_connection_slot( # 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) @@ -17244,10 +17940,13 @@ def update_hybrid_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_hybrid_connection_slot.metadata['url'] # type: ignore @@ -17268,13 +17967,12 @@ def update_hybrid_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'HybridConnection') 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 @@ -17315,9 +18013,12 @@ def list_hybrid_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.HybridConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_hybrid_connections_slot.metadata['url'] # type: ignore @@ -17335,7 +18036,7 @@ def list_hybrid_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17380,9 +18081,12 @@ def list_relay_service_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_relay_service_connections_slot.metadata['url'] # type: ignore @@ -17400,7 +18104,7 @@ def list_relay_service_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17447,9 +18151,12 @@ def get_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17468,7 +18175,7 @@ def get_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17519,10 +18226,13 @@ def create_or_update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17542,13 +18252,12 @@ def create_or_update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17593,9 +18302,12 @@ def delete_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17614,6 +18326,7 @@ def delete_relay_service_connection_slot( # 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) @@ -17661,10 +18374,13 @@ def update_relay_service_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.RelayServiceConnectionEntity"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_relay_service_connection_slot.metadata['url'] # type: ignore @@ -17684,13 +18400,12 @@ def update_relay_service_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'RelayServiceConnectionEntity') 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 @@ -17732,14 +18447,17 @@ def list_instance_identifiers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebAppInstanceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -17815,9 +18533,12 @@ def get_instance_info_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebSiteInstanceStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_info_slot.metadata['url'] # type: ignore @@ -17836,7 +18557,7 @@ def get_instance_info_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17882,9 +18603,12 @@ def get_instance_ms_deploy_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MSDeployStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_status_slot.metadata['url'] # type: ignore @@ -17903,7 +18627,7 @@ def get_instance_ms_deploy_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -17933,10 +18657,13 @@ def _create_instance_ms_deploy_operation_slot_initial( ): # type: (...) -> Optional["models.MSDeployStatus"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_instance_ms_deploy_operation_slot_initial.metadata['url'] # type: ignore @@ -17956,13 +18683,12 @@ def _create_instance_ms_deploy_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(ms_deploy, 'MSDeploy') 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 @@ -18084,9 +18810,12 @@ def get_instance_ms_deploy_log_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MSDeployLog"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_ms_deploy_log_slot.metadata['url'] # type: ignore @@ -18105,7 +18834,7 @@ def get_instance_ms_deploy_log_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18156,14 +18885,17 @@ def list_instance_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18245,9 +18977,12 @@ def get_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_slot.metadata['url'] # type: ignore @@ -18267,7 +19002,7 @@ def get_instance_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18321,9 +19056,12 @@ def delete_instance_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_instance_process_slot.metadata['url'] # type: ignore @@ -18343,6 +19081,7 @@ def delete_instance_process_slot( # 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) @@ -18391,9 +19130,12 @@ def get_instance_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_dump_slot.metadata['url'] # type: ignore @@ -18413,7 +19155,7 @@ def get_instance_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -18467,14 +19209,17 @@ def list_instance_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18560,9 +19305,12 @@ def get_instance_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_instance_process_module_slot.metadata['url'] # type: ignore @@ -18583,7 +19331,7 @@ def get_instance_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18637,14 +19385,17 @@ def list_instance_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18719,9 +19470,12 @@ def is_cloneable_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteCloneability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.is_cloneable_slot.metadata['url'] # type: ignore @@ -18739,7 +19493,7 @@ def is_cloneable_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18783,14 +19537,17 @@ def list_site_backups_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BackupItemCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -18862,9 +19619,12 @@ def list_sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.FunctionSecrets"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_sync_function_triggers_slot.metadata['url'] # type: ignore @@ -18882,7 +19642,7 @@ def list_sync_function_triggers_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18926,9 +19686,12 @@ def get_migrate_my_sql_status_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MigrateMySqlStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_migrate_my_sql_status_slot.metadata['url'] # type: ignore @@ -18946,7 +19709,7 @@ def get_migrate_my_sql_status_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -18990,9 +19753,12 @@ def get_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -19010,7 +19776,7 @@ def get_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19061,10 +19827,13 @@ def create_or_update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -19083,13 +19852,12 @@ def create_or_update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -19131,9 +19899,12 @@ def delete_swift_virtual_network_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_swift_virtual_network_slot.metadata['url'] # type: ignore @@ -19151,6 +19922,7 @@ def delete_swift_virtual_network_slot( # 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) @@ -19198,10 +19970,13 @@ def update_swift_virtual_network_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SwiftVirtualNetwork"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_swift_virtual_network_connection_slot.metadata['url'] # type: ignore @@ -19220,13 +19995,12 @@ def update_swift_virtual_network_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'SwiftVirtualNetwork') 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 @@ -19271,9 +20045,12 @@ def list_network_features_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.NetworkFeatures"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_network_features_slot.metadata['url'] # type: ignore @@ -19292,7 +20069,7 @@ def list_network_features_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19342,9 +20119,12 @@ def get_network_trace_operation_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot.metadata['url'] # type: ignore @@ -19363,7 +20143,7 @@ def get_network_trace_operation_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19419,9 +20199,12 @@ def start_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -19445,7 +20228,7 @@ def start_web_site_network_trace_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19476,9 +20259,12 @@ def _start_web_site_network_trace_operation_slot_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_web_site_network_trace_operation_slot_initial.metadata['url'] # type: ignore @@ -19502,7 +20288,7 @@ def _start_web_site_network_trace_operation_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19629,9 +20415,12 @@ def stop_web_site_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_web_site_network_trace_slot.metadata['url'] # type: ignore @@ -19649,6 +20438,7 @@ def stop_web_site_network_trace_slot( # 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) @@ -19693,9 +20483,12 @@ def get_network_traces_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot.metadata['url'] # type: ignore @@ -19714,7 +20507,7 @@ def get_network_traces_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19762,9 +20555,12 @@ def get_network_trace_operation_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_trace_operation_slot_v2.metadata['url'] # type: ignore @@ -19783,7 +20579,7 @@ def get_network_trace_operation_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19835,9 +20631,12 @@ def get_network_traces_slot_v2( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_network_traces_slot_v2.metadata['url'] # type: ignore @@ -19856,7 +20655,7 @@ def get_network_traces_slot_v2( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -19901,9 +20700,12 @@ def generate_new_site_publishing_password_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.generate_new_site_publishing_password_slot.metadata['url'] # type: ignore @@ -19921,6 +20723,7 @@ def generate_new_site_publishing_password_slot( # 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) @@ -19965,14 +20768,17 @@ def list_perf_mon_counters_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PerfMonCounterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -20046,9 +20852,12 @@ def get_site_php_error_log_flag_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SitePhpErrorLogFlag"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_php_error_log_flag_slot.metadata['url'] # type: ignore @@ -20066,7 +20875,7 @@ def get_site_php_error_log_flag_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20110,9 +20919,12 @@ def list_premier_add_ons_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_premier_add_ons_slot.metadata['url'] # type: ignore @@ -20130,7 +20942,7 @@ def list_premier_add_ons_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20177,9 +20989,12 @@ def get_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_premier_add_on_slot.metadata['url'] # type: ignore @@ -20198,7 +21013,7 @@ def get_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20248,10 +21063,13 @@ def add_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.add_premier_add_on_slot.metadata['url'] # type: ignore @@ -20271,13 +21089,12 @@ def add_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOn') 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 @@ -20322,9 +21139,12 @@ def delete_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_premier_add_on_slot.metadata['url'] # type: ignore @@ -20343,6 +21163,7 @@ def delete_premier_add_on_slot( # 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) @@ -20389,10 +21210,13 @@ def update_premier_add_on_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOn"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_premier_add_on_slot.metadata['url'] # type: ignore @@ -20412,13 +21236,12 @@ def update_premier_add_on_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(premier_add_on, 'PremierAddOnPatchResource') 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 @@ -20460,9 +21283,12 @@ def get_private_access_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_access_slot.metadata['url'] # type: ignore @@ -20480,7 +21306,7 @@ def get_private_access_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20527,10 +21353,13 @@ def put_private_access_vnet_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateAccess"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.put_private_access_vnet_slot.metadata['url'] # type: ignore @@ -20549,13 +21378,12 @@ def put_private_access_vnet_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(access, 'PrivateAccess') 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 @@ -20596,9 +21424,12 @@ def get_private_endpoint_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_endpoint_connection.metadata['url'] # type: ignore @@ -20616,7 +21447,7 @@ def get_private_endpoint_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20645,10 +21476,13 @@ def _approve_or_reject_private_endpoint_connection_initial( ): # type: (...) -> "models.PrivateEndpointConnectionResource" cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._approve_or_reject_private_endpoint_connection_initial.metadata['url'] # type: ignore @@ -20667,13 +21501,12 @@ def _approve_or_reject_private_endpoint_connection_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(private_endpoint_wrapper, 'PrivateLinkConnectionApprovalRequestResource') 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 @@ -20775,9 +21608,12 @@ def _delete_private_endpoint_connection_initial( ): # type: (...) -> object cls = kwargs.pop('cls', None) # type: ClsType[object] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._delete_private_endpoint_connection_initial.metadata['url'] # type: ignore @@ -20795,7 +21631,7 @@ def _delete_private_endpoint_connection_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20910,9 +21746,12 @@ def get_private_link_resources( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesWrapper"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_private_link_resources.metadata['url'] # type: ignore @@ -20929,7 +21768,7 @@ def get_private_link_resources( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -20974,14 +21813,17 @@ def list_processes_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21058,9 +21900,12 @@ def get_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_slot.metadata['url'] # type: ignore @@ -21079,7 +21924,7 @@ def get_process_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21129,9 +21974,12 @@ def delete_process_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_process_slot.metadata['url'] # type: ignore @@ -21150,6 +21998,7 @@ def delete_process_slot( # 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) @@ -21194,9 +22043,12 @@ def get_process_dump_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_dump_slot.metadata['url'] # type: ignore @@ -21215,7 +22067,7 @@ def get_process_dump_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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=True, **kwargs) @@ -21265,14 +22117,17 @@ def list_process_modules_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessModuleInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21353,9 +22208,12 @@ def get_process_module_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ProcessModuleInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_process_module_slot.metadata['url'] # type: ignore @@ -21375,7 +22233,7 @@ def get_process_module_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21425,14 +22283,17 @@ def list_process_threads_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ProcessThreadInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21506,14 +22367,17 @@ def list_public_certificates_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificateCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -21589,9 +22453,12 @@ def get_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_public_certificate_slot.metadata['url'] # type: ignore @@ -21610,7 +22477,7 @@ def get_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -21661,10 +22528,13 @@ def create_or_update_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PublicCertificate"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_public_certificate_slot.metadata['url'] # type: ignore @@ -21684,13 +22554,12 @@ def create_or_update_public_certificate_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(public_certificate, 'PublicCertificate') 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 @@ -21735,9 +22604,12 @@ def delete_public_certificate_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_public_certificate_slot.metadata['url'] # type: ignore @@ -21756,6 +22628,7 @@ def delete_public_certificate_slot( # 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) @@ -21800,10 +22673,13 @@ def list_publishing_profile_xml_with_secrets_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[IO] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/xml" # Construct URL url = self.list_publishing_profile_xml_with_secrets_slot.metadata['url'] # type: ignore @@ -21822,13 +22698,12 @@ def list_publishing_profile_xml_with_secrets_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(publishing_profile_options, 'CsmPublishingProfileOptions') 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=True, **kwargs) response = pipeline_response.http_response @@ -21871,9 +22746,12 @@ def reset_slot_configuration_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.reset_slot_configuration_slot.metadata['url'] # type: ignore @@ -21891,6 +22769,7 @@ def reset_slot_configuration_slot( # 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) @@ -21939,9 +22818,12 @@ def restart_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.restart_slot.metadata['url'] # type: ignore @@ -21963,6 +22845,7 @@ def restart_slot( # 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) @@ -21988,10 +22871,13 @@ def _restore_from_backup_blob_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_backup_blob_slot_initial.metadata['url'] # type: ignore @@ -22010,12 +22896,12 @@ def _restore_from_backup_blob_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request, 'RestoreRequest') 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 @@ -22109,10 +22995,13 @@ def _restore_from_deleted_app_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_from_deleted_app_slot_initial.metadata['url'] # type: ignore @@ -22131,12 +23020,12 @@ def _restore_from_deleted_app_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'DeletedAppRestoreRequest') 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 @@ -22229,10 +23118,13 @@ def _restore_snapshot_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._restore_snapshot_slot_initial.metadata['url'] # type: ignore @@ -22251,12 +23143,12 @@ def _restore_snapshot_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(restore_request, 'SnapshotRestoreRequest') 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 @@ -22365,14 +23257,17 @@ def list_site_extensions_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteExtensionInfoCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22448,9 +23343,12 @@ def get_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_site_extension_slot.metadata['url'] # type: ignore @@ -22469,7 +23367,7 @@ def get_site_extension_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -22500,9 +23398,12 @@ def _install_site_extension_slot_initial( ): # type: (...) -> Optional["models.SiteExtensionInfo"] cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SiteExtensionInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._install_site_extension_slot_initial.metadata['url'] # type: ignore @@ -22521,7 +23422,7 @@ def _install_site_extension_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -22646,9 +23547,12 @@ def delete_site_extension_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_site_extension_slot.metadata['url'] # type: ignore @@ -22667,6 +23571,7 @@ def delete_site_extension_slot( # 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) @@ -22692,10 +23597,13 @@ def _copy_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._copy_slot_initial.metadata['url'] # type: ignore @@ -22714,12 +23622,12 @@ def _copy_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(copy_slot_entity, 'CsmCopySlotEntity') 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 @@ -22832,16 +23740,19 @@ def list_slot_differences_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -22861,7 +23772,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -22869,7 +23779,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -22907,10 +23816,13 @@ def _swap_slot_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._swap_slot_initial.metadata['url'] # type: ignore @@ -22929,12 +23841,12 @@ def _swap_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -23042,14 +23954,17 @@ def list_snapshots_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23121,14 +24036,17 @@ def list_snapshots_from_dr_secondary_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -23201,9 +24119,12 @@ def get_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_source_control_slot.metadata['url'] # type: ignore @@ -23221,7 +24142,7 @@ def get_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23257,10 +24178,13 @@ def _create_or_update_source_control_slot_initial( ): # type: (...) -> "models.SiteSourceControl" cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_slot_initial.metadata['url'] # type: ignore @@ -23279,13 +24203,12 @@ def _create_or_update_source_control_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -23407,9 +24330,12 @@ def delete_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_source_control_slot.metadata['url'] # type: ignore @@ -23427,6 +24353,7 @@ def delete_source_control_slot( # 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) @@ -23470,10 +24397,13 @@ def update_source_control_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control_slot.metadata['url'] # type: ignore @@ -23492,13 +24422,12 @@ def update_source_control_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -23547,9 +24476,12 @@ def start_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start_slot.metadata['url'] # type: ignore @@ -23567,6 +24499,7 @@ def start_slot( # 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) @@ -23594,9 +24527,12 @@ def _start_network_trace_slot_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_network_trace_slot_initial.metadata['url'] # type: ignore @@ -23620,7 +24556,7 @@ def _start_network_trace_slot_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -23748,9 +24684,12 @@ def stop_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_slot.metadata['url'] # type: ignore @@ -23768,6 +24707,7 @@ def stop_slot( # 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) @@ -23807,9 +24747,12 @@ def stop_network_trace_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_network_trace_slot.metadata['url'] # type: ignore @@ -23827,6 +24770,7 @@ def stop_network_trace_slot( # 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) @@ -23866,9 +24810,12 @@ def sync_repository_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_repository_slot.metadata['url'] # type: ignore @@ -23886,6 +24833,7 @@ def sync_repository_slot( # 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) @@ -23925,9 +24873,12 @@ def sync_function_triggers_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_function_triggers_slot.metadata['url'] # type: ignore @@ -23945,6 +24896,7 @@ def sync_function_triggers_slot( # 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) @@ -23985,14 +24937,17 @@ def list_triggered_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24068,9 +25023,12 @@ def get_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_slot.metadata['url'] # type: ignore @@ -24089,7 +25047,7 @@ def get_triggered_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24138,9 +25096,12 @@ def delete_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_triggered_web_job_slot.metadata['url'] # type: ignore @@ -24159,6 +25120,7 @@ def delete_triggered_web_job_slot( # 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) @@ -24202,14 +25164,17 @@ def list_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24290,9 +25255,12 @@ def get_triggered_web_job_history_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history_slot.metadata['url'] # type: ignore @@ -24312,7 +25280,7 @@ def get_triggered_web_job_history_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24361,9 +25329,12 @@ def run_triggered_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.run_triggered_web_job_slot.metadata['url'] # type: ignore @@ -24382,6 +25353,7 @@ def run_triggered_web_job_slot( # 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) @@ -24428,14 +25400,17 @@ def list_usages_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -24510,9 +25485,12 @@ def list_vnet_connections_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections_slot.metadata['url'] # type: ignore @@ -24530,7 +25508,7 @@ def list_vnet_connections_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24577,9 +25555,12 @@ def get_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_slot.metadata['url'] # type: ignore @@ -24598,7 +25579,7 @@ def get_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24649,10 +25630,13 @@ def create_or_update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_slot.metadata['url'] # type: ignore @@ -24672,13 +25656,12 @@ def create_or_update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -24724,9 +25707,12 @@ def delete_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_vnet_connection_slot.metadata['url'] # type: ignore @@ -24745,6 +25731,7 @@ def delete_vnet_connection_slot( # 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) @@ -24792,10 +25779,13 @@ def update_vnet_connection_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_slot.metadata['url'] # type: ignore @@ -24815,13 +25805,12 @@ def update_vnet_connection_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -24869,9 +25858,12 @@ def get_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24891,7 +25883,7 @@ def get_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -24946,10 +25938,13 @@ def create_or_update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -24970,13 +25965,12 @@ def create_or_update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -25027,10 +26021,13 @@ def update_vnet_connection_gateway_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway_slot.metadata['url'] # type: ignore @@ -25051,13 +26048,12 @@ def update_vnet_connection_gateway_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -25099,14 +26095,17 @@ def list_web_jobs_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25182,9 +26181,12 @@ def get_web_job_slot( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_web_job_slot.metadata['url'] # type: ignore @@ -25203,7 +26205,7 @@ def get_web_job_slot( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25246,16 +26248,19 @@ def list_slot_differences_from_production( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SlotDifferenceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25274,7 +26279,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -25282,7 +26286,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -25319,10 +26322,13 @@ def _swap_slot_with_production_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._swap_slot_with_production_initial.metadata['url'] # type: ignore @@ -25340,12 +26346,12 @@ def _swap_slot_with_production_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(slot_swap_entity, 'CsmSlotEntity') 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 @@ -25445,14 +26451,17 @@ def list_snapshots( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25520,14 +26529,17 @@ def list_snapshots_from_dr_secondary( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SnapshotCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -25595,9 +26607,12 @@ def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -25614,7 +26629,7 @@ def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -25649,10 +26664,13 @@ def _create_or_update_source_control_initial( ): # type: (...) -> "models.SiteSourceControl" cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_source_control_initial.metadata['url'] # type: ignore @@ -25670,13 +26688,12 @@ def _create_or_update_source_control_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -25789,9 +26806,12 @@ def delete_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_source_control.metadata['url'] # type: ignore @@ -25808,6 +26828,7 @@ def delete_source_control( # 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) @@ -25847,10 +26868,13 @@ def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SiteSourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -25868,13 +26892,12 @@ def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(site_source_control, 'SiteSourceControl') 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 @@ -25919,9 +26942,12 @@ def start( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.start.metadata['url'] # type: ignore @@ -25938,6 +26964,7 @@ def start( # 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) @@ -25964,9 +26991,12 @@ def _start_network_trace_initial( ): # type: (...) -> List["models.NetworkTrace"] cls = kwargs.pop('cls', None) # type: ClsType[List["models.NetworkTrace"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self._start_network_trace_initial.metadata['url'] # type: ignore @@ -25989,7 +27019,7 @@ def _start_network_trace_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26109,9 +27139,12 @@ def stop( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop.metadata['url'] # type: ignore @@ -26128,6 +27161,7 @@ def stop( # 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) @@ -26164,9 +27198,12 @@ def stop_network_trace( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.stop_network_trace.metadata['url'] # type: ignore @@ -26183,6 +27220,7 @@ def stop_network_trace( # 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) @@ -26219,9 +27257,12 @@ def sync_repository( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_repository.metadata['url'] # type: ignore @@ -26238,6 +27279,7 @@ def sync_repository( # 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) @@ -26274,9 +27316,12 @@ def sync_function_triggers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.sync_function_triggers.metadata['url'] # type: ignore @@ -26293,6 +27338,7 @@ def sync_function_triggers( # 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) @@ -26329,14 +27375,17 @@ def list_triggered_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredWebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26407,9 +27456,12 @@ def get_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredWebJob"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job.metadata['url'] # type: ignore @@ -26427,7 +27479,7 @@ def get_triggered_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26472,9 +27524,12 @@ def delete_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_triggered_web_job.metadata['url'] # type: ignore @@ -26492,6 +27547,7 @@ def delete_triggered_web_job( # 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) @@ -26531,14 +27587,17 @@ def list_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TriggeredJobHistoryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26614,9 +27673,12 @@ def get_triggered_web_job_history( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TriggeredJobHistory"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_triggered_web_job_history.metadata['url'] # type: ignore @@ -26635,7 +27697,7 @@ def get_triggered_web_job_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26680,9 +27742,12 @@ def run_triggered_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.run_triggered_web_job.metadata['url'] # type: ignore @@ -26700,6 +27765,7 @@ def run_triggered_web_job( # 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) @@ -26742,14 +27808,17 @@ def list_usages( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CsmUsageQuotaCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -26819,9 +27888,12 @@ def list_vnet_connections( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.VnetInfo"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_vnet_connections.metadata['url'] # type: ignore @@ -26838,7 +27910,7 @@ def list_vnet_connections( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26881,9 +27953,12 @@ def get_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection.metadata['url'] # type: ignore @@ -26901,7 +27976,7 @@ def get_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -26948,10 +28023,13 @@ def create_or_update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection.metadata['url'] # type: ignore @@ -26970,13 +28048,12 @@ def create_or_update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -27018,9 +28095,12 @@ def delete_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.delete_vnet_connection.metadata['url'] # type: ignore @@ -27038,6 +28118,7 @@ def delete_vnet_connection( # 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) @@ -27081,10 +28162,13 @@ def update_vnet_connection( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetInfo"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection.metadata['url'] # type: ignore @@ -27103,13 +28187,12 @@ def update_vnet_connection( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetInfo') 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 @@ -27153,9 +28236,12 @@ def get_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.VnetGateway"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_vnet_connection_gateway.metadata['url'] # type: ignore @@ -27174,7 +28260,7 @@ def get_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -27225,10 +28311,13 @@ def create_or_update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -27248,13 +28337,12 @@ def create_or_update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -27301,10 +28389,13 @@ def update_vnet_connection_gateway( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetGateway"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_vnet_connection_gateway.metadata['url'] # type: ignore @@ -27324,13 +28415,12 @@ def update_vnet_connection_gateway( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(connection_envelope, 'VnetGateway') 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 @@ -27368,14 +28458,17 @@ def list_web_jobs( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJobCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -27446,9 +28539,12 @@ def get_web_job( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.WebJob"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_web_job.metadata['url'] # type: ignore @@ -27466,7 +28562,7 @@ def get_web_job( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py index 8853aeea0bf6..1e2a1cfdcf5f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -40,9 +40,12 @@ def get_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_publishing_user.metadata['url'] # type: ignore @@ -53,7 +56,7 @@ def get_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -90,10 +93,13 @@ def update_publishing_user( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.User"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_publishing_user.metadata['url'] # type: ignore @@ -105,13 +111,12 @@ def update_publishing_user( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(user_details, 'User') 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 @@ -143,14 +148,17 @@ def list_source_controls( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControlCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -209,9 +217,12 @@ def get_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_source_control.metadata['url'] # type: ignore @@ -226,7 +237,7 @@ def get_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -266,10 +277,13 @@ def update_source_control( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SourceControl"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update_source_control.metadata['url'] # type: ignore @@ -285,13 +299,12 @@ def update_source_control( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(request_message, 'SourceControl') 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 @@ -329,14 +342,17 @@ def list_billing_meters( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BillingMeterCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -409,12 +425,15 @@ def check_name_availability( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceNameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) _request = models.ResourceNameAvailabilityRequest(name=name, type=type, is_fqdn=is_fqdn) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.check_name_availability.metadata['url'] # type: ignore @@ -430,13 +449,12 @@ def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_request, 'ResourceNameAvailabilityRequest') 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 @@ -468,9 +486,12 @@ def get_subscription_deployment_locations( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentLocations"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.get_subscription_deployment_locations.metadata['url'] # type: ignore @@ -485,7 +506,7 @@ def get_subscription_deployment_locations( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -534,14 +555,17 @@ def list_geo_regions( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GeoRegionCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -612,16 +636,19 @@ def list_site_identifiers_assigned_to_host_name( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.IdentifierCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = "application/json" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -638,7 +665,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: url = next_link query_parameters = {} # type: Dict[str, Any] @@ -646,7 +672,6 @@ def prepare_request(next_link=None): body_content = self._serialize.body(name_identifier, 'NameIdentifier') body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request def extract_data(pipeline_response): @@ -689,14 +714,17 @@ def list_premier_add_on_offers( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PremierAddOnOfferCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -756,9 +784,12 @@ def list_skus( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.SkuInfos"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" + accept = "application/json" # Construct URL url = self.list_skus.metadata['url'] # type: ignore @@ -773,7 +804,7 @@ def list_skus( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -811,10 +842,13 @@ def verify_hosting_environment_vnet( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VnetValidationFailureDetails"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.verify_hosting_environment_vnet.metadata['url'] # type: ignore @@ -830,13 +864,12 @@ def verify_hosting_environment_vnet( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'VnetParameters') 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 @@ -874,10 +907,13 @@ def move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.move.metadata['url'] # type: ignore @@ -894,12 +930,12 @@ def move( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 @@ -934,10 +970,13 @@ def validate( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ValidateResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate.metadata['url'] # type: ignore @@ -954,13 +993,12 @@ def validate( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(validate_request, 'ValidateRequest') 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 @@ -998,10 +1036,13 @@ def validate_move( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.validate_move.metadata['url'] # type: ignore @@ -1018,12 +1059,12 @@ def validate_move( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(move_resource_envelope, 'CsmMoveResourceEnvelope') 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 diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/version.py deleted file mode 100644 index ecde0bf79400..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/version.py +++ /dev/null @@ -1,13 +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 = "0.42.0" - diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/version.py deleted file mode 100644 index 29fe9b397723..000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/version.py +++ /dev/null @@ -1,13 +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 = "0.46.0" - diff --git a/sdk/appservice/azure-mgmt-web/setup.py b/sdk/appservice/azure-mgmt-web/setup.py index bf245b12d22d..7a6371629610 100644 --- a/sdk/appservice/azure-mgmt-web/setup.py +++ b/sdk/appservice/azure-mgmt-web/setup.py @@ -80,7 +80,7 @@ install_requires=[ 'msrest>=0.5.0', 'azure-common~=1.1', - 'azure-mgmt-core>=1.0.0,<2.0.0', + 'azure-mgmt-core>=1.2.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'],